启动nsolid-console时nsolid-proxy退出时出错

时间:2016-02-18 14:53:31

标签: nsolid

下载并安装运行时,(etcd-)集线器和代理后,我启动了集线器和代理,并使用超级简单的nodejs webserver和nsolid-cli测试了配置:

nsolid-cli --socket 40437 info

给了我

{
   "id": "0f2a54e6dba5dfe3970ff14999aba88518dca924",
   "app": "TESTAPP",
   "tags": [],
   "pid": 1565,
   "nodeEnv": "production",
   "execPath": "/opt/nsolid/bin/nsolid",
   "main": "/home/someuser/testserver.js"
}

然后启动nsolid-console时,nsolid-proxy死掉,抛出

TypeError: Cannot read property 'indexOf' of undefined
at Router.proxy (/opt/nsolid-proxy/router.js:59:18)
at emitThree (events.js:97:13)
at Listener.emit (events.js:175:7)
at Concat.callback (/opt/nsolid-proxy/node_modules/nsolid-listener/listener.js:138:32)
at Concat._done (/opt/nsolid-proxy/node_modules/nsolid-listener/concat.js:47:19)
at emitNone (events.js:72:20)
at Concat.emit (events.js:166:7)
at finishMaybe (_stream_writable.js:468:14)
at endWritable (_stream_writable.js:478:3)
at Concat.Writable.end (_stream_writable.js:443:5)
Shutting down hub

以下是使用NODE_DEBUG = nsolid运行时nsolid-console输出的内容:

NSOLID 6132: registering default commands
NSOLID 6132: nsolid initializing
NSOLID 6132: nsolid initialized on port 45918

> nsolid-console@1.4.4 start /opt/nsolid-console
> NODE_ENV=production node bin/nsolid-console --interval=1000

NSOLID 6143: registering default commands
NSOLID 6143: nsolid initializing
Server running on http://0.0.0.0:3000
NSOLID 6143: nsolid initialized on port 37954
NSOLID 6143: sending http://localhost:9000/info
POLLING ERROR: socket hang up
NSOLID 6143: sending http://localhost:9000/system_info
POLLING ERROR: connect ECONNREFUSED 127.0.0.1:9000

我尝试将代理设置为侦听127.0.0.1:9000和0.0.0.0:9000,以及使用localhost等等。

修改

这是nsolid-console目录中的.nsolid-proxyrc:

{
  "registry": "localhost:4001",
  "port": 9000,
  "denied": [],
  "broadcast_approved": [
    "ping",
    "process_stats",
    "system_stats",
    "system_info",
    "info",
    "versions",
    "startup_times"
  ]
}

1 个答案:

答案 0 :(得分:1)

您的 nsolid-proxy 配置文件似乎有问题,检查.nsolid-proxyrc文件夹中的nsolid-proxy文件,默认配置文件应如下所示:

{
  "registry": "localhost:4001",
  "port": 9000,
  "denied": [],
  "broadcast_approved": [
    "ping",
    "process_stats",
    "system_stats",
    "system_info",
    "info",
    "versions",
    "startup_times"
  ]
}

检查denied属性,它应该是一个数组。