在mongo配置查询路由器实例

时间:2018-02-08 11:43:53

标签: mongodb

我在mongo路由服务器上运行了这个命令

  

mongos --configdb config0 / 54.172.165.128:27019,54.165.48.170:27019

但输出是

2018-02-08T11:39:48.566+0000 W SHARDING [main] Running a sharded cluster with fewer than 3 config servers should only be done for testing purposes and is not recommended for production.
2018-02-08T11:39:48.571+0000 I CONTROL  [main] 
2018-02-08T11:39:48.571+0000 I CONTROL  [main] ** WARNING: Access control is not enabled for the database.
2018-02-08T11:39:48.571+0000 I CONTROL  [main] **          Read and write access to data and configuration is unrestricted.
2018-02-08T11:39:48.571+0000 I CONTROL  [main] ** WARNING: You are running this process as the root user, which is not recommended.
2018-02-08T11:39:48.571+0000 I CONTROL  [main] 
2018-02-08T11:39:48.571+0000 I CONTROL  [main] ** WARNING: This server is bound to localhost.
2018-02-08T11:39:48.571+0000 I CONTROL  [main] **          Remote systems will be unable to connect to this server. 
2018-02-08T11:39:48.571+0000 I CONTROL  [main] **          Start the server with --bind_ip <address> to specify which IP 
2018-02-08T11:39:48.571+0000 I CONTROL  [main] **          addresses it should serve responses from, or with --bind_ip_all to
2018-02-08T11:39:48.571+0000 I CONTROL  [main] **          bind to all interfaces. If this behavior is desired, start the
2018-02-08T11:39:48.571+0000 I CONTROL  [main] **          server with --bind_ip 127.0.0.1 to disable this warning.
2018-02-08T11:39:48.571+0000 I CONTROL  [main] 
2018-02-08T11:39:48.571+0000 I SHARDING [mongosMain] mongos version v3.6.2
2018-02-08T11:39:48.571+0000 I CONTROL  [mongosMain] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-02-08T11:39:48.571+0000 I CONTROL  [mongosMain] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2018-02-08T11:39:48.571+0000 I CONTROL  [mongosMain] allocator: tcmalloc
2018-02-08T11:39:48.571+0000 I CONTROL  [mongosMain] modules: none
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain] build environment:
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain]     distmod: ubuntu1604
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain]     distarch: x86_64
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain]     target_arch: x86_64
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain] db version v3.6.2
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain] git version: 489d177dbd0f0420a8ca04d39fd78d0a2c539420
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain] OpenSSL version: OpenSSL 1.0.2g  1 Mar 2016
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain] allocator: tcmalloc
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain] modules: none
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain] build environment:
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain]     distmod: ubuntu1604
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain]     distarch: x86_64
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain]     target_arch: x86_64
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain] options: { sharding: { configDB: "config0/54.172.165.128:27019,54.165.48.170:27019" } }
2018-02-08T11:39:48.572+0000 E SHARDING [mongosMain] Failed to set up listener: SocketException: Address already in use
2018-02-08T11:39:48.572+0000 I CONTROL  [mongosMain] shutting down with code:48

这里有什么问题?

1 个答案:

答案 0 :(得分:1)

你在端口27017上运行了一些东西:

  

无法设置侦听器:SocketException:地址已在使用中。

如果您想在此端口上使用netstat -a -b,可以查看该端口上正在运行的内容。

或者您可以使用--port xx选项(https://docs.mongodb.com/manual/reference/program/mongos/#cmdoption-mongos-port

指定其他端口