脚本创建redis

脚本创建redis

for port in KaTeX parse error: Undefined control sequence: \ at position 13: (seq 1 6); \̲ ̲do \ mkdir -p /…{port}/conf
cat << EOF > /mydata/redis/node- p o r t / c o n f / r e d i s . c o n f p o r t 6379 b i n d 0.0.0.0 c l u s t e r − e n a b l e d y e s c l u s t e r − c o n f i g − f i l e n o d e s . c o n f c l u s t e r − n o d e − t i m e o u t 5000 c l u s t e r − a n n o u n c e − i p 172.18.0.1 {port}/conf/redis.conf port 6379 bind 0.0.0.0 cluster-enabled yes cluster-config-file nodes.conf cluster-node-timeout 5000 cluster-announce-ip 172.18.0.1 port/conf/redis.confport6379bind0.0.0.0clusterenabledyesclusterconfigfilenodes.confclusternodetimeout5000clusterannounceip172.18.0.1{port}
cluster-announce-port 6379
cluster-announce-bus-port 16379
appendonly yes
EOF

docker run -p 637 p o r t : 6379 − p 1637 {port}:6379 -p 1637 port:6379p1637{port}:16379 --name redis- p o r t − v / m y d a t a / r e d i s / n o d e − {port} -v /mydata/redis/node- portv/mydata/redis/node{port}/conf/redis.conf:/etc/redis/redis.conf -d --net redis --ip 172.18.0.1${port} redis:5.0.9-alpine3.11 redis-server /etc/redis/redis.conf
done

创建redis 集群

任意进入一个容器

docker exec -it redis-1 sh

连接集群

redis-cli --cluster create 172.18.0.11:6379 172.18.0.12:6379 172.18.0.13:6379 172.18.0.14:6379 172.18.0.15:6379 172.18.0.16:6379 --cluster-replicas 1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值