NSQ安装

2021-05-13  本文已影响0人  袁先生的笔记

环境

系统:CentOS 6.8
软件:nsq-1.2.0.linux-amd64.go1.12.9.tar.gz

安装

tar -xzvf nsq-1.2.0.linux-amd64.go1.12.9.tar.gz
mv nsq-1.2.0.linux-amd64.go1.12.9 /usr/local/nsq
vim /etc/profile
export PATH=/usr/local/nsq/bin:$PATH

source /etc/profile

启动

nohup nsqlookupd > /usr/local/nsq/nsqlookupd.log 2>&1 &
nohup nsqd --lookupd-tcp-address=127.0.0.1:4160 > /usr/local/nsq/nsqd.log 2>&1 &

通过命令行参数进行服务配置,默认配置适用大多数情况。以下配置需要注意
--mem-queue-size=0 消息持久化到硬盘(默认消息都在内存中)

nohup nsqadmin --lookupd-http-address=127.0.0.1:4161 > /usr/local/nsq/nsqadmin.log 2>&1 &
cat << EOF >> /etc/rc.local
# nsq
nohup /usr/local/nsq/bin/nsqlookupd > /usr/local/nsq/nsqlookupd.log 2>&1 &
nohup /usr/local/nsq/bin/nsqd --lookupd-tcp-address=127.0.0.1:4160 > /usr/local/nsq/nsqd.log 2>&1 &
nohup /usr/local/nsq/bin/nsqadmin --lookupd-http-address=127.0.0.1:4161 > /usr/local/nsq/nsqadmin.log 2>&1 &
EOF
watch -n 1 "curl -s http://127.0.0.1:4151/stats"
上一篇下一篇

猜你喜欢

热点阅读