feat: create redisha module

- manage redis/sentinel clusters
- ensure ulimit_managed is false
- dynamically find servers in role to identify master
- add redisadm and sentineladm commands
- add script to check if the current host in the master
This commit is contained in:
2024-08-09 23:22:37 +10:00
parent aadd0275ac
commit b7fc6a1993
8 changed files with 202 additions and 0 deletions
@@ -0,0 +1,2 @@
#!/usr/bin/bash
sudo /usr/local/sbin/sentineladm info | grep -q <%= @facts['networking']['fqdn'] %>
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/bash
REDIS_HOST=<%= @redis_host %>
REDIS_PORT=<%= @redis_port %>
if [ $# -gt 0 ]; then
REDISCLI_AUTH=<%= @requirepass %> redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" "$@"
else
REDISCLI_AUTH=<%= @requirepass %> redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT"
fi
@@ -0,0 +1,9 @@
#!/usr/bin/bash
REDIS_HOST=<%= @redis_host %>
SENTINEL_PORT=<%= @sentinel_port %>
if [ $# -gt 0 ]; then
REDISCLI_AUTH=<%= @requirepass %> redis-cli -h "$REDIS_HOST" -p "$SENTINEL_PORT" "$@"
else
REDISCLI_AUTH=<%= @requirepass %> redis-cli -h "$REDIS_HOST" -p "$SENTINEL_PORT"
fi