1
janxin 2016-10-12 08:15:10 +08:00 via iPhone
端口号和 workerid 改了么?
单机部署是为了测试? |
3
ghbai 2016-10-12 10:21:16 +08:00
你看下启动失败的错误提示然后找原因就可以了啊。
ps:单台机器部署 cluster 是没有意义的。 |
4
avichen OP @ghbai 端口被占用,但是两个实例启动配置文件是配的不同的端口, ip 都是 0.0.0.0,难道两个端口不能在一个 IP 上启动?
启动另一个就提示端口被占用,感觉配置文件的参数没有生效 目前只是测试用,不是为了生产 nsqd 配置部分代码如下,两个实在分别配置的 4150 、 4151 和 4250 、 4251 ## enable verbose logging verbose = false ## unique identifier (int) for this worker (will default to a hash of hostname) id = 4150 ## <addr>:<port> to listen on for TCP clients tcp_address = "0.0.0.0:4150" ## <addr>:<port> to listen on for HTTP clients http_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 addresses nsqlookupd_tcp_addresses = [ "127.0.0.1:4160" "127.0.0.1:4260" ] ... |
5
ghbai 2016-10-12 11:30:02 +08:00
我自己试了下是可以的哇
nsqd 的两个配置文件分别为 /*nsqd.4150.cfg*/ id = 1 tcp_address = "0.0.0.0:4150" http_address = "0.0.0.0:4151" data_path = "./data1" nsqlookupd_tcp_addresses = [ "127.0.0.1:4160" ] /*nsqd.4250.cfg*/ id = 2 tcp_address = "0.0.0.0:4250" http_address = "0.0.0.0:4251" data_path = "./data2" nsqlookupd_tcp_addresses = [ "127.0.0.1:4160" ] |
6
avichen OP 你 nsqlookupd 只监听了一个?应该也有对应的两个 nsqlookupd 吧
|
7
ghbai 2016-10-12 11:36:59 +08:00
再加上一个 nsqlookupd 也是可以的,没有关系。
|
9
ghbai 2016-10-12 11:37:58 +08:00
我 QQ 号 951644384,加 QQ 聊吧,我帮你看下。
|
10
avichen OP 第一个启动后,生成的文件名是 856 的,第二个也是 856 的,这个是在哪儿控制修改的?
4150 [root@localhost nsq]# /usr/local/bin/nsq/nsqd -config= /usr/local/bin/nsq/nsqd.4150.cfg [nsqd] 2016/10/12 11:38:06.890583 nsqd v0.3.8 (built w/go1.6.2) [nsqd] 2016/10/12 11:38:06.895451 ID: 856 [nsqd] 2016/10/12 11:38:06.895498 NSQ: persisting topic/channel metadata to nsqd.856.dat [nsqd] 2016/10/12 11:38:06.914159 HTTP: listening on [::]:4151 [nsqd] 2016/10/12 11:38:06.914438 TCP: listening on [::]:4150 4250 [root@localhost nsq]# /usr/local/bin/nsq/nsqd -config= /usr/local/bin/nsq/nsqd.4250.cfg [nsqd] 2016/10/12 11:38:45.406966 FATAL: --data-path=/usr/local/bin/nsq in use (possibly by another instance of nsqd) |
11
ghbai 2016-10-12 11:43:15 +08:00 1
错误提示是 FATAL: --data-path=/usr/local/bin/nsq in use (possibly by another instance of nsqd)
你要为这两个实例指定不同的 data_path 参数,不是监听端口的问题 |