①:我们先将 redis6380.conf 复制为 redis6380.conf.bak 备份起来,同时 redis6381.conf,redis6382.conf 也这样做
-rw-r--r-- 1 root root 169 Nov 13 14:27 redis6380.conf
-rw-r--r-- 1 root root 169 Nov 13 13:52 redis6380.conf.bak
-rw-r--r-- 1 root root 168 Nov 13 14:27 redis6381.conf
-rw-r--r-- 1 root root 168 Nov 13 13:53 redis6381.conf.bak
-rw-r--r-- 1 root root 168 Nov 13 14:27 redis6382.conf
-rw-r--r-- 1 root root 168 Nov 13 14:02 redis6382.conf.bak
-rw-r--r-- 1 root root 107512 Nov 7 20:44 redis.conf
②:我们将 sentinel26380.conf 复制为 sentinel26380.conf.bak 备份起来,同时 sentinel26381.conf,sentinel26382.conf 也这样做
-rw-r--r-- 1 root root 767 Nov 13 14:27 sentinel26380.conf
-rw-r--r-- 1 root root 175 Nov 13 14:19 sentinel26380.conf.bak
-rw-r--r-- 1 root root 766 Nov 13 14:27 sentinel26381.conf
-rw-r--r-- 1 root root 171 Nov 13 14:19 sentinel26381.conf.bak
-rw-r--r-- 1 root root 767 Nov 13 14:27 sentinel26382.conf
-rw-r--r-- 1 root root 173 Nov 13 14:19 sentinel26382.conf.bak
-rw-r--r-- 1 root root 14717 Nov 13 14:14 sentinel.conf
③:然后创建脚本文件 vim start-redis-sentinel.sh
写入
#!/bin/bash
/bin/cp -f redis6380.conf.bak redis6380.conf
/bin/cp -f redis6381.conf.bak redis6381.conf
/bin/cp -f redis6382.conf.bak redis6382.conf
redis-server redis6380.conf
redis-server redis6381.conf
redis-server redis6382.conf
redis-cli -p 6381 -a hx801219 slaveof 127.0.0.1 6380
redis-cli -p 6382 -a hx801219 slaveof 127.0.0.1 6380
/bin/cp -f sentinel26380.conf.bak sentinel26380.conf
/bin/cp -f sentinel26381.conf.bak sentinel26381.conf
/bin/cp -f sentinel26382.conf.bak sentinel26382.conf
redis-sentinel sentinel26380.conf
redis-sentinel sentinel26381.conf
redis-sentinel sentinel26382.conf
④:然后创建脚本文件 vim shutdown-redis-sentinel.sh
写入
#!/bin/sh
redis-cli -a hx801219 -p 26380 shutdown
redis-cli -a hx801219 -p 26381 shutdown
redis-cli -a hx801219 -p 26382 shutdown
redis-cli -a hx801219 -p 6380 shutdown
redis-cli -a hx801219 -p 6381 shutdown
redis-cli -a hx801219 -p 6382 shutdown
ps -ef|grep redis