Board logo

标题: Redis 3.0.5 集群的命令、使用、维护(3) [打印本页]

作者: look_w    时间: 2018-12-16 15:42     标题: Redis 3.0.5 集群的命令、使用、维护(3)

cluster forget从集群中移除一个节点。这个功能:
redis-trib del-node 192.168.33.13:7009 `<node-id>`
类似。同样,删除从节点,可以直接删除。删除主节点,要是有slot的话需要先迁移。
我们就来删除上一步加的这个192.168.33.13 7009,他是一个master 节点,但是里面还没分配slot,所以,我们删除试一下:
使用方法为:
cluster forget <node_id>
开始:
127.0.0.1:7000> cluster forget 70795a3a7b93b7d059124e171cd46ba1683d6b7dOK

提示OK了,说明已经成功了。
再看下node 列表:
[url=][/url]
127.0.0.1:7000> cluster nodesa035546046a607487436cf354c187b1712edf39b 192.168.33.13:7006 slave 6f5cd78ee644c1df9756fc11b3595403f51216cc 0 1448519211988 7 connectedf325d80e770ce319e4490818a49bad033cce942c 192.168.33.13:7008 slave 3d2b7dccfc45ae2eb7aeb9e0bf001b0ac8f7b3da 0 1448519212994 9 connectede357bea5151b32a971c1f7a5788271106195f99a 192.168.33.13:7005 slave 404cf1ecf54d4df46d5faaec4103cfdf67888ad2 0 1448519213499 6 connected8916fb224bbae3dc0291ca47e066dca0a62fba19 192.168.33.13:7004 slave 3d2b7dccfc45ae2eb7aeb9e0bf001b0ac8f7b3da 0 1448519212994 5 connected35bdcb51ceeff00f9cc608fa1b4364943c7c07ce 192.168.33.13:7003 master - 0 1448519211485 4 connected 12288-163833d2b7dccfc45ae2eb7aeb9e0bf001b0ac8f7b3da 192.168.33.13:7000 myself,master - 0 0 1 connected 0-40956650a95b874cacf399f174cb7a1b3802fc9bcef9 192.168.33.13:7007 slave 35bdcb51ceeff00f9cc608fa1b4364943c7c07ce 0 1448519212493 8 connected6f5cd78ee644c1df9756fc11b3595403f51216cc 192.168.33.13:7002 master - 0 1448519213499 3 connected 8192-12287404cf1ecf54d4df46d5faaec4103cfdf67888ad2 192.168.33.13:7001 master - 0 1448519213499 2 connected 4096-8191[url=][/url]


嗯。节点被移除了。
但是,其实是没有真正移除!不知道为啥。
[url=][/url]
[vagrant@web3 7009]$ redis-trib.rb check 192.168.33.13:7009Connecting to node 192.168.33.13:7009: OKConnecting to node 192.168.33.13:7004: OKConnecting to node 192.168.33.13:7007: OKConnecting to node 192.168.33.13:7000: OKConnecting to node 192.168.33.13:7008: OKConnecting to node 192.168.33.13:7006: OKConnecting to node 192.168.33.13:7003: OKConnecting to node 192.168.33.13:7005: OKConnecting to node 192.168.33.13:7001: OKConnecting to node 192.168.33.13:7002: OK[url=][/url]

进程也还在。
[vagrant@web3 7009]$ ps -ef|grep redisroot 3017 1 0 Nov23 ? 00:04:24 redis-server *:7009 [cluster]

而且也还能连上:
[vagrant@web3 7009]$ redis-cli -p 7009 -c127.0.0.1:7009> cluster nodes70795a3a7b93b7d059124e171cd46ba1683d6b7d 192.168.33.13:7009 myself,master - 0 0 0 connected

日了狗了!!!!为啥啊。不管啦。继续。




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0