redis集群宕机后怎么重启

redis集群宕机后怎么重启

redis集群宕机后重启的示例:

centos下的redis无数据启动和持久化重启脚本:

1.redis_clear_restart.sh,代码:

for p in `ps -ef|grep /usr/local/bin/redis-server | awk '{print $2"_"$3}'`

do

a=`echo $p |awk -F _ '{print $1}'`

b=`echo $p |awk -F _ '{print $2}'`

if [ $b == "1" ]; then

echo "kill -9 $a `kill -9 $a` "

fi

done

echo "rm -rf appendonly_*.aof dump_*.rdb nodes-2000*.conf"

rm -rf appendonly_*.aof dump_*.rdb nodes-2000*.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20000.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20001.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20002.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20003.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20004.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20005.conf

/usr/local/bin/redis-cli -a 123456 --cluster create --cluster-replicas 1 127.0.0.1:20000 127.0.0.1:20001 127.0.0.1:20002 127.0.0.1:20003 127.0.0.1:20004 127.0.0.1:20005 <F

yes

EOF

2.redis_dump_restart.sh,代码:

for p in `ps -ef|grep /usr/local/bin/redis-server | awk '{print $2"_"$3}'`

do

a=`echo $p |awk -F _ '{print $1}'`

b=`echo $p |awk -F _ '{print $2}'`

if [ $b == "1" ]; then

echo "kill -9 $a `kill -9 $a` "

fi

done

echo "rm -rf appendonly_*.aof dump_*.rdb nodes-2000*.conf"

rm -rf appendonly_*.aof dump_*.rdb nodes-2000*.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20000.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20001.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20002.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20003.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20004.conf

/usr/local/bin/redis-server /home/sysusr/redis/redis-cluster/redis-20005.conf

/usr/local/bin/redis-cli -a 123456 --cluster check 127.0.0.1:20000

/usr/local/bin/redis-cli -a 123456 --cluster check 127.0.0.1:20001

/usr/local/bin/redis-cli -a 123456 --cluster check 127.0.0.1:20002

/usr/local/bin/redis-cli -a 123456 --cluster check 127.0.0.1:20003

/usr/local/bin/redis-cli -a 123456 --cluster check 127.0.0.1:20004

/usr/local/bin/redis-cli -a 123456 --cluster check 127.0.0.1:20005

我们的服务
专业提供中小企业网站建设.公司网站建设.外贸网站建设.营销型网站建设,响应式网站建设,商城网站定制,手机网站,微信小程序定制.php应用开发服务,公司成立于2014年,8年专注网站建设,秉承“以客户为根本,以科技为核心,以市场为导向”的经营理念;服务电话13714666846(微信同号)

声明:本站所有作品(图文、音视频)均由用户自行上传分享,或互联网相关知识整合,仅供网友学习交流,若您的权利被侵害,请联系 管理员 删除。

本文链接:http://news.ew35.com/