From 1aa5a12e26b105634cfc577781d5defe0122163a Mon Sep 17 00:00:00 2001 From: Mauro Mugnaini Date: Mon, 2 Nov 2020 13:27:22 +0100 Subject: [PATCH] Revised configuration templates to use rack topology names AWS oriented --- .../conductor-swarm-config.properties.j2 | 19 +++++++++++-------- .../templates/dynomite-service.yaml.j2 | 4 ++-- .../roles/dynomite/templates/seeds.list.j2 | 3 ++- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ansible/roles/conductor/templates/conductor-swarm-config.properties.j2 b/ansible/roles/conductor/templates/conductor-swarm-config.properties.j2 index 397fcc9..15dd945 100644 --- a/ansible/roles/conductor/templates/conductor-swarm-config.properties.j2 +++ b/ansible/roles/conductor/templates/conductor-swarm-config.properties.j2 @@ -14,19 +14,22 @@ db=dynomite # Dynomite Cluster details. # format is host:port:rack separated by semicolon workflow.dynomite.cluster.hosts={% set ns = namespace() %} -{% set ns.datacenter = "us-east-" %} -{% set ns.current_rack = "" %} -{% set ns.current_suffix = 0 %} +{% set ns.availability_zone = "" %} {% for seed in seeds %} {% set ns.seed_tokens = seed.split(':') %} -{% if ns.seed_tokens[2] != ns.current_rack %} -{% set ns.current_rack = ns.seed_tokens[2] %} -{% set ns.current_suffix = ns.current_suffix + 1 %} +{% if ns.availability_zone == "" %} +{% set ns.availability_zone = ns.seed_tokens[2] %} +{% endif %} +{% if ns.availability_zone == ns.seed_tokens[2] %} +{{ ns.seed_tokens[0] }}:8102:{{ ns.availability_zone }}{%- if not loop.last %};{%- endif %} {% endif %} -{{ ns.seed_tokens[0] }}:8102:{{ ns.seed_tokens[3] }}-{{ ns.current_suffix }}{%- if not loop.last %};{%- endif %} {%- endfor %} +# If you are running using dynomite, also add the following line to the property +# to set the rack/availability zone of the conductor server to be same as dynomite cluster config +EC2_AVAILABILTY_ZONE={{ ns.availability_zone }} + # Dynomite cluster name workflow.dynomite.cluster.name=dyno1 @@ -37,7 +40,7 @@ workflow.namespace.prefix=conductor workflow.namespace.queue.prefix=conductor_queues # No. of threads allocated to dyno-queues (optional) -queues.dynomite.threads=10 +queues.dynomite.threads=3 # Non-quorum port used to connect to local redis. Used by dyno-queues. # When using redis directly, set this to the same port as redis server diff --git a/ansible/roles/dynomite/templates/dynomite-service.yaml.j2 b/ansible/roles/dynomite/templates/dynomite-service.yaml.j2 index 3a8e61b..cd63d05 100644 --- a/ansible/roles/dynomite/templates/dynomite-service.yaml.j2 +++ b/ansible/roles/dynomite/templates/dynomite-service.yaml.j2 @@ -17,8 +17,8 @@ restart_policy: condition: on-failure delay: 5s - max_attempts: 3 - window: 120s + #max_attempts: 3 + #window: 120s configs: - source: seeds.list target: /dynomite/seeds.list diff --git a/ansible/roles/dynomite/templates/seeds.list.j2 b/ansible/roles/dynomite/templates/seeds.list.j2 index 5292f2c..25314c2 100644 --- a/ansible/roles/dynomite/templates/seeds.list.j2 +++ b/ansible/roles/dynomite/templates/seeds.list.j2 @@ -1,6 +1,7 @@ +{% set datacenter = "us-east-1" %} {% for replica in range(1,dynomite_replicas+1) %} {% set replicaloop = loop %} {% for shard in range(1,dynomite_shards+1) %} -dynomite{{ (replicaloop.index - 1) * dynomite_shards + shard}}:8101:rack{{ replicaloop.index }}:datacenter1:{{ (shard - 1) * (4294967295 // dynomite_shards) }} +dynomite{{ (replicaloop.index - 1) * dynomite_shards + shard}}:8101:{{ datacenter }}{{ "abcdefghijklmnopqrstuvwxyz"[replicaloop.index - 1] }}:{{ datacenter }}:{{ (shard - 1) * (4294967295 // dynomite_shards) }} {% endfor %} {% endfor %}