Jelajahi Sumber

try setting the shardgroups

Chris Mague 4 tahun lalu
induk
melakukan
68f1a47f46
1 mengubah file dengan 26 tambahan dan 2 penghapusan
  1. 26 2
      ansible/templates/setup_raft_cluster.j2

+ 26 - 2
ansible/templates/setup_raft_cluster.j2

@@ -15,11 +15,35 @@
 {% for p in redis_ports -%}
 #   - {{ p.port }}
 {% endfor %}
+
 #####################################################################
+# Raft Group Setups!!
 
 {% for p in redis_ports %}
-/usr/local/bin/redis-cli -h {{ primary_node }} -p {{ p.port }} raft.cluster init
+
+echo "Setting up Raft Groups - port {{ p.port }}"
+
+# /usr/local/bin/redis-cli -h {{ primary_node }} -p {{ p.port }} raft.cluster init
 {% for node in other_nodes %}
-/usr/local/bin/redis-cli -h {{ node }} -p {{ p.port }} raft.cluster join {{ primary_node }}:{{ p.port }}
+# /usr/local/bin/redis-cli -h {{ node }} -p {{ p.port }} raft.cluster join {{ primary_node }}:{{ p.port }}
 {% endfor %}
+
 {% endfor %}
+
+
+#####################################################################
+# Set up Shard Clusters
+
+{% for p in redis_ports %}
+
+echo "Setting up Shard Clusters - port {{ p.port }}"
+SHARDGROUP_CONFIG=$(/usr/local/bin/redis-cli -h {{ primary_node }} -p {{ p.port }} --raw RAFT.SHARDGROUP GET)
+# echo $SHARDGROUP_CONFIG
+
+{% for t in redis_ports %}
+{% if t.port != p.port %}
+echo "/usr/local/bin/redis-cli -h {{ primary_node }} -p {{ t.port }} RAFT.SHARDGROUP ADD $SHARDGROUP_CONFIG"
+{% endif %}
+{% endfor %}
+
+{% endfor %}