【linux】node requests 开启很多 mongodb connections 导致无法运行
2018-06-01T21:50:27.381+1000 I STORAGE [initandlisten] WiredTiger message [1527853827:381260][6025:0x7fffb1251380], txn-recover: Recovering log 88 through 892018-06-01T21:50:27.448+1000 I STORAGE [initandlisten] WiredTiger message [1527853827:448472][6025:0x7fffb1251380], txn-recover: Recovering log 89 through 89
2018-06-01T21:50:27.498+1000 I STORAGE [initandlisten] WiredTiger message [1527853827:498413][6025:0x7fffb1251380], txn-recover: Set global recovery timestamp: 0
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten]
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten]
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten]
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten]
2018-06-01T21:50:27.679+1000 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2018-06-01T21:50:27.765+1000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2018-06-01T21:50:27.765+1000 I NETWORK [initandlisten] waiting for connections on port 27017
2018-06-01T21:50:52.212+1000 I NETWORK [listener] connection accepted from 127.0.0.1:50805 #1 (1 connection now open)
2018-06-01T21:50:52.216+1000 I NETWORK [conn1] received client metadata from 127.0.0.1:50805 conn1: { driver: { name: "nodejs", version: "2.2.27" }, os: { type: "Darwin", name: "darwin", architecture: "x64", version: "17.5.0" }, platform: "Node.js v10.2.0, LE, mongodb-core: 2.1.11" }
2018-06-01T21:50:55.657+1000 I NETWORK [listener] connection accepted from 127.0.0.1:50813 #2 (2 connections now open)
2018-06-01T21:50:55.660+1000 I NETWORK [listener] connection accepted from 127.0.0.1:50814 #3 (3 connections now open)
db.serverStatus().connections
^C2018-06-01T21:54:59.098+1000 I CONTROL [signalProcessingThread] got signal 2 (Interrupt: 2), will terminate after current cmd ends
2018-06-01T21:54:59.098+1000 I NETWORK [signalProcessingThread] shutdown: going to close listening sockets...
2018-06-01T21:54:59.098+1000 I NETWORK [signalProcessingThread] removing socket file: /tmp/mongodb-27017.sock
2018-06-01T21:54:59.099+1000 I REPL [signalProcessingThread] shutdown: removing all drop-pending collections...
2018-06-01T21:54:59.099+1000 I REPL [signalProcessingThread] shutdown: removing checkpointTimestamp collection...
2018-06-01T21:54:59.099+1000 I FTDC [signalProcessingThread] Shutting down full-time diagnostic data capture
2018-06-01T21:54:59.102+1000 I STORAGE [signalProcessingThread] WiredTigerKVEngine shutting down
2018-06-01T21:54:59.461+1000 I STORAGE [signalProcessingThread] WiredTiger message [1527854099:461127][6025:0x70000d67f000], txn-recover: Main recovery loop: starting at 89/16000
2018-06-01T21:54:59.568+1000 I STORAGE [signalProcessingThread] WiredTiger message [1527854099:568928][6025:0x70000d67f000], txn-recover: Recovering log 89 through 90
2018-06-01T21:54:59.635+1000 I STORAGE [signalProcessingThread] WiredTiger message [1527854099:634951][6025:0x70000d67f000], txn-recover: Recovering log 90 through 90
2018-06-01T21:54:59.688+1000 I STORAGE [signalProcessingThread] WiredTiger message [1527854099:687995][6025:0x70000d67f000], txn-recover: Set global recovery timestamp: 0
2018-06-01T21:55:00.024+1000 I STORAGE [signalProcessingThread] shutdown: removing fs lock...
2018-06-01T21:55:00.025+1000 I CONTROL [signalProcessingThread] now exiting
2018-06-01T21:55:00.026+1000 I CONTROL [signalProcessingThread] shutting down with code:0
Arley-Mac:~ ZL$ clear
Arley-Mac:~ ZL$ mongo
MongoDB shell version v3.6.5
connecting to: mongodb://127.0.0.1:27017
2018-06-01T21:55:08.851+1000 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, in(checking socket for error after poll), reason: Connection refused
2018-06-01T21:55:08.851+1000 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
[email protected]/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed
Arley-Mac:~ ZL$ mongod
2018-06-01T21:55:11.580+1000 I CONTROL [initandlisten] MongoDB starting : pid=6159 port=27017 dbpath=/data/db 64-bit host=Arley-Mac.local
2018-06-01T21:55:11.580+1000 I CONTROL [initandlisten] db version v3.6.5
2018-06-01T21:55:11.580+1000 I CONTROL [initandlisten] git version: a20ecd3e3a174162052ff99913bc2ca9a839d618
2018-06-01T21:55:11.580+1000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.2o 27 Mar 2018
2018-06-01T21:55:11.580+1000 I CONTROL [initandlisten] allocator: system
2018-06-01T21:55:11.580+1000 I CONTROL [initandlisten] modules: none
2018-06-01T21:55:11.580+1000 I CONTROL [initandlisten] build environment:
2018-06-01T21:55:11.580+1000 I CONTROL [initandlisten] distarch: x86_64
2018-06-01T21:55:11.580+1000 I CONTROL [initandlisten] target_arch: x86_64
2018-06-01T21:55:11.580+1000 I CONTROL [initandlisten] options: {}
2018-06-01T21:55:11.581+1000 I - [initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
2018-06-01T21:55:11.581+1000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=7680M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),cache_cursors=false,log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2018-06-01T21:55:12.285+1000 I STORAGE [initandlisten] WiredTiger message [1527854112:285293][6159:0x7fffb1251380], txn-recover: Main recovery loop: starting at 91/768
2018-06-01T21:55:12.374+1000 I STORAGE [initandlisten] WiredTiger message [1527854112:374861][6159:0x7fffb1251380], txn-recover: Recovering log 91 through 92
2018-06-01T21:55:12.439+1000 I STORAGE [initandlisten] WiredTiger message [1527854112:439152][6159:0x7fffb1251380], txn-recover: Recovering log 92 through 92
2018-06-01T21:55:12.483+1000 I STORAGE [initandlisten] WiredTiger message [1527854112:483685][6159:0x7fffb1251380], txn-recover: Set global recovery timestamp: 0
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten]
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten]
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten] ** WARNING: This server is bound to localhost.
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten] ** Remote systems will be unable to connect to this server.
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten] ** Start the server with --bind_ip <address> to specify which IP
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten] ** addresses it should serve responses from, or with --bind_ip_all to
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten] ** bind to all interfaces. If this behavior is desired, start the
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten] ** server with --bind_ip 127.0.0.1 to disable this warning.
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten]
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten]
2018-06-01T21:55:12.633+1000 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2018-06-01T21:55:12.714+1000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
2018-06-01T21:55:12.715+1000 I NETWORK [initandlisten] waiting for connections on port 27017
2018-06-01T21:55:13.090+1000 I NETWORK [listener] connection accepted from 127.0.0.1:50873 #1 (1 connection now open)
看起来没什么大问题,但是每次node发出请求就一堆connections,导致失败。
比如我只是npm start 然后输入localhost:3000 就出来一堆connections:
回答
以上是 【linux】node requests 开启很多 mongodb connections 导致无法运行 的全部内容, 来源链接: utcz.com/a/85291.html