数据库02mongodb异常错误

mongo报错WiredTiger.wt, connection: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted

表现:sudo mongod可以成功启动mongo,但是不加sudo则不行,自然不希望每次都加sudo
完整报错:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 [initandlisten] MongoDB starting : pid=13900 port=27017 dbpath=/data/db 64-bit host=john-P95-HP
[initandlisten] db version v3.6.3
[initandlisten] git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
[initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
[initandlisten] allocator: tcmalloc
[initandlisten] modules: none
[initandlisten] build environment:
[initandlisten] distarch: x86_64
[initandlisten] target_arch: x86_64
[initandlisten] options: {}
[initandlisten] Detected data files in /data/db created by the 'wiredTiger' storage engine, so setting the active storage engine to 'wiredTiger'.
[initandlisten]
[initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
[initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
[initandlisten] wiredtiger_open config: create,cache_size=7449M,session_max=20000,eviction=(threads_min=4,threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),statistics_log=(wait=0),verbose=(recovery_progress),
[initandlisten] WiredTiger error (1) [1559653959:932022][13900:0x7f49416a70c0], file:WiredTiger.wt, connection: /data/db/WiredTiger.wt: handle-open: open: Operation not permitted
[initandlisten] Assertion: 28595:1: Operation not permitted src/mongo/db/storage/wiredtiger/wiredtiger_kv_engine.cpp 413
[initandlisten] exception in initAndListen: Location28595: 1: Operation not permitted, terminating
[initandlisten] shutdown: going to close listening sockets...
[initandlisten] removing socket file: /tmp/mongodb-27017.sock
[initandlisten] now exiting

处理:

1
2
3
4
5
# storage.dbPath
sudo chown -R mongodb:mongodb /var/lib/mongodb

# systemLog.path
sudo chown -R mongodb:mongodb /var/log/mongodb

这里面的mongodb:mongodb分别是用户组和用户名,
可通过如下命令查询当前用户所属组,

1
groups xxxx:xxxx是当前登录用户(一个用户可能属于多个组)

参考:https://stackoverflow.com/questions/43137250/mongodb-3-4-3-permission-denied-wiredtiger-kv-engine-cpp-267-error-with-ubuntu-1

数据库系列
数据库01mysql常用操作速查
数据库02mongodb异常错误
数据库03mongodb占用磁盘空间过大
数据库04sqlite转mysql
数据库05redis常用命令整理
数据库06redis事务
数据库07redis分布式锁
数据库08redis其他
数据库09mysql常用查询实例
数据库10mysql之坑
数据库11mysql之坑null专题
数据库12经验之谈
数据库13mysql执行计划
数据库14mysql的redolog与binlog
数据库15mysql报错2006
数据库16mysql之初始密码
数据库17mysql锁机制
数据库18mysql事务和MVCC

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×