Redis集群启动脚本

Posted 希望在田野上

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Redis集群启动脚本相关的知识,希望对你有一定的参考价值。

redis版本:redis-5.0.0
Centos: centos 7 64位

#!/bin/bash
redis_path="/usr/local/cluster/"
cluster_num=`ps aux | grep redis |  wc -l`
if [ "${cluster_num}" -le 0 ]
then
        echo -e "===== Success: Has killed all cluster progress."
else
		pkill -9 redis
fi

cd ${redis_path}
rm -rf ${redis_path}700*/appendonly.aof
rm -rf ${redis_path}700*/dump.rdb
rm -rf ${redis_path}700*/nodes*
rm -rf ${redis_path}nodes*
rm -rf ${redis_path}appendonly.aof
cd /usr/local/cluster/7000/
redis-server /usr/local/cluster/7000/redis.conf
cd /usr/local/cluster/7001/
redis-server /usr/local/cluster/7001/redis.conf
cd /usr/local/cluster/7002/
redis-server /usr/local/cluster/7002/redis.conf
cd /usr/local/cluster/7003/
redis-server /usr/local/cluster/7003/redis.conf
cd /usr/local/cluster/7004/
redis-server /usr/local/cluster/7004/redis.conf
cd /usr/local/cluster/7005/
redis-server /usr/local/cluster/7005/redis.conf

如果在window下编写,建议使用Notepad++保存为UNIX格式

以上是关于Redis集群启动脚本的主要内容,如果未能解决你的问题,请参考以下文章

redis 集群讲解 (二 )动态扩容

大数据集群一键启动脚本

如何利用redis来进行分布式集群系统的限流设计

redis集群搭建及一些问题

Redis集群节点管理

设置redis服务开机自启动