在单例模式下继续执行,新增文件夹


将之前解压后的文件复制到新增的文件夹中

修改配置文件,并放入bin中
·bind 10.88.99.251(ip设置)
·protected-mode yes(默认yes,开启保护模式,限制为本地访问)
·port 7005(监听端口)
·daemonize yes(默认no,改为yes意为以守护进程方式启动,可后台运行,除非kill进程,改为yes会使配置文件方式启动redis失败)
·cluster-enabled yes (集群模式开启)
·cluster-config-file nodes-7005.conf
·cluster-node-timeout 15000
·appendonly no (如果 AOF 开启, 那么在启动时 Redis 将加载 AOF 文件, 它更能保证数据的可靠性。)
开启redis
·cd /u01/softs/redis/redis-6.2.6/cluster/7005/bin/
·chmod 777 ./redis-server /u01/softs/redis/redis-6.2.6/cluster/7005/etc/redis.conf(授权)
·./redis-server /u01/softs/redis/redis-6.2.6/cluster/7005/etc/redis.conf(可能会提示没有权限)
· ps -ef | grep redis
·redis-cli -h 10.88.99.251:7005(验证是否开启成功)


版本5.0 以上后redis-cli
·按以上步骤开启所有
·进入Redis安装目录下的src文件夹
· cd /u01/softs/redis/redis-6.2.6/src
·redis-cli --cluster create 10.88.99.251:7000 10.88.99.251:7001 10.88.99.251:7002 10.88.99.251:7003 10.88.99.251:7004 10.88.99.251:7005 --cluster-replicas 1;



报错解决

·删除集群下:aof、rdb、nodes.conf