redis 集群 配置以及错误

桌面 ——conf 文件夹
*port.conf (*port代表端口号)

配置内容
port 7000
bind (redis ip)
daemonize yes
pidfile 7000.pid
cluster-enabled yes
cluster-config-file 7000_node.conf
cluster-node-timeout 15000
appendonly yes

redis-server *port.conf

redis的安装包中包含了redis-trib.rb,⽤于创建集群
将命令复制,这样可以在任何⽬录下调⽤此命令

sudo cp /usr/share/doc/redis-tools/examples/redis-trib.rb /usr/local/bin/

安装ruby环境,因为redis-trib.rb是⽤ruby开发的

sudo apt-get install ruby

创建集群

redis-trib.rb create --replicas 1 172.16.179.130:7000 172.16.179.130:7001 172.16.179.130:7002 17

版本问题

– 先查看⾃⼰的 gem 源是什么地址
gem source -l – 如果是https://rubygems.org/ 就需要更换
– 更换指令为
gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
– 通过 gem 安装 redis 的相关依赖
sudo gem install redis
– 然后重新执⾏指令

redis-trib.rb create --replicas 1 172.16.179.130:7000 172.16.179.130:7001 172.16.179.130:7002 172.16.179.131:7003 172.16.179.131:7004 172.16.179.131:7005

redis-cli -h 172.16.179.131 -c -p 7002

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值