`

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:

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
 

 

 

分享到:
评论

相关推荐

    Centos 7.2中MongoDB数据库的安装与卸载教程

    1. 如果遇到 "Failed to unlink socket file /tmp/mongodb-27017.sock Operation not permitted" 错误,解决方法是删除该文件。 2. 当提示 "Unable to lock file: /var/lib/mongo/mongod.lock" 时,需要清空`mongod....

    Linux操作系统之安全审计功能-Audit

    -a always,exit -F arch=b64 -S open -S openat -S mkdir -S unlink -S rmdir -k fileops ``` 启用Auditd服务并使其在启动时自动运行,可执行以下命令: ```bash sudo systemctl start auditd sudo systemctl ...

    手机安装termux 安装linux系统

    然后,恢复备份文件,命令为tar -zxf /sdcard/termux-backup.tar.gz --recursive-unlink --preserve-permissions。 9. Ubuntu系统设置 安装完成后,使用命令进入Ubuntu系统,命令为proot-distro login ubuntu。...

    redis-desktop-manager-0.8.8.384.rar

    用户可以轻松地查找特定的键,对键进行重命名(`RENAMENX`或`RENAME`),以及删除键(`DEL`或`UNLINK`)。 3. **数据可视化**:Redis Desktop Manager将键值数据以清晰的结构展示,比如哈希(Hashes)、列表(Lists...

    linux-sys.zh

    - 最大打开文件个数:受系统限制,可以通过`/proc/sys/fs/file-max`查看。 - **读写操作**: - `read`和`write`:最基本的输入输出操作。 - **阻塞与非阻塞模式**: - 阻塞模式:在读取或写入未完成时,进程会...

    fuse-2.8.4.tar.gz

    在Linux操作系统中,文件系统的实现是一项核心任务,而FUSE(File System in Userspace)为开发者提供了一个独特的框架,使得用户空间程序能够创建自己的文件系统。本文将深入探讨FUSE 2.8.4版本的相关知识点,帮助...

    gr-0.52.0-Windows-x86_64.tar.gz

    使用julia中的GR模块每次build都卡住?下载这个包就对了。用法如下: 放到$DEPOT\packages\GR\BwGt2\deps\downloads 里面,然后修改$DEPOT\packages\GR\BwGt2\deps\build.jl ,删除 rm("downloads", force=true, ...

    redis-6.2.4-x64-windows-bin.zip

    修复 UNLINK 在 deleted consumer groups 的 stream key 上的崩溃( #8932 ) SINTERSTORE:当不存在任何 sources 时添加丢失的 keyspace del 事件 ( #8949 ) Sentinel:修复空字符串 sentinel-user/sentinel-pass ...

    fuse-2.9.8.tar.gz

    6. **构建与安装**:解压后的源代码包通常包含`configure`脚本和`Makefile`,用户需要通过执行`./configure`,`make`和`sudo make install`来编译和安装FUSE库及其头文件和库文件。 7. **示例**:FUSE源码包通常会...

    vimrc:我的vimrc备份

    unlink ~/.vimrc; ln -s ~/vimrc/vimrc_short_version ~/.vimrc unlink ~/.bash_profile; ln -s ~/vimrc/bash/linux_bash_profile ~/.bash_profile unlink ~/.tmux.conf; ln -s ~/vimrc/tmux/tmux.conf ~/.tmux.conf...

    redis-6.0.7-x64-for-windows-bin.zip

    stream 类型密钥的 UNLINK/Lazyfree 永远不会进行异步释放。 PERSIST 应该使 WATCH 无效(就像 EXPIRE 一样) 只有 read 命令的 EXEC 可能在 OOM 时被拒绝。 TLS:放宽对 CONFIG SET 的验证(如果设置了某些配置并且...

    jira-misc-workflow-extensions-6.0.1.jar

    Link / Unlink issues CONDITIONS: Previous Status Linked issues status Hide Transition Scripted (Groovy) VALIDATORS: Field has been modified Comment or Field is required Linked issues status Scripted...

    Python库 | upathlib-0.4.1.tar.gz

    例如,我们可以用`Path().is_file()`来判断一个路径是否指向文件,`Path().exists()`检查路径是否存在,`Path().mkdir(parents=True)`创建多级目录,以及`Path().unlink()`删除文件。这些方法都遵循了Python的链式...

    DES_PC--k.rar_fprintf

    if (pfile() == 0) unlink(inname) else fprintf(stderr, "%s: I/O Error -- File unchanged\n", inname) fclose(outfile) fclose(infile) } exit(0)

    linux常用命令源码(ls,cp,chmod,df等一百多个命令)

    c99-to-c89.diff cat.c chcon.c chgrp.c chmod.c chown.c chown-core.c chown-core.h chroot.c cksum.c comm.c copy.c cp.c cp-hash.c csplit.c cut.c date.c dcgen dd.c df.c dircolors.c dircolors.h dircolors....

    Open-Disk.rar_open

    比如CreateFile在Windows中也可用于创建新文件,而unlink或rename函数则分别用于删除和重命名文件,在Linux和Unix系统中。 对于Open Disk.txt这个文件,它可能包含了关于如何执行上述操作的具体代码示例或者指导。...

    pmpact:将Pact文件转换为Postman集合的命令行工具

    安装npm install -g pmpact 从仓库安装克隆仓库并从根目录执行: npm installnpm link注意:如果需要,请不要忘记运行npm unlink ! 命令行用法 来自网址pmpact ...

    ftp-server-code.rar_4 3 2 1_FTP SERVER_c 文件上传_ftp 上传

    FTP(File Transfer Protocol)服务器是互联网上用于在不同计算机之间传输文件的标准协议。在这个"ftp-server-code.rar_4 3 2 1_FTP SERVER_c 文件上传_ftp 上传"项目中,我们可以看到一个用C语言编写的FTP服务器...

    38-sysinfo.rar

    6. **网络编程**:包括套接字编程,如`socket()`, `bind()`, `listen()`, `accept()`, `connect()`, `send()`, `recv()`,以及TCP/IP协议栈的使用。 7. **权限与文件系统**:理解用户和组的概念,`chmod()`, `chown...

Global site tag (gtag.js) - Google Analytics