依次登陆6个节点
cd /mysystest
./redis/bin/redis-cli -c -h 192.168.43.86 -p 7301
执行以下命令
config set masterauth 123456
config set requirepass 123456
auth 123456
config rewrite
执行成功后,在配置文件最后,会有新增的2行
*此时再登陆时(未授权)会报错误
修改redis连接,加入授权,成功执行
bin/redis-cli -c -h 192.168.43.86 -p 7301 -a '123456'
注:脚本执行
redisset.txt 文件内容
config set masterauth 123456
config set requirepass 123456
auth 123456
config rewrite
setauth.sh 文件内容
#/bin/bash
cd /mysystest/redis
cat redisset.txt | bin/redis-cli -c -h 192.168.43.86 -p 7301
cat redisset.txt | bin/redis-cli -c -h 192.168.43.86 -p 7302
cat redisset.txt | bin/redis-cli -c -h 192.168.43.86 -p 7303
cat redisset.txt | bin/redis-cli -c -h 192.168.43.86 -p 7304
cat redisset.txt | bin/redis-cli -c -h 192.168.43.86 -p 7305
cat redisset.txt | bin/redis-cli -c -h 192.168.43.86 -p 7306