Mongo:Failed to set up listener: SocketException: Address already in use

MongoDB 执行:mongod --dbpath /export/data/mongo/ --auth报错:

mongo]# mongod --dbpath /export/data/mongo/ --auth
2022-11-21T20:21:07.247+0800 I CONTROL  [initandlisten] MongoDB starting : pid=47387 port=27017 dbpath=/export/data/mongo/ 64-bit host=A03-R05-I130-107-HQ8N5Z1.JD.LOCAL
2022-11-21T20:21:07.248+0800 I CONTROL  [initandlisten] db version v3.6.14
2022-11-21T20:21:07.248+0800 I CONTROL  [initandlisten] git version: cbef87692475857c7ee6e764c8f5104b39c342a1
2022-11-21T20:21:07.248+0800 I CONTROL  [initandlisten] allocator: tcmalloc
2022-11-21T20:21:07.248+0800 I CONTROL  [initandlisten] modules: none
2022-11-21T20:21:07.248+0800 I CONTROL  [initandlisten] build environment:
2022-11-21T20:21:07.248+0800 I CONTROL  [initandlisten]     distarch: x86_64
2022-11-21T20:21:07.248+0800 I CONTROL  [initandlisten]     target_arch: x86_64
2022-11-21T20:21:07.248+0800 I CONTROL  [initandlisten] options: { security: { authorization: "enabled" }, storage: { dbPath: "/export/data/mongo/" } }
2022-11-21T20:21:07.248+0800 E STORAGE  [initandlisten] Failed to set up listener: SocketException: Address already in use
2022-11-21T20:21:07.248+0800 I CONTROL  [initandlisten] now exiting
2022-11-21T20:21:07.248+0800 I CONTROL  [initandlisten] shutting down with code:48

显示SocketException 在使用

使用:sudo lsof -iTCP -sTCP:LISTEN -n -P 查看正在运行的程序

COMMAND     PID USER   FD   TYPE     DEVICE SIZE/OFF NODE NAME
systemd       1 root   90u  IPv4      36259      0t0  TCP *:111 (LISTEN)
systemd       1 root   92u  IPv6      36261      0t0  TCP *:111 (LISTEN)
rpcbind    6991  rpc    4u  IPv4      36259      0t0  TCP *:111 (LISTEN)
rpcbind    6991  rpc    6u  IPv6      36261      0t0  TCP *:111 (LISTEN)
tigagent   7406 root    5u  IPv4     573642      0t0  TCP 127.0.0.1:50811 (LISTEN)
snmpd      7554 root    8u  IPv4      34439      0t0  TCP 127.0.0.1:199 (LISTEN)
sshd       7556 root    3u  IPv4      34430      0t0  TCP *:22 (LISTEN)
sshd       7556 root    4u  IPv6      34432      0t0  TCP *:22 (LISTEN)
telegraf  30096 root    8u  IPv6  672893533      0t0  TCP *:10521 (LISTEN)
mongod    34556 root   11u  IPv4 2086368351      0t0  TCP *:27017 (LISTEN)
node_expo 42280 root    3u  IPv6 2076186748      0t0  TCP *:9100 (LISTEN)

kill 34556 将mongo kill

再次运行后成功

mongo]# mongod --dbpath /export/data/mongo/ --auth
2022-11-21T20:24:00.511+0800 I CONTROL  [initandlisten] MongoDB starting : pid=47614 port=27017 dbpath=/export/data/mongo/ 64-bit host=A03-R05-I130-107-HQ8N5Z1.JD.LOCAL
2022-11-21T20:24:00.511+0800 I CONTROL  [initandlisten] db version v3.6.14
2022-11-21T20:24:00.511+0800 I CONTROL  [initandlisten] git version: cbef87692475857c7ee6e764c8f5104b39c342a1
2022-11-21T20:24:00.511+0800 I CONTROL  [initandlisten] allocator: tcmalloc
2022-11-21T20:24:00.511+0800 I CONTROL  [initandlisten] modules: none
2022-11-21T20:24:00.511+0800 I CONTROL  [initandlisten] build environment:
2022-11-21T20:24:00.511+0800 I CONTROL  [initandlisten]     distarch: x86_64
2022-11-21T20:24:00.511+0800 I CONTROL  [initandlisten]     target_arch: x86_64
2022-11-21T20:24:00.511+0800 I CONTROL  [initandlisten] options: { security: { authorization: "enabled" }, storage: { dbPath: "/export/data/mongo/" } }
2022-11-21T20:24:00.512+0800 I STORAGE  [initandlisten] wiredtiger_open config: create,cache_size=31595M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),compatibility=(release="3.0",require_max="3.0"),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
2022-11-21T20:24:01.205+0800 I STORAGE  [initandlisten] WiredTiger message [1669033441:205497][47614:0x7f6743885a40], txn-recover: Set global recovery timestamp: 0
2022-11-21T20:24:01.219+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2022-11-21T20:24:01.219+0800 I CONTROL  [initandlisten] 
2022-11-21T20:24:01.219+0800 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2022-11-21T20:24:01.219+0800 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server. 
2022-11-21T20:24:01.219+0800 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP 
2022-11-21T20:24:01.219+0800 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2022-11-21T20:24:01.219+0800 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2022-11-21T20:24:01.219+0800 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2022-11-21T20:24:01.219+0800 I CONTROL  [initandlisten] 
2022-11-21T20:24:01.221+0800 I CONTROL  [initandlisten] 
2022-11-21T20:24:01.221+0800 I CONTROL  [initandlisten] ** WARNING: You are running on a NUMA machine.
2022-11-21T20:24:01.221+0800 I CONTROL  [initandlisten] **          We suggest launching mongod like this to avoid performance problems:
2022-11-21T20:24:01.221+0800 I CONTROL  [initandlisten] **              numactl --interleave=all mongod [other options]
2022-11-21T20:24:01.221+0800 I CONTROL  [initandlisten] 
2022-11-21T20:24:01.221+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2022-11-21T20:24:01.221+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2022-11-21T20:24:01.221+0800 I CONTROL  [initandlisten] 
2022-11-21T20:24:01.221+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2022-11-21T20:24:01.221+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2022-11-21T20:24:01.221+0800 I CONTROL  [initandlisten] 
2022-11-21T20:24:01.222+0800 I STORAGE  [initandlisten] createCollection: admin.system.version with provided UUID: 34d9c7b4-7441-40fe-8ebb-55f6f253775e
2022-11-21T20:24:01.229+0800 I COMMAND  [initandlisten] setting featureCompatibilityVersion to 3.6
2022-11-21T20:24:01.237+0800 I STORAGE  [initandlisten] createCollection: local.startup_log with generated UUID: d8ee3565-f755-4103-b125-b2525ae8022d
2022-11-21T20:24:01.243+0800 I FTDC     [initandlisten] Initializing full-time diagnostic data capture with directory '/export/data/mongo/diagnostic.data'
2022-11-21T20:24:01.244+0800 I NETWORK  [initandlisten] waiting for connections on port 27017
2022-11-21T20:24:01.244+0800 I STORAGE  [LogicalSessionCacheRefresh] createCollection: config.system.sessions with generated UUID: 7236a130-92da-49a3-abca-e7c758fe6784
2022-11-21T20:24:01.253+0800 I INDEX    [LogicalSessionCacheRefresh] build index on: config.system.sessions properties: { v: 2, key: { lastUse: 1 }, name: "lsidTTLIndex", ns: "config.system.sessions", expireAfterSeconds: 1800 }
2022-11-21T20:24:01.253+0800 I INDEX    [LogicalSessionCacheRefresh]     building index using bulk method; build may temporarily use up to 500 megabytes of RAM
2022-11-21T20:24:01.255+0800 I INDEX    [LogicalSessionCacheRefresh] build index done.  scanned 0 total records. 0 secs

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值