Failed to unlink socket file /tmp/mongodb-27017.sock Permission denied
2021/9/1 2:07:07
本文主要是介绍Failed to unlink socket file /tmp/mongodb-27017.sock Permission denied,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
my mongodb server had stoped working on my mac:
ISSUE:
Failed to unlink socket file /tmp/mongodb-27017.sock Permission denied
check the log file and found the error:
view /usr/local/var/log/mongodb/mongod.log
Check the /tmp/mongodb-27017.sock permission, owner is root?
ls -ls /tmp/mongodb-27017.sock
output
"0 srwx------ 1 mongodb mongodb 0 Aug 24 04:01 /tmp/mongodb-27017.sock"
solution:
rm /tmp/mongodb-27017.sock
then
systemctl start mongod.service
start mongo, it appears:
$ mongo
MongoDB shell version v4.2.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2020-04-08T20:05:01.381+0800 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2020-04-08T20:05:01.384+0800 F - [main] exception: connect failed
2020-04-08T20:05:01.384+0800 E - [main] exiting with code 1
try to repair, but failed!
$ mongod -–repair
Error parsing command line: unrecognised option '-–repair'
try 'mongod --help' for more information
check th mongod.conf file (/usr/local/etc/mongod.conf), but it's not in the path.
view /etc/mongod.conf
ok, reinstall ?
$ brew uninstall mongodb-community@4.2
$ brew install mongodb-community@4.2
$ brew services start mongodb-community@4.2
In addition to the binaries, the install creates:
the configuration file (/usr/local/etc/mongod.conf)
the log directory path (/usr/local/var/log/mongodb)
the data directory path (/usr/local/var/mongodb)
run mongodb community :
$ mongod --config /usr/local/etc/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 37247
ERROR: child process failed, exited with error number 1
To see additional information in this output, start without the "--fork" option.
192:etc jessea$ mongod --config /usr/local/etc/mongod.conf
2020-04-08T21:51:29.689+0800 F CONTROL [main] Failed global initialization: FileNotOpen: logpath "/usr/local/var/log/mongodb/mongo.log" should name a file, not a directory.
$ cd /usr/local/var/log/mongodb/
// if you want to remove file, use rm filename
$ rm -r mongo.log
$ touch mongo.log
// To run MongoDB manually as a background process
$ mongod --config /usr/local/etc/mongod.conf --fork
about to fork child process, waiting until server is ready for connections.
forked process: 37320
child process started successfully, parent exiting
$ brew services start mongodb-community@4.2
Service `mongodb-community` already started, use `brew services restart mongodb-community` to restart.
$ brew services list
Name Status User Plist
mongodb-community started /Users/jessea/Library/LaunchAgents/homebrew.mxcl.mongodb-community.plist
// connect a mongo shell to the running instance. ( or "mongo --port 27017")
$ mongo
MongoDB shell version v4.2.5
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("751dee53-9e1f-4c41-a361-95e2918f4426") }
MongoDB server version: 4.2.5
Server has startup warnings:
2020-04-08T22:05:15.048+0800 I CONTROL [initandlisten]
2020-04-08T22:05:15.049+0800 I CONTROL [initandlisten] ** WARNING: Access control is not enabled for the database.
2020-04-08T22:05:15.050+0800 I CONTROL [initandlisten] ** Read and write access to data and configuration is unrestricted.
2020-04-08T22:05:15.051+0800 I CONTROL [initandlisten]
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).
The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.
To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---
> exit
这篇关于Failed to unlink socket file /tmp/mongodb-27017.sock Permission denied的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-23MongoDB身份认证机制揭秘!
- 2024-11-20MongoDB教程:从入门到实践详解
- 2024-11-17执行 Google Ads API 查询后返回的是空数组什么原因?-icode9专业技术文章分享
- 2024-11-17google广告数据不同经理账户下的凭证可以获取对方的api数据吗?-icode9专业技术文章分享
- 2024-11-15SendGrid 的 Go 客户端库怎么实现同时向多个邮箱发送邮件?-icode9专业技术文章分享
- 2024-11-15SendGrid 的 Go 客户端库怎么设置header 和 标签tag 呢?-icode9专业技术文章分享
- 2024-11-12Cargo deny安装指路
- 2024-11-02MongoDB项目实战:从入门到初级应用
- 2024-11-01随时随地一键转录,Google Cloud 新模型 Chirp 2 让语音识别更上一层楼
- 2024-10-25Google Cloud动手实验详解:如何在Cloud Run上开发无服务器应用