帮助文档
专业提供香港服务器、香港云服务器、香港高防服务器租用、香港云主机、台湾服务器、美国服务器、美国云服务器vps租用、韩国高防服务器租用、新加坡服务器、日本服务器租用 一站式全球网络解决方案提供商!专业运营维护IDC数据中心,提供高质量的服务器托管,服务器机房租用,服务器机柜租用,IDC机房机柜租用等服务,稳定、安全、高性能的云端计算服务,实时满足您的多样性业务需求。 香港大带宽稳定可靠,高级工程师提供基于服务器硬件、操作系统、网络、应用环境、安全的免费技术支持。
服务器资讯 / 香港服务器租用 / 香港VPS租用 / 香港云服务器 / 美国服务器租用 / 台湾服务器租用 / 日本服务器租用 / 官方公告 / 帮助文档
Redis主从集群在原有的三主三从的基础上添加两台redis服务器并为其分配槽位-----Redis
发布时间:2024-02-29 21:57:43   分类:帮助文档
Redis主从集群在原有的三主三从的基础上添加两台redis服务器并为其分配槽位-----Redis 127.0.0.1:6385> quit [root@localhost ~]# vim /redis/cluster/redisCluster6386.conf [root@localhost ~]# vim /redis/cluster/redisCluster6385.conf [root@localhost ~]# cd /redis/cluster bash: cd: /redis/cluster: 没有那个文件或目录 [root@localhost ~]# cd /myredis/cluster [root@localhost cluster]# vim /myredis/cluster/redisCluster6385.conf [root@localhost cluster]# vim /myredis/cluster/redisCluster6387.conf [root@localhost cluster]# vim /myredis/cluster/redisCluster6388.conf [root@localhost cluster]# redis-server /myredis/cluster/redisCluster6387.conf [root@localhost cluster]# redis-server /myredis/cluster/redisCluster6388.conf [root@localhost cluster]# ps -ef|grep redis root 10600 1 0 13:34 ? 00:00:09 redis-server 0.0.0.0:6385 [cluster] root 10612 1 0 13:34 ? 00:00:10 redis-server 0.0.0.0:6386 [cluster] root 11545 1 0 14:30 ? 00:00:00 redis-server 0.0.0.0:6387 [cluster] root 11557 1 0 14:31 ? 00:00:00 redis-server 0.0.0.0:6388 [cluster] root 11569 10202 0 14:31 pts/0 00:00:00 grep --color=auto redis 127.0.0.1:6385> quit [root@localhost ~]# vim /redis/cluster/redisCluster6386.conf [root@localhost ~]# vim /redis/cluster/redisCluster6385.conf [root@localhost ~]# cd /redis/cluster bash: cd: /redis/cluster: 没有那个文件或目录 [root@localhost ~]# cd /myredis/cluster [root@localhost cluster]# vim /myredis/cluster/redisCluster6385.conf [root@localhost cluster]# vim /myredis/cluster/redisCluster6387.conf [root@localhost cluster]# vim /myredis/cluster/redisCluster6388.conf [root@localhost cluster]# redis-server /myredis/cluster/redisCluster6387.conf  [root@localhost cluster]# redis-server /myredis/cluster/redisCluster6388.conf  [root@localhost cluster]# ps -ef|grep redis root      10600      1  0 13:34 ?        00:00:09 redis-server 0.0.0.0:6385 [cluster] root      10612      1  0 13:34 ?        00:00:10 redis-server 0.0.0.0:6386 [cluster] root      11545      1  0 14:30 ?        00:00:00 redis-server 0.0.0.0:6387 [cluster] root      11557      1  0 14:31 ?        00:00:00 redis-server 0.0.0.0:6388 [cluster] root      11569  10202  0 14:31 pts/0    00:00:00 grep --color=auto redis 127.0.0.1:6381> quit [root@localhost cluster]# ifconfig ens33: flags=4163 mtu 1500 inet 192.168.92.129 netmask 255.255.255.0 broadcast 192.168.92.255 inet6 fe80::5d0e:f975:2a1e:b6d2 prefixlen 64 scopeid 0x20 ether 00:0c:29:8f:1b:2b txqueuelen 1000 (Ethernet) RX packets 79823 bytes 57172921 (54.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 78180 bytes 85225847 (81.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 12550 bytes 14532520 (13.8 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 12550 bytes 14532520 (13.8 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 virbr0: flags=4099 mtu 1500 ether 52:54:00:55:d3:7b txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@localhost cluster]# redis-cli -a abc123 -p 6381 -c Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. 127.0.0.1:6381> quit [root@localhost cluster]# ifconfig ens33: flags=4163  mtu 1500         inet 192.168.92.129  netmask 255.255.255.0  broadcast 192.168.92.255         inet6 fe80::5d0e:f975:2a1e:b6d2  prefixlen 64  scopeid 0x20         ether 00:0c:29:8f:1b:2b  txqueuelen 1000  (Ethernet)         RX packets 79823  bytes 57172921 (54.5 MiB)         RX errors 0  dropped 0  overruns 0  frame 0         TX packets 78180  bytes 85225847 (81.2 MiB)         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 lo: flags=73  mtu 65536         inet 127.0.0.1  netmask 255.0.0.0         inet6 ::1  prefixlen 128  scopeid 0x10         loop  txqueuelen 1000  (Local Loopback)         RX packets 12550  bytes 14532520 (13.8 MiB)         RX errors 0  dropped 0  overruns 0  frame 0         TX packets 12550  bytes 14532520 (13.8 MiB)         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 virbr0: flags=4099  mtu 1500         ether 52:54:00:55:d3:7b  txqueuelen 1000  (Ethernet)         RX packets 0  bytes 0 (0.0 B)         RX errors 0  dropped 0  overruns 0  frame 0         TX packets 0  bytes 0 (0.0 B)         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 [root@localhost cluster]# redis-cli -a abc123 -p 6381 -c Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. [root@localhost cluster]# ifconfig ens33: flags=4163 mtu 1500 inet 192.168.92.131 netmask 255.255.255.0 broadcast 192.168.92.255 inet6 fe80::c264:84a9:bc4f:4bf4 prefixlen 64 scopeid 0x20 inet6 fe80::5d0e:f975:2a1e:b6d2 prefixlen 64 scopeid 0x20 inet6 fe80::371e:c0c:3dd4:34b4 prefixlen 64 scopeid 0x20 ether 00:0c:29:73:71:a1 txqueuelen 1000 (Ethernet) RX packets 406198 bytes 85812711 (81.8 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 342194 bytes 173417599 (165.3 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 11680 bytes 17709499 (16.8 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 11680 bytes 17709499 (16.8 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@localhost cluster]# redis-cli -a abc123 192.168.92.131:6387 192.168.92.131:6381 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. Could not connect to Redis at 127.0.0.1:6379: Connection refused [root@localhost cluster]# [root@localhost cluster]# redis-cli -a abc123 192.168.92.131:6387 192.168.92.129:6381 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. Could not connect to Redis at 127.0.0.1:6379: Connection refused [root@localhost cluster]# redis-cli -a abc123 --cluster add-node 192.168.92.131:6387 192.168.92.129:6381 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. >>> Adding node 192.168.92.131:6387 to cluster 192.168.92.129:6381 >>> Performing Cluster Check (using node 192.168.92.129:6381) M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381 slots:[0-5460] (5461 slots) master 1 additional replica(s) S: 69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384 slots: (0 slots) slave replicates ee718fe879729ec1f961b08c4342c78537997ab4 S: a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386 slots: (0 slots) slave replicates 1fca4878cd2a2a4fe055003f53d53c84cb589859 S: 2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382 slots: (0 slots) slave replicates 30b1f7bfccd93049117e1dab1cd6385eaf800015 M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383 slots:[5461-10922] (5462 slots) master 1 additional replica(s) M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385 slots:[10923-16383] (5461 slots) master 1 additional replica(s) [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. >>> Getting functions from cluster >>> Send FUNCTION LIST to 192.168.92.131:6387 to verify there is no functions in it >>> Send FUNCTION RESTORE to 192.168.92.131:6387 >>> Send CLUSTER MEET to node 192.168.92.131:6387 to make it join the cluster. [OK] New node added correctly. [root@localhost cluster]# ifconfig ens33: flags=4163  mtu 1500         inet 192.168.92.131  netmask 255.255.255.0  broadcast 192.168.92.255         inet6 fe80::c264:84a9:bc4f:4bf4  prefixlen 64  scopeid 0x20         inet6 fe80::5d0e:f975:2a1e:b6d2  prefixlen 64  scopeid 0x20         inet6 fe80::371e:c0c:3dd4:34b4  prefixlen 64  scopeid 0x20         ether 00:0c:29:73:71:a1  txqueuelen 1000  (Ethernet)         RX packets 406198  bytes 85812711 (81.8 MiB)         RX errors 0  dropped 0  overruns 0  frame 0         TX packets 342194  bytes 173417599 (165.3 MiB)         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 lo: flags=73  mtu 65536         inet 127.0.0.1  netmask 255.0.0.0         inet6 ::1  prefixlen 128  scopeid 0x10         loop  txqueuelen 1000  (Local Loopback)         RX packets 11680  bytes 17709499 (16.8 MiB)         RX errors 0  dropped 0  overruns 0  frame 0         TX packets 11680  bytes 17709499 (16.8 MiB)         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 [root@localhost cluster]# redis-cli -a abc123 192.168.92.131:6387 192.168.92.131:6381 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. Could not connect to Redis at 127.0.0.1:6379: Connection refused [root@localhost cluster]#  [root@localhost cluster]# redis-cli -a abc123 192.168.92.131:6387 192.168.92.129:6381 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. Could not connect to Redis at 127.0.0.1:6379: Connection refused [root@localhost cluster]# redis-cli -a abc123 --cluster add-node 192.168.92.131:6387 192.168.92.129:6381 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. >>> Adding node 192.168.92.131:6387 to cluster 192.168.92.129:6381 >>> Performing Cluster Check (using node 192.168.92.129:6381) M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381    slots:[0-5460] (5461 slots) master    1 additional replica(s) S: 69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384    slots: (0 slots) slave    replicates ee718fe879729ec1f961b08c4342c78537997ab4 S: a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386    slots: (0 slots) slave    replicates 1fca4878cd2a2a4fe055003f53d53c84cb589859 S: 2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382    slots: (0 slots) slave    replicates 30b1f7bfccd93049117e1dab1cd6385eaf800015 M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383    slots:[5461-10922] (5462 slots) master    1 additional replica(s) M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385    slots:[10923-16383] (5461 slots) master    1 additional replica(s) [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. >>> Getting functions from cluster >>> Send FUNCTION LIST to 192.168.92.131:6387 to verify there is no functions in it >>> Send FUNCTION RESTORE to 192.168.92.131:6387 >>> Send CLUSTER MEET to node 192.168.92.131:6387 to make it join the cluster. [OK] New node added correctly. [root@localhost cluster]# redis-cli -a abc123 --cluster check 192.168.92.129:6381 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. 192.168.92.129:6381 (ee718fe8...) -> 2 keys | 5461 slots | 1 slaves. 192.168.92.130:6383 (1fca4878...) -> 1 keys | 5462 slots | 1 slaves. 192.168.92.131:6385 (30b1f7bf...) -> 1 keys | 5461 slots | 1 slaves. 192.168.92.131:6387 (7b59ac3c...) -> 0 keys | 0 slots | 0 slaves. [OK] 4 keys in 4 masters. 0.00 keys per slot on average. >>> Performing Cluster Check (using node 192.168.92.129:6381) M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381 slots:[0-5460] (5461 slots) master 1 additional replica(s) S: 69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384 slots: (0 slots) slave replicates ee718fe879729ec1f961b08c4342c78537997ab4 S: a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386 slots: (0 slots) slave replicates 1fca4878cd2a2a4fe055003f53d53c84cb589859 S: 2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382 slots: (0 slots) slave replicates 30b1f7bfccd93049117e1dab1cd6385eaf800015 M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383 slots:[5461-10922] (5462 slots) master 1 additional replica(s) M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385 slots:[10923-16383] (5461 slots) master 1 additional replica(s) M: 7b59ac3cc2e8cc0954b23fb12b54a3e9050e2619 192.168.92.131:6387 slots: (0 slots) master [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. [root@localhost cluster]# redis-cli -a abc123 --cluster reshard 192.168.92.129:6381 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. >>> Performing Cluster Check (using node 192.168.92.129:6381) M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381 slots:[0-5460] (5461 slots) master 1 additional replica(s) S: 69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384 slots: (0 slots) slave replicates ee718fe879729ec1f961b08c4342c78537997ab4 S: a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386 slots: (0 slots) slave replicates 1fca4878cd2a2a4fe055003f53d53c84cb589859 S: 2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382 slots: (0 slots) slave replicates 30b1f7bfccd93049117e1dab1cd6385eaf800015 M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383 slots:[5461-10922] (5462 slots) master 1 additional replica(s) M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385 slots:[10923-16383] (5461 slots) master 1 additional replica(s) M: 7b59ac3cc2e8cc0954b23fb12b54a3e9050e2619 192.168.92.131:6387 slots: (0 slots) master [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. How many slots do you want to move (from 1 to 16384)? 4096 What is the receiving node ID? 7b59ac3cc2e8cc0954b23fb12b54a3e9050e2619 Please enter all the source node IDs. Type 'all' to use all the nodes as source nodes for the hash slots. Type 'done' once you entered all the source nodes IDs. Source node #1: all Ready to move 4096 slots. Source nodes: M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381 slots:[0-5460] (5461 slots) master 1 additional replica(s) M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383 slots:[5461-10922] (5462 slots) master 1 additional replica(s) M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385 slots:[10923-16383] (5461 slots) master 1 additional replica(s) Destination node: M: 7b59ac3cc2e8cc0954b23fb12b54a3e9050e2619 192.168.92.131:6387 slots: (0 slots) master Resharding plan: [root@localhost cluster]# redis-cli -a abc123 --cluster check 192.168.92.129:6381 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. 192.168.92.129:6381 (ee718fe8...) -> 2 keys | 5461 slots | 1 slaves. 192.168.92.130:6383 (1fca4878...) -> 1 keys | 5462 slots | 1 slaves. 192.168.92.131:6385 (30b1f7bf...) -> 1 keys | 5461 slots | 1 slaves. 192.168.92.131:6387 (7b59ac3c...) -> 0 keys | 0 slots | 0 slaves. [OK] 4 keys in 4 masters. 0.00 keys per slot on average. >>> Performing Cluster Check (using node 192.168.92.129:6381) M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381    slots:[0-5460] (5461 slots) master    1 additional replica(s) S: 69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384    slots: (0 slots) slave    replicates ee718fe879729ec1f961b08c4342c78537997ab4 S: a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386    slots: (0 slots) slave    replicates 1fca4878cd2a2a4fe055003f53d53c84cb589859 S: 2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382    slots: (0 slots) slave    replicates 30b1f7bfccd93049117e1dab1cd6385eaf800015 M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383    slots:[5461-10922] (5462 slots) master    1 additional replica(s) M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385    slots:[10923-16383] (5461 slots) master    1 additional replica(s) M: 7b59ac3cc2e8cc0954b23fb12b54a3e9050e2619 192.168.92.131:6387    slots: (0 slots) master [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. [root@localhost cluster]# redis-cli -a abc123 --cluster reshard 192.168.92.129:6381 Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe. >>> Performing Cluster Check (using node 192.168.92.129:6381) M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381    slots:[0-5460] (5461 slots) master    1 additional replica(s) S: 69d920127eec13adc0d9fcaf0e9448a80d1a4803 192.168.92.130:6384    slots: (0 slots) slave    replicates ee718fe879729ec1f961b08c4342c78537997ab4 S: a5757758fd0bdd8106e10905bbd1674c574f10c1 192.168.92.131:6386    slots: (0 slots) slave    replicates 1fca4878cd2a2a4fe055003f53d53c84cb589859 S: 2eabe702c6bba38aee780477fab74bc4969d9bf3 192.168.92.129:6382    slots: (0 slots) slave    replicates 30b1f7bfccd93049117e1dab1cd6385eaf800015 M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383    slots:[5461-10922] (5462 slots) master    1 additional replica(s) M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385    slots:[10923-16383] (5461 slots) master    1 additional replica(s) M: 7b59ac3cc2e8cc0954b23fb12b54a3e9050e2619 192.168.92.131:6387    slots: (0 slots) master [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered. How many slots do you want to move (from 1 to 16384)? 4096  What is the receiving node ID? 7b59ac3cc2e8cc0954b23fb12b54a3e9050e2619 Please enter all the source node IDs.   Type 'all' to use all the nodes as source nodes for the hash slots.   Type 'done' once you entered all the source nodes IDs. Source node #1: all Ready to move 4096 slots.   Source nodes:     M: ee718fe879729ec1f961b08c4342c78537997ab4 192.168.92.129:6381        slots:[0-5460] (5461 slots) master        1 additional replica(s)     M: 1fca4878cd2a2a4fe055003f53d53c84cb589859 192.168.92.130:6383        slots:[5461-10922] (5462 slots) master        1 additional replica(s)     M: 30b1f7bfccd93049117e1dab1cd6385eaf800015 192.168.92.131:6385        slots:[10923-16383] (5461 slots) master        1 additional replica(s)   Destination node:     M: 7b59ac3cc2e8cc0954b23fb12b54a3e9050e2619 192.168.92.131:6387        slots: (0 slots) master   Resharding plan:
香港云服务器租用推荐
服务器租用资讯
·广东云服务有限公司怎么样
·广东云服务器怎么样
·广东锐讯网络有限公司怎么样
·广东佛山的蜗牛怎么那么大
·广东单位电话主机号怎么填写
·管家婆 花生壳怎么用
·官网域名过期要怎么办
·官网邮箱一般怎么命名
·官网网站被篡改怎么办
服务器租用推荐
·美国服务器租用
·台湾服务器租用
·香港云服务器租用
·香港裸金属服务器
·香港高防服务器租用
·香港服务器租用特价