官网链接
安装运行
- 下载nsq docker镜像
docker pull nsqio/nsq
- 运行docker容器lookupd
运行:docker inspect -f '{{ .NetworkSettings.IPAddress }}' lookupd
得到容器ip: 172.17.0.12
- 运行docker容器nsqd
docker run -d --name nsqd -p 4150:4150 -p 4151:4151 nsqio/nsq /nsqd --broadcast-address=172.17.0.12 --lookupd-tcp-address=172.17.0.12:4160
- 运行docker容器nsqadmin
docker run -d --name nsqadmin -p 4171:4171 nsqio/nsq /nsqadmin --lookupd-http-address=172.17.0.12:4161
5.开放宿主机的防火墙对应端口
-A INPUT -p tcp -m state --state NEW -m tcp --dport 4150:4151 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 4160:4161 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 4171 -j ACCEPT
- 查看容器是否运行成功
docker ps
显示一下内容表示正常启动
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d8131a1c62f6 nsqio/nsq "/nsqadmin --lookupd…" 2 minutes ago Up 2 minutes 4150-4151/tcp, 4160-4161/tcp, 4170/tcp, 0.0.0.0:4171->4171/tcp nsqadmin
6b4400cff032 nsqio/nsq "/nsqd --broadcast-a…" 2 minutes ago Up 2 minutes 4160-4161/tcp, 0.0.0.0:4150-4151->4150-4151/tcp, 4170-4171/tcp nsqd
afeaa37c81f5 nsqio/nsq "/nsqlookupd" 18 minutes ago Up 18 minutes 4150-4151/tcp, 4170-4171/tcp, 0.0.0.0:4160-4161->4160-4161/tcp lookupd
- 访问nsqadmin
http://192.168.1.145:4171/