首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法让码头容器运行disque以建立群集

无法让码头容器运行disque以建立群集
EN

Stack Overflow用户
提问于 2015-06-17 23:15:13
回答 1查看 762关注 0票数 1

我组装了一个码头集装箱建筑disque https://registry.hub.docker.com/u/jobflow/disque/

我能够部署和运行一个服务。我可以公开一个端口,并从运行在同一容器或不同容器上的disque客户端连接到它。

但是,当连接到一个实例并发送集群时,会遇到另一个容器的ip和端口,它将尝试集群实例,但最终失败。

我可以链接两个容器,它们可以很好地集群,但是您不能将一个容器链接到多个容器。

我可以在一个容器中运行多个disque服务,它们将集群ok。只是跨容器通信失败了。

例如:

代码语言:javascript
复制
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

连接到服务器

代码语言:javascript
复制
# disque -h 192.168.99.100 -p 32768
192.168.99.100:32768>   

连接簇

代码语言:javascript
复制
192.168.99.100:32768> cluster meet 192.168.99.100 32768
OK
192.168.99.100:32768>

看起来起作用了

代码语言:javascript
复制
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>

等一下..。不:(

代码语言:javascript
复制
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>

让我们签出日志(将这两台服务器设置为调试)

代码语言:javascript
复制
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    

让我们再介绍一下集群,看看会发生什么

代码语言:javascript
复制
# 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

瓦特?

代码语言:javascript
复制
Connecting with Node 555abc8b9b37044e10e0a61fc28a3ce15b564696 at 192.168.99.100:42769

我过去了

代码语言:javascript
复制
192.168.99.100:32769

192.168.99.100:42769

嗯,好,然后让我们过去。

代码语言:javascript
复制
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

这似乎很管用。但是..。

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-06-18 13:21:53

这个问题应该是因为Docker使用端口转发,这与Disque目前的工作方式不兼容。

但是,您可以使用1:1映射在Docker中禁用端口转发,如下所示:

代码语言:javascript
复制
$ docker run -d -p 7711:7711 ...

当在Redis集群中修复这个问题时,我还会在Disque中支持修复程序。修复方法是通过使用getpeeraddr系统调用自动检测,使Disque实例能够报告与节点感知不同的IP/端口对。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30904033

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档