首先是下载,下载官方的二进制包, 下载地址 (支持Linux、Darwin、Freebsd和Windows)。哈哈:
wget https://s3.amazonaws.com/bitly-downloads/nsq/nsq-1.0.0-compat.linux-amd64.go1.8.tar.gz
解压:
tar -xzf nsq-1.0.0-compat.linux-amd64.go1.8.tar.gz
然后建立目录:
mkdir -p /home/vagrant/nsq-1.0.0-compat.linux-amd64.go1.8/bin/configcd /home/vagrant/nsq-1.0.0-compat.linux-amd64.go1.8/bin/config
建立配置文件dmin.cnf,内容如下:
## log verbosity level: debug, info, warn, error, or fatallog-level = "info"## <addr>:<port> to listen on for HTTP clientshttp_address = "0.0.0.0:4171"## graphite HTTP addressgraphite_url = ""## proxy HTTP requests to graphiteproxy_graphite = false## prefix used for keys sent to statsd (%s for host replacement, must match nsqd)statsd_prefix = "nsq.%s"## format of statsd counter statsstatsd_counter_format = "stats.counters.%s.count"## format of statsd gauge statsstatsd_gauge_format = "stats.gauges.%s"## time interval nsqd is configured to push to statsd (must match nsqd)statsd_interval = "60s"## HTTP endpoint (fully qualified) to which POST notifications of admin actions will be sentnotification_http_endpoint = ""## nsqlookupd HTTP addressesnsqlookupd_http_addresses = ["127.0.0.1:4161"]## nsqd HTTP addresses (optional)#nsqd_http_addresses = [# "127.0.0.1:4151"#]
建立nsqd.cnf,内容如下:
## log verbosity level: debug, info, warn, error, or fatallog-level = "info"## unique identifier (int) for this worker (will default to a hash of hostname)# id = 5150## <addr>:<port> to listen on for TCP clientstcp_address = "0.0.0.0:4150"## <addr>:<port> to listen on for HTTP clientshttp_address = "0.0.0.0:4151"## <addr>:<port> to listen on for HTTPS clients# https_address = "0.0.0.0:4152"## address that will be registered with lookupd (defaults to the OS hostname)# broadcast_address = ""## cluster of nsqlookupd TCP addressesnsqlookupd_tcp_addresses = ["127.0.0.1:4160"]## duration to wait before HTTP client connection timeouthttp_client_connect_timeout = "2s"## duration to wait before HTTP client request timeouthttp_client_request_timeout = "5s"## path to store disk-backed messages# data_path = "/var/lib/nsq"## number of messages to keep in memory (per topic/channel)mem_queue_size = 10000## number of bytes per diskqueue file before rollingmax_bytes_per_file = 104857600## number of messages per diskqueue fsyncsync_every = 2500## duration of time per diskqueue fsync (time.Duration)sync_timeout = "2s"## duration to wait before auto-requeing a messagemsg_timeout = "60s"## maximum duration before a message will timeoutmax_msg_timeout = "15m"## maximum size of a single message in bytesmax_msg_size = 1024768## maximum requeuing timeout for a messagemax_req_timeout = "1h"## maximum size of a single command bodymax_body_size = 5123840## maximum client configurable duration of time between client heartbeatsmax_heartbeat_interval = "60s"## maximum RDY count for a clientmax_rdy_count = 2500## maximum client configurable size (in bytes) for a client output buffermax_output_buffer_size = 65536## maximum client configurable duration of time between flushing to a client (time.Duration)max_output_buffer_timeout = "1s"## UDP <addr>:<port> of a statsd daemon for pushing stats# statsd_address = "127.0.0.1:8125"## prefix used for keys sent to statsd (%s for host replacement)statsd_prefix = "nsq.%s"## duration between pushing to statsd (time.Duration)statsd_interval = "60s"## toggle sending memory and GC stats to statsdstatsd_mem_stats = true## message processing time percentiles to keep track of (float)e2e_processing_latency_percentiles = [1.0,0.99,0.95]## calculate end to end latency quantiles for this duration of time (time.Duration)e2e_processing_latency_window_time = "10m"## path to certificate filetls_cert = ""## path to private key filetls_key = ""## set policy on client certificate (require - client must provide certificate,## require-verify - client must provide verifiable signed certificate)# tls_client_auth_policy = "require-verify"## set custom root Certificate Authority# tls_root_ca_file = ""## require client TLS upgradestls_required = false## minimum TLS version ("ssl3.0", "tls1.0," "tls1.1", "tls1.2")tls_min_version = ""## enable deflate feature negotiation (client compression)deflate = true## max deflate compression level a client can negotiate (> values == > nsqd CPU usage)max_deflate_level = 6## enable snappy feature negotiation (client compression)snappy = true
建立lookupd.cnf, 内容如下:
## log verbosity level: debug, info, warn, error, or fatallog-level = "info"## <addr>:<port> to listen on for TCP clientstcp_address = "0.0.0.0:4160"## <addr>:<port> to listen on for HTTP clientshttp_address = "0.0.0.0:4161"## address that will be registered with lookupd (defaults to the OS hostname)# broadcast_address = ""## duration of time a producer will remain in the active list since its last pinginactive_producer_timeout = "300s"## duration of time a producer will remain tombstoned if registration remainstombstone_lifetime = "45s"
然后运行如下命令:
mkdir -p /home/vagrant/nsqlogcd /home/vagrant/nsq-1.0.0-compat.linux-amd64.go1.8/binnohup ./nsqd -config=/home/vagrant/nsq-1.0.0-compat.linux-amd64.go1.8/bin/config/nsqd.cnf >> /home/vagrant/nsqlog/nsqd.log 2>&1 &nohup ./nsqlookupd -config= /home/vagrant/nsq-1.0.0-compat.linux-amd64.go1.8/bin/config/lookupd.cnf >> /home/vagrant/nsqlog/nsqlookupd.log 2>&1 &nohup ./nsqadmin -config=/home/vagrant/nsq-1.0.0-compat.linux-amd64.go1.8/bin/config/admin.cnf >> /home/vagrant/nsqlog/nsqadmin.log 2>&1 &
成功。至此,可以登录http://192.168.33.10:4171 查看后台了。
如此简单。
这是配置
参考:http://ju.outofmemory.cn/entry/271510
搜索
标签
study
ab
amap
apache
apahe
awk
aws
bat
centos
CFS
chrome
cmd
cnpm
composer
consul
crontab
css
curl
cygwin
devops
di
docker
docker,docker-compose
ethereum
excel
fiddler
fluentd
framework
front-end
git
gitgui
github
glide
go
golang
gorm
grafana
gzip
ioc
item2
iterm2
javascript
jenkins
jsonp
kafka
laradock
laravel
larval
linux
liunux
log
mac
mac, wi-fi
macos
magento
mariaDB
minikube
mongoDB
msp
mysql
netbeans
nginx
nodejs
nohup
npm
nsq
php
php-fpm
php7
phpstorm
php扩展
Protobuf
python
redis
scp
server
shell
soap
socket
socket5
sql
sre
ssdb
ssh
ssl
study
sublime
swift
system
td-agent
uml
v2ray
vagrant
vagrnat
vim
vpn
vue
vue.js
webpack
webrtc
websocket
webtatic
windows
windows7
word
wps
xdebug
yarn
yii2
yum
zookeeper
世界国家
互联网
以太坊
分类
前端
小程序
打印机
排序算法
搞笑
权限
粤语
缓存
网络
虚拟机
视频
设计模式
项目管理
热门文章
友情链接