容器化多物理节点Redis集群的问题

时间:2020-05-31 20:05:56

标签: docker redis-cluster

裸机操作系统:OEL7 码头工人:19.0.3 容器:redis:6.0.4

我正在创建一个使用16个物理节点的群集,每个节点1个实例。我相信集群创建正确:

我的redis.conf

port 6379
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
# docker logs mycluster
1:C 31 May 2020 19:53:40.552 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 31 May 2020 19:53:40.552 # Redis version=6.0.4, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 31 May 2020 19:53:40.552 # Configuration loaded
1:M 31 May 2020 19:53:40.554 * No cluster configuration found, I'm 031a3ede308775ce57fbe20e5094bc20994c2b11
1:M 31 May 2020 19:53:40.576 * Running mode=cluster, port=6379.
1:M 31 May 2020 19:53:40.576 # Server initialized
1:M 31 May 2020 19:53:40.577 * Ready to accept connections
# netstat -an | grep 6379
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:16379           0.0.0.0:*               LISTEN
tcp6       0      0 :::6379                 :::*                    LISTEN
tcp6       0      0 :::16379                :::*                    LISTEN

我可以从每个节点上击中每个节点上的端口6379/16379。

我创建集群:

docker exec -it mycluster redis-cli --cluster create xx99p01if-hpdm05200101.example.com:6379 xx99p01if-hpdm05200501.example.com:6379 xx99p01if-hpdm05200901.example.com:6379 xx99p01if-hpdm05203701.example.com:6379 xx99p01if-hpdm06190101.example.com:6379 xx99p01if-hpdm06190501.example.com:6379 xx99p01if-hpdm06190901.example.com:6379 xx99p01if-hpdm06191501.example.com:6379 xx99p01if-hpdm06191901.example.com:6379 xx99p01if-hpdm06193701.example.com:6379 xx99p01if-hpdm06200101.example.com:6379 xx99p01if-hpdm06200501.example.com:6379 xx99p01if-hpdm06203101.example.com:6379 xx99p01if-hpdm11160101.example.com:6379 xx99p01if-hpdm11160501.example.com:6379 xx99p01if-hpdm11160901.example.com:6379 --cluster-replicas 1
Master[0] -> Slots 0 - 2047
Master[1] -> Slots 2048 - 4095
Master[2] -> Slots 4096 - 6143
Master[3] -> Slots 6144 - 8191
Master[4] -> Slots 8192 - 10239
Master[5] -> Slots 10240 - 12287
Master[6] -> Slots 12288 - 14335
Master[7] -> Slots 14336 - 16383
Adding replica xx99p01if-hpdm06193701.example.com:6379 to xx99p01if-hpdm05200101.example.com:6379
Adding replica xx99p01if-hpdm06200101.example.com:6379 to xx99p01if-hpdm05200501.example.com:6379
Adding replica xx99p01if-hpdm06200501.example.com:6379 to xx99p01if-hpdm05200901.example.com:6379
Adding replica xx99p01if-hpdm06203101.example.com:6379 to xx99p01if-hpdm05203701.example.com:6379
Adding replica xx99p01if-hpdm11160101.example.com:6379 to xx99p01if-hpdm06190101.example.com:6379
Adding replica xx99p01if-hpdm11160501.example.com:6379 to xx99p01if-hpdm06190501.example.com:6379
Adding replica xx99p01if-hpdm11160901.example.com:6379 to xx99p01if-hpdm06190901.example.com:6379
Adding replica xx99p01if-hpdm06191901.example.com:6379 to xx99p01if-hpdm06191501.example.com:6379
M: 031a3ede308775ce57fbe20e5094bc20994c2b11 xx99p01if-hpdm05200101.example.com:6379
   slots:[0-2047] (2048 slots) master
M: 910e0891533ef602ba44636819d97ee0a4d06742 xx99p01if-hpdm05200501.example.com:6379
   slots:[2048-4095] (2048 slots) master
M: 09d23bb495a7ad96c5aafbd02acb393b18b75618 xx99p01if-hpdm05200901.example.com:6379
   slots:[4096-6143] (2048 slots) master
M: 20f87d457d68e29b75cf28f6ea9d25e311bb0b7f xx99p01if-hpdm05203701.example.com:6379
   slots:[6144-8191] (2048 slots) master
M: b5bc58c207bd3d3695600e469a8bf117995d0d0c xx99p01if-hpdm06190101.example.com:6379
   slots:[8192-10239] (2048 slots) master
M: 0aa3b1fdd30128369e04cafb9ff79a6d806acda4 xx99p01if-hpdm06190501.example.com:6379
   slots:[10240-12287] (2048 slots) master
M: fcb4c2dcd416b80f59ec387b5464bce528891695 xx99p01if-hpdm06190901.example.com:6379
   slots:[12288-14335] (2048 slots) master
M: dca4140c139c08ead3ef75e5b76bb454e220e49d xx99p01if-hpdm06191501.example.com:6379
   slots:[14336-16383] (2048 slots) master
S: fcc754f04a34c41feed895129cef1d059a552bf8 xx99p01if-hpdm06191901.example.com:6379
   replicates dca4140c139c08ead3ef75e5b76bb454e220e49d
S: ca30088e53999e5b791aab563eeb9256b8bc6d2e xx99p01if-hpdm06193701.example.com:6379
   replicates 031a3ede308775ce57fbe20e5094bc20994c2b11
S: ce9cb69acb4f2621937245e5b925518dba3082e8 xx99p01if-hpdm06200101.example.com:6379
   replicates 910e0891533ef602ba44636819d97ee0a4d06742
S: 03a490299b8dde408fb5ddf16e62b0a5394cf3f7 xx99p01if-hpdm06200501.example.com:6379
   replicates 09d23bb495a7ad96c5aafbd02acb393b18b75618
S: 3af165823083dbe6f432615768974199db4eedaf xx99p01if-hpdm06203101.example.com:6379
   replicates 20f87d457d68e29b75cf28f6ea9d25e311bb0b7f
S: 0eca4b99d54f9cd3753ec9e9d6c6c793b7cc8da9 xx99p01if-hpdm11160101.example.com:6379
   replicates b5bc58c207bd3d3695600e469a8bf117995d0d0c
S: bff3c3f32cd781c35f1d59c9f9b109416af4b8aa xx99p01if-hpdm11160501.example.com:6379
   replicates 0aa3b1fdd30128369e04cafb9ff79a6d806acda4
S: 0247091f5b1ae02fa2951664660f5c8b211f28f6 xx99p01if-hpdm11160901.example.com:6379
   replicates fcb4c2dcd416b80f59ec387b5464bce528891695
Can I set the above configuration? (type 'yes' to accept):

然后当我尝试设置密钥时:

# docker exec -it mycluster redis-cli
127.0.0.1:6379> set foo bar
(error) CLUSTERDOWN Hash slot not served

集群状态显示失败:

cluster_state:fail
cluster_slots_assigned:0
cluster_slots_ok:0
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:1
cluster_size:0
cluster_current_epoch:0
cluster_my_epoch:0
cluster_stats_messages_sent:0
cluster_stats_messages_received:0

可能有一些简单的事情盯着我,但它却使我望而却步。

寻求帮助。

*更新*

我现在已经尝试过redis:5.0.4。

我现在还使用以下redis.conf,在其中我明确定义了集群通告IP地址和端口:

port 6379
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 30000
appendonly yes
loglevel verbose
maxclients 100
maxmemory 4gb
cluster-announce-ip 10.x.x.x
cluster-announce-port 6379
cluster-announce-bus-port 16379

0 个答案:

没有答案