我正在尝试使用docker-compose
启动NSQ。
nsqlookupd:
image: nsqio/nsqlookupd
ports:
- "4160:4160"
- "4161:4161"
nsqd:
image: nsqio/nsqd
ports:
- "4150"
- "4151"
links:
- nsqlookupd:nsqlookupd
command: -lookupd-tcp-address=nsqlookupd:4160
nsqadmin:
image: nsqio/nsqadmin
ports:
- "4171:4171"
links:
- nsqlookupd:nsqlookupd
command: -lookupd-http-address=nsqlookupd:4161
容器运行良好,我什至可以通过Web浏览器访问管理面板,但无法连接到nsqd:
~/D/t/nsq % boot2docker ip
192.168.59.103
~/D/t/nsq % curl -d 'hello world 1' 'http://192.168.59.103:4150/put?topic=test'
curl: (7) Failed to connect to 192.168.59.103 port 4150: Connection refused
~/D/t/nsq %
有任何想法吗?
最佳答案
两件事情:
1)撰写文件中的nsqd条目应正确公开端口:ports: - "4150:4150" - "4151:4151"
2)HTTP接口(interface)的端口为4151,请尝试curl -d 'hello world 1' 'http://192.168.59.103:4151/put?topic=test'
关于docker - 在Docker中运行NSQ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30526513/