Merge branch 'master' into dist/eole/2.6.2/master
This commit is contained in:
commit
8869d18e17
@ -43,8 +43,10 @@
|
||||
<value>Leader</value>
|
||||
</variable>
|
||||
<variable name='redisMasterIP' type='ip' description="Adresse IP du Leader Redis"/>
|
||||
<variable name='redisMasterIP' type='ip' description="Adresse IP du Leader Redis"/>
|
||||
<variable name='redisMasterPort' type='number' description="Port d'écoute du Leader Redis"/>
|
||||
<variable name='redisMasterPassword' type='string' description="Passphrase d'accès à la grappe Redis"/>
|
||||
<variable name='rdClMember' type='ip' description="Nom du noeud" multi='True'/>
|
||||
<variable name='rdClMemberIP' type='ip' description="Adresse IP du noeud" multi='True'/>
|
||||
<variable name='rdClMemberPort' type='number' description="Port d'écoute du noeud" multi='True'/>
|
||||
<variable name='rdClMemberRole' type='ip' description="Rôle du membre"/>
|
||||
@ -94,7 +96,8 @@
|
||||
<slave>rdClmask</slave>
|
||||
</group>
|
||||
|
||||
<group master='rdClMemberIP'>
|
||||
<group master='rdClMember'>
|
||||
<slave>rdClMemberIP</slave>
|
||||
<slave>rdClMemberPort</slave>
|
||||
<slave>rdClMemberRole</slave>
|
||||
<slave>rdClMemberMaster</slave>
|
||||
|
29
postservice/91-redis-init
Executable file
29
postservice/91-redis-init
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Cluster init !
|
||||
#
|
||||
|
||||
redisTrib="/usr/share/doc/redis-tools/examples/redis-trib.rb"
|
||||
CONF="/etc/redis/cluster.conf"
|
||||
|
||||
if [[ -f ${1} ]]
|
||||
then
|
||||
CONF=${1}
|
||||
fi
|
||||
|
||||
if [[ -f "${CONF}" ]]
|
||||
then
|
||||
LEADER=$(awk -F ':' '/^leader/ {print $2 ":" $3}' ${CONF})
|
||||
|
||||
REPLICA=$(${redisTrib} check ${LEADER} | awk '/additional replica/ {print $1}')
|
||||
|
||||
if [[ ${REPLICA} -eq 0 ]]
|
||||
then
|
||||
# Create Cluster
|
||||
yes yes | ${redisTrib} create --replicas 1 $(awk -F ':' '{printf "%s:%s ", $2, $3}' ${CONF})
|
||||
fi
|
||||
else
|
||||
echo "${CONF} is missing"
|
||||
exit 0
|
||||
fi
|
@ -1,6 +1,6 @@
|
||||
%if %%getVar('activer_redis','non') == 'oui' and %%getVar('redisRole','Node') == 'Leader'
|
||||
127.0.0.1:%%{redisPort}:master::
|
||||
%for %%node in %%getVar('rdClMemberIP',[])
|
||||
%%{node}:%%{node.rdClMemberPort}:%%{node.rdClMemberRole}:%%{node.rdClMemberMaster}
|
||||
Leader:127.0.0.1:%%{redisPort}:master::
|
||||
%for %%node in %%getVar('rdClMember',[])
|
||||
%%{node}:%%{node.rdClMemberIP}:%%{node.rdClMemberPort}:%%{node.rdClMemberRole}:%%{node.rdClMemberMaster}:
|
||||
%end for
|
||||
%end if
|
||||
|
Loading…
Reference in New Issue
Block a user