我在远程服务器上安装了mongodb,然后用第一台计算机连接到该服务器,但是当我从另一台计算机在同一mongod服务器上启动另一个连接时,它显示我:
机器1:
2019-07-24T11:55:59.523+0000 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2019-07-24T11:55:59.523+0000 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2019-07-24T11:55:59.523+0000 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2019-07-24T11:55:59.523+0000 I CONTROL [initandlisten]
2019-07-24T11:55:59.532+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2019-07-24T11:55:59.532+0000 I NETWORK [initandlisten] waiting for connections on port 27017
机器2:
2019-07-24T11:59:30.780+0000 I CONTROL [initandlisten] allocator: tcmalloc
2019-07-24T11:59:30.780+0000 I CONTROL [initandlisten] modules: none
2019-07-24T11:59:30.780+0000 I CONTROL [initandlisten] build environment:
2019-07-24T11:59:30.780+0000 I CONTROL [initandlisten] distarch: x86_64
2019-07-24T11:59:30.780+0000 I CONTROL [initandlisten] target_arch: x86_64
2019-07-24T11:59:30.780+0000 I CONTROL [initandlisten] options: {}
2019-07-24T11:59:30.780+0000 I STORAGE [initandlisten] exception in initAndListen:
DBPathInUse: Unable to lock the lock file: /data/db/mongod.lock (Resource temporarily unavailable). Another mongod instance is already running on the /data/db directory, terminating
2019-07-24T11:59:30.780+0000 I CONTROL [initandlisten] now exiting
2019-07-24T11:59:30.780+0000 I CONTROL [initandlisten] shutting down with code:100
反之亦然
我使用命令sudo mongod
进行启动连接
我如何同时连接两台计算机