下载
wget https://s3.amazonaws.com/bitly-downloads/nsq/nsq-1.0.0-compat.linux-amd64.go1.8.tar.gz
解压到/usr/local目录
改名
tar -zxvf nsq-1.0.0-compat.linux-amd64.go1.8.tar.gz -C /usr/local/
cd /usr/local
mv nsq-1.0.0-compat.linux-amd64.go1.8/ nsq-1.0.0
配置开机启动
vi /usr/lib/systemd/system/nsqlookupd.service
[Unit]
Description=nsqlookup daemon Service
After=network.target remote-fs.target nss-lookup.target
[Service]
#Type=
PrivateTmp=yes
ExecStart=/usr/local/nsq-1.0.0/bin/nsqlookupd
Restart=on-abort
[Install]
WantedBy=multi-user.target
vi /usr/lib/systemd/system/nsqd.service
[Unit]
Description=nsqd daemon Service
After=network.target remote-fs.target nss-lookup.target
[Service]
#Type=
PrivateTmp=yes
ExecStart=/usr/local/nsq-1.0.0/bin/nsqd --lookupd-tcp-address=0.0.0.0:4160 --tcp-address=0.0.0.0:4150 --http-address=0.0.0.0:4151 --broadcast-address=192.168.178.128
#修改broadcast-address
Restart=on-abort
[Install]
WantedBy=multi-user.target
vi /usr/lib/systemd/system/nsqadmin.service
[Unit]
Description=nsqadmin daemon Service
After=network.target remote-fs.target nss-lookup.target
[Service]
#Type=
PrivateTmp=yes
ExecStart=/usr/local/nsq-1.0.0/bin/nsqadmin --lookupd-http-address=127.0.0.1:4161
Restart=on-abort
[Install]
WantedBy=multi-user.target
Type没有值时就注释掉,不然注册服务会失败。
头[unit]一定要加,不能省,不然注册服务会失败
注册开机服务
systemctl enable nsqlookupd
systemctl enable nsqd
systemctl enable nsqadmin
systemctl is-enabled nsqlookupd
systemctl is-enabled nsqd
systemctl is-enabled nsqadmin
查看服务是否开启
service nsqd status
开启防火墙端口
如果关闭了防火墙,就忽略
防火墙添加4150、4171
4171是web监控端口
firewall-cmd --zone=public --add-port=4150/tcp --permanent
firewall-cmd --zone=public --add-port=4171/tcp --permanent
(–permanent永久生效,没有此参数重启后失效)
重新载入
firewall-cmd --reload
查看
firewall-cmd --zone=public --query-port=4150/tcp
firewall-cmd --zone=public --query-port=4171/tcp