Enable support for clustering with Redis
This patch configure the HAProxy that will do the load balances between
all instances. It also provides a common configuration for Redis
instances.
diff --git a/haproxy/proxy/listen/stacklight/redis.yml b/haproxy/proxy/listen/stacklight/redis.yml
new file mode 100644
index 0000000..bd36cb4
--- /dev/null
+++ b/haproxy/proxy/listen/stacklight/redis.yml
@@ -0,0 +1,31 @@
+parameters:
+ haproxy:
+ proxy:
+ listen:
+ redis:
+ mode: tcp
+ check:
+ tcp:
+ options:
+ - send PING\r\n
+ - expect string +PONG
+ - send info\ replication\r\n
+ - expect string role:master
+ - send QUIT\r\n
+ - expect string +OK
+ binds:
+ - address: ${_param:cluster_vip_address}
+ port: ${_param:cluster_redis_port}
+ servers:
+ - name: ${_param:cluster_node01_hostname}
+ host: ${_param:cluster_node01_address}
+ port: 6379
+ params: 'check'
+ - name: ${_param:cluster_node02_hostname}
+ host: ${_param:cluster_node02_address}
+ port: 6379
+ params: 'check'
+ - name: ${_param:cluster_node03_hostname}
+ host: ${_param:cluster_node03_address}
+ port: 6379
+ params: 'check'
diff --git a/reclass/storage/system/stacklight_monitor_cluster.yml b/reclass/storage/system/stacklight_monitor_cluster.yml
index 9df1a69..8c9a4c6 100644
--- a/reclass/storage/system/stacklight_monitor_cluster.yml
+++ b/reclass/storage/system/stacklight_monitor_cluster.yml
@@ -12,6 +12,7 @@
classes:
- cluster.${_param:cluster_name}.stacklight.monitor
params:
+ redis_cluster_role: 'master'
salt_master_host: ${_param:reclass_config_master}
linux_system_codename: xenial
single_address: ${_param:stacklight_monitor_node01_address}
@@ -22,6 +23,7 @@
classes:
- cluster.${_param:cluster_name}.stacklight.monitor
params:
+ redis_cluster_role: 'slave'
salt_master_host: ${_param:reclass_config_master}
linux_system_codename: xenial
single_address: ${_param:stacklight_monitor_node02_address}
@@ -32,6 +34,7 @@
classes:
- cluster.${_param:cluster_name}.stacklight.monitor
params:
+ redis_cluster_role: 'slave'
salt_master_host: ${_param:reclass_config_master}
linux_system_codename: xenial
single_address: ${_param:stacklight_monitor_node03_address}
diff --git a/reclass/storage/system/stacklight_server_cluster.yml b/reclass/storage/system/stacklight_server_cluster.yml
index edb7a94..979906a 100644
--- a/reclass/storage/system/stacklight_server_cluster.yml
+++ b/reclass/storage/system/stacklight_server_cluster.yml
@@ -15,6 +15,7 @@
- system.grafana.client.single
- system.kibana.client.single
params:
+ redis_cluster_role: 'master'
salt_master_host: ${_param:reclass_config_master}
linux_system_codename: xenial
single_address: ${_param:stacklight_monitor_node01_address}
@@ -25,6 +26,7 @@
classes:
- cluster.${_param:cluster_name}.stacklight.server
params:
+ redis_cluster_role: 'slave'
salt_master_host: ${_param:reclass_config_master}
linux_system_codename: xenial
single_address: ${_param:stacklight_monitor_node02_address}
@@ -35,6 +37,7 @@
classes:
- cluster.${_param:cluster_name}.stacklight.server
params:
+ redis_cluster_role: 'slave'
salt_master_host: ${_param:reclass_config_master}
linux_system_codename: xenial
single_address: ${_param:stacklight_monitor_node03_address}