Merge lp:~adeuring/charms/precise/charmworld/es_shards_replicas into lp:~juju-jitsu/charms/precise/charmworld/trunk

Proposed by Abel Deuring
Status: Merged
Approved by: Abel Deuring
Approved revision: 77
Merged at revision: 77
Proposed branch: lp:~adeuring/charms/precise/charmworld/es_shards_replicas
Merge into: lp:~juju-jitsu/charms/precise/charmworld/trunk
Diff against target: 58 lines (+20/-2)
2 files modified
config.yaml (+12/-0)
scripts/write_config.py (+8/-2)
To merge this branch: bzr merge lp:~adeuring/charms/precise/charmworld/es_shards_replicas
Reviewer Review Type Date Requested Status
Aaron Bentley (community) Approve
Juju Gui Bot Approve
Review via email: mp+186777@code.launchpad.net

Description of the change

While working on a fixed ES mapping for charms, I introduced two new options, es_shards and es_replicas, to charmworld's configuration.

The default values (1 shard, 0 replicas) are reasonable for development, but should be changed for production. This branch adds these parameters to the charmwold charm. I kept the default values because they work for each setup, but when two or more ElasticSearch nodes are running, it is reasonable to increase both parameters in order to use all nodes properly.

To post a comment you must log in.
Revision history for this message
Juju Gui Bot (juju-gui-bot) wrote :

Looks good to me.

review: Approve
Revision history for this message
Aaron Bentley (abentley) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2013-06-18 16:15:50 +0000
3+++ config.yaml 2013-09-20 12:49:49 +0000
4@@ -35,3 +35,15 @@
5 description: |
6 The maximum number of charms to import from Launchpad during ingest.
7 -1 for no limit.
8+ es_shards:
9+ type: int
10+ default: 1
11+ description: |
12+ The number of shards used by ElasticSearch for indices.
13+ es_replicas:
14+ type: int
15+ default: 0
16+ description: |
17+ The number of replicas used by ElasticSearch for indices.
18+ This number should not exceed the number of ElasticSearch nodes
19+ minus one.
20
21=== modified file 'scripts/write_config.py'
22--- scripts/write_config.py 2013-06-18 16:15:50 +0000
23+++ scripts/write_config.py 2013-09-20 12:49:49 +0000
24@@ -20,7 +20,8 @@
25
26
27 def write_new_config(mongo_url, es_url, error_handler, charm_import_limit,
28- worker_interval, default, override, target):
29+ worker_interval, default, override, target, es_replicas,
30+ es_shards):
31 new_config = read_config([default, override])
32 new_config.set('app:main', 'mongo.url', mongo_url)
33 new_config.set('app:main', 'es_urls', es_url)
34@@ -43,6 +44,8 @@
35 'app:main', 'script_lease_time', ingest_cycle)
36 new_config.set(
37 'app:main', 'worker_interval', worker_interval)
38+ new_config.set('app:main', 'es_replicas', es_replicas)
39+ new_config.set('app:main', 'es_shards', es_shards)
40 with open(target, 'w') as output:
41 new_config.write(output)
42
43@@ -128,11 +131,14 @@
44 juju_config = config()
45 charm_import_limit = juju_config['charm_import_limit']
46 worker_interval = juju_config['worker-interval']
47+ es_shards = juju_config['es_shards']
48+ es_replicas = juju_config['es_replicas']
49
50 write_new_config(get_mongo_url(), get_elasticsearch_url(),
51 get_error_handler(), charm_import_limit,
52 worker_interval, default=sys.argv[1],
53- override=sys.argv[2], target=sys.argv[3])
54+ override=sys.argv[2], target=sys.argv[3],
55+ es_replicas=es_replicas, es_shards=es_shards)
56
57
58 if __name__ == '__main__':

Subscribers

People subscribed via source and target branches

to all changes: