我无法为mongoDB (WSL2 Arch)更改dbpath,我运行以下命令:
sudo mongod --dbpath /home/arijit/work/data/数据文件夹的权限:
drwxr-xr-x 2 mongodb mongodb 4096 Aug 9 10:00 data/我收到的错误消息:
{"t":{"$date":"2020-08-09T11:55:45.163+05:30"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"main","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
{"t":{"$date":"2020-08-09T11:55:45.228+05:30"},"s":"W", "c":"ASIO", "id":22601, "ctx":"main","msg":"No TransportLayer configured during NetworkInterface startup"}
{"t":{"$date":"2020-08-09T11:55:45.229+05:30"},"s":"I", "c":"NETWORK", "id":4648601, "ctx":"main","msg":"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
{"t":{"$date":"2020-08-09T11:55:45.231+05:30"},"s":"I", "c":"STORAGE", "id":4615611, "ctx":"initandlisten","msg":"MongoDB starting","attr":{"pid":2643,"port":27017,"dbPath":"/home/arijit/work/data/","architecture":"64-bit","host":"ARIJIT-PC-wsl"}}
{"t":{"$date":"2020-08-09T11:55:45.231+05:30"},"s":"I", "c":"CONTROL", "id":23403, "ctx":"initandlisten","msg":"Build Info","attr":{"buildInfo":{"version":"4.4.0","gitVersion":"563487e100c4215e2dce98d0af2a6a5a2d67c5cf","openSSLVersion":"OpenSSL 1.1.1g 21 Apr 2020","modules":[],"allocator":"tcmalloc","environment":{"distmod":"ubuntu1804","distarch":"x86_64","target_arch":"x86_64"}}}}
{"t":{"$date":"2020-08-09T11:55:45.231+05:30"},"s":"I", "c":"CONTROL", "id":51765, "ctx":"initandlisten","msg":"Operating System","attr":{"os":{"name":"Arch","version":"rolling"}}}
{"t":{"$date":"2020-08-09T11:55:45.232+05:30"},"s":"I", "c":"CONTROL", "id":21951, "ctx":"initandlisten","msg":"Options set by command line","attr":{"options":{"storage":{"dbPath":"/home/arijit/work/data/"}}}}
{"t":{"$date":"2020-08-09T11:55:45.268+05:30"},"s":"E", "c":"STORAGE", "id":20568, "ctx":"initandlisten","msg":"Error setting up listener","attr":{"error":{"code":9001,"codeName":"SocketException","errmsg":"Address already in use"}}}
{"t":{"$date":"2020-08-09T11:55:45.389+05:30"},"s":"I", "c":"CONTROL", "id":20565, "ctx":"initandlisten","msg":"Now exiting"}
{"t":{"$date":"2020-08-09T11:55:45.389+05:30"},"s":"I", "c":"CONTROL", "id":23138, "ctx":"initandlisten","msg":"Shutting down","attr":{"exitCode":48}}我尝试删除/var/lib/mongodb/mongod.lock文件,然后运行命令更改dbpath,但结果相同。
发布于 2020-09-06 10:35:53
基于@Gibbs答案,该错误意味着端口已经在使用另一个进程。你可以用
ps aux | grep -v grep | grep mongod输出应该如下所示
user 73044 0.2 0.2 5501992 17176 ?? S 11:02AM 0:07.32 mongod --config /usr/local/etc/mongod.conf --fork其中73044是PID。
然后,您可以用
kill -9 <PID> # Replace <PID> with the PID provided in the output...in my case 73044现在,您可以尝试重新启动mongod
mongod --dbpath /home/arijit/work/data/发布于 2020-08-09 07:49:30
错误是不同的
{“错误”:{“代码”:9001,"codeName":"SocketException",“errmsg”:“已在使用的地址”}}
这意味着端口已经被另一个进程使用了。
试着检查ps -ef | grep portConfigured。默认的mongo端口是27017
如果端口中正在运行另一个进程,那么在启动mongo时必须通过传递--port portNumber来更改端口。
https://stackoverflow.com/questions/63323397
复制相似问题