我把一个码头工人容器建在一起,建造了一个名为https://registry.hub.docker.com/u/jobflow/disque/
的码头我可以部署和运行单个服务。我可以公开一个端口并从运行在同一容器或不同容器上的disque客户端连接到它。
但是当连接到一个实例并发送集群与另一个容器的ip和端口相遇时,它将尝试集群实例但最终失败。
我可以链接两个容器,它们会很好地聚类,但你不能将一个容器链接到多个容器。
我可以在一个容器中运行多个disque服务,它们将集群正常。这只是跨容器通信失败。
例如:
3 disque servers running on 3 different containers
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0e31c5b751b5 jobflow/disque:latest "/bin/sh -c 'disque- 5 minutes ago Up 5 minutes 0.0.0.0:32770->7711/tcp disque-3
d48ec8e588d5 jobflow/disque:latest "/bin/sh -c 'disque- 5 minutes ago Up 5 minutes 0.0.0.0:32769->7711/tcp disque-2
8ee7ec27d210 jobflow/disque:latest "/bin/sh -c 'disque- 10 minutes ago Up 10 minutes 0.0.0.0:32768->7711/tcp disque
连接到服务器
# disque -h 192.168.99.100 -p 32768
192.168.99.100:32768>
加入集群
192.168.99.100:32768> cluster meet 192.168.99.100 32768
OK
192.168.99.100:32768>
看起来有效
192.168.99.100:32768> cluster info
cluster_state:ok
cluster_known_nodes:2
cluster_reachable_nodes:1
cluster_size:0
cluster_stats_messages_sent:171
cluster_stats_messages_received:0
192.168.99.100:32768>
稍等......不:(
192.168.99.100:32768> cluster info
cluster_state:ok
cluster_known_nodes:1
cluster_reachable_nodes:1
cluster_size:0
cluster_stats_messages_sent:296
cluster_stats_messages_received:0
192.168.99.100:32768>
让我们签出日志(将两台服务器都设置为调试)
192.168.99.100:32768> CONFIG SET loglevel debug
OK
7:P 17 Jun 21:11:25.357 * No cluster configuration found, I'm 3eb248db697774d0fa15e06ffcbf17f71767d4a0
Disque 0.0.1 (00000000/0) 64 bit
_ -
. Port: 7711
. o . PID: 7
.
- http://disque.io
7:P 17 Jun 21:11:25.398 # Server started, Disque version 0.0.1
7:P 17 Jun 21:11:25.399 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
7:P 17 Jun 21:11:25.399 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
7:P 17 Jun 21:11:25.399 * The server is now ready to accept connections on port 7711
7:P 17 Jun 22:42:20.608 - 1 clients connected, 724632 bytes in use
7:P 17 Jun 22:42:25.695 - 1 clients connected, 724632 bytes in use
7:P 17 Jun 22:42:30.790 - 1 clients connected, 724632 bytes in use
7:P 17 Jun 22:42:35.901 - 1 clients connected, 724632 bytes in use
7:P 17 Jun 22:42:40.988 - 1 clients connected, 724632 bytes in use
7:P 17 Jun 22:42:46.069 - 1 clients connected, 724632 bytes in use
# disque -h 192.168.99.100 -p 32769
192.168.99.100:32769> CONFIG SET loglevel debug
OK
6:P 17 Jun 21:15:58.906 * No cluster configuration found, I'm cb52f64739b801286dbd76ceb8801ae38d43384e
Disque 0.0.1 (00000000/0) 64 bit
_ -
. Port: 7711
. o . PID: 6
.
- http://disque.io
6:P 17 Jun 21:15:58.920 # Server started, Disque version 0.0.1
6:P 17 Jun 21:15:58.920 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
6:P 17 Jun 21:15:58.921 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
6:P 17 Jun 21:15:58.921 * The server is now ready to accept connections on port 7711
6:P 17 Jun 22:44:52.162 - 1 clients connected, 724632 bytes in use
6:P 17 Jun 22:44:57.240 - 1 clients connected, 724632 bytes in use
6:P 17 Jun 22:45:02.318 - 1 clients connected, 724632 bytes in use
6:P 17 Jun 22:45:07.406 - 1 clients connected, 724632 bytes in use
6:P 17 Jun 22:45:12.482 - 1 clients connected, 724632 bytes in use
6:P 17 Jun 22:45:17.570 - 1 clients connected, 724632 bytes in use
让我们再次介绍集群,看看最新情况
# disque -h 192.168.99.100 -p 32768
192.168.99.100:32768> cluster meet 192.168.99.100 32769
OK
7:P 17 Jun 22:47:05.553 - 1 clients connected, 724600 bytes in use
7:P 17 Jun 22:47:09.838 . Connecting with Node 555abc8b9b37044e10e0a61fc28a3ce15b564696 at 192.168.99.100:42769
7:P 17 Jun 22:47:09.838 . I/O error reading from node link: Connection refused
7:P 17 Jun 22:47:09.940 . Connecting with Node 555abc8b9b37044e10e0a61fc28a3ce15b564696 at 192.168.99.100:42769
7:P 17 Jun 22:47:09.940 . I/O error reading from node link: Connection refused
7:P 17 Jun 22:47:10.041 . Connecting with Node 555abc8b9b37044e10e0a61fc28a3ce15b564696 at 192.168.99.100:42769
7:P 17 Jun 22:47:10.041 . I/O error reading from node link: Connection refused
7:P 17 Jun 22:47:10.141 . Connecting with Node 555abc8b9b37044e10e0a61fc28a3ce15b564696 at 192.168.99.100:42769
7:P 17 Jun 22:47:10.141 . I/O error reading from node link: Connection refused
7:P 17 Jun 22:47:10.244 . Connecting with Node 555abc8b9b37044e10e0a61fc28a3ce15b564696 at 192.168.99.100:42769
7:P 17 Jun 22:47:24.673 . I/O error reading from node link: Connection refused
7:P 17 Jun 22:47:24.774 . Connecting with Node 555abc8b9b37044e10e0a61fc28a3ce15b564696 at 192.168.99.100:42769
7:P 17 Jun 22:47:24.774 . I/O error reading from node link: Connection refused
7:P 17 Jun 22:47:25.895 - 1 clients connected, 724632 bytes in use
7:P 17 Jun 22:47:30.979 - 1 clients connected, 724632 bytes in use
7:P 17 Jun 22:47:36.083 - 1 clients connected, 724632 bytes in use
WAT?
Connecting with Node 555abc8b9b37044e10e0a61fc28a3ce15b564696 at 192.168.99.100:42769
我通过了
192.168.99.100:32769
不
192.168.99.100:42769
嗯好然后让我们传递
192.168.99.100:32768> cluster meet 192.168.99.100 22769
OK
7:P 17 Jun 22:52:08.996 . Connecting with Node 540d0f780c5bf04df56c89f25315743116f20e92 at 192.168.99.100:32769
这似乎有效。但是......
192.168.99.100:32768> cluster info
cluster_state:ok
cluster_known_nodes:1
cluster_reachable_nodes:1
cluster_size:0
cluster_stats_messages_sent:445
cluster_stats_messages_received:0
答案 0 :(得分:1)
问题应该是由于Docker使用端口转发这一事实,这与Disque目前的工作方式不兼容。
但是,您可以使用1:1映射在Docker中禁用端口转发,如下所示:
getpeeraddr
如果在Redis群集中修复此问题,我还会在Disque中重新安装修复程序。 fix 将使Disque实例能够通过使用{{1}}系统调用自动检测来报告与节点将感知的IP /端口对不同的IP /端口对。