chore(CI): cts support redis sentinel

This commit is contained in:
zhanghongtong 2021-04-09 07:30:37 +00:00 committed by Rory Z
parent 327b0c0995
commit 355b42c623
8 changed files with 28 additions and 11 deletions

View File

@ -1,7 +1,7 @@
version: '3.9'
services:
redis_cluster:
redis_server:
image: redis:${REDIS_TAG}
container_name: redis
volumes:

View File

@ -1,7 +1,7 @@
version: '3.9'
services:
redis_cluster:
redis_server:
container_name: redis
image: redis:${REDIS_TAG}
volumes:

View File

@ -1,7 +1,7 @@
version: '3.9'
services:
redis_cluster:
redis_server:
container_name: redis
image: redis:${REDIS_TAG}
volumes:

View File

@ -5,3 +5,4 @@ tls-cert-file /tls/redis.crt
tls-key-file /tls/redis.key
tls-ca-cert-file /tls/ca.crt
requirepass public
masterauth public

View File

@ -2,3 +2,4 @@ daemonize yes
bind 0.0.0.0 ::
logfile /var/log/redis-server.log
requirepass public
masterauth public

View File

@ -61,19 +61,19 @@ REDIS_LOAD_FLG=true;
while $REDIS_LOAD_FLG;
do
sleep 1;
redis-cli -p 7000 info 1> /data/conf/r7000i.log 2> /dev/null;
redis-cli --pass public --no-auth-warning -p 7000 info 1> /data/conf/r7000i.log 2> /dev/null;
if [ -s /data/conf/r7000i.log ]; then
:
else
continue;
fi
redis-cli -p 7001 info 1> /data/conf/r7001i.log 2> /dev/null;
redis-cli --pass public --no-auth-warning -p 7001 info 1> /data/conf/r7001i.log 2> /dev/null;
if [ -s /data/conf/r7001i.log ]; then
:
else
continue;
fi
redis-cli -p 7002 info 1> /data/conf/r7002i.log 2> /dev/null;
redis-cli --pass public --no-auth-warning -p 7002 info 1> /data/conf/r7002i.log 2> /dev/null;
if [ -s /data/conf/r7002i.log ]; then
:
else
@ -82,7 +82,14 @@ do
if [ "${node}" = "cluster" ] ; then
yes "yes" | redis-cli --cluster create "$LOCAL_IP:7000" "$LOCAL_IP:7001" "$LOCAL_IP:7002" --pass public --no-auth-warning;
elif [ "${node}" = "sentinel" ] ; then
cp /data/conf/sentinel.conf /_sentinel.conf
tee /_sentinel.conf>/dev/null << EOF
port 26379
bind 0.0.0.0 ::
daemonize yes
logfile /var/log/redis-server.log
dir /tmp
sentinel monitor mymaster $LOCAL_IP 7000 1
EOF
redis-server /_sentinel.conf --sentinel;
fi
REDIS_LOAD_FLG=false;

View File

@ -1,4 +0,0 @@
port 26379
dir /tmp
sentinel monitor mymaster 172.16.239.10 7000 1
logfile /var/log/redis-server.log

View File

@ -301,10 +301,13 @@ jobs:
- tcp
node_type:
- single
- sentinel
- cluster
exclude:
- redis_tag: 5
connect_type: tls
- node_type: sentinel
connect_type: tls
steps:
- uses: actions/checkout@v1
@ -355,6 +358,15 @@ jobs:
EMQX_AUTH__REDIS__TYPE=single
EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6380
EOF
- name: setup
if: matrix.node_type == 'sentinel'
run: |
cat <<-EOF >> "$GITHUB_ENV"
EMQX_AUTH__REDIS__TYPE=sentinel
EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:26379
EMQX_AUTH__REDIS__SENTINEL=mymaster
EMQX_AUTH__REDIS__POOL=1
EOF
- name: setup
if: matrix.node_type == 'cluster' && matrix.connect_type == 'tcp'
run: |