当我尝试启动mongodb时,我收到此错误:
initAndListen中的[initandlisten]异常:20尝试在只读目录上创建锁定文件:/ mnt / data / mng,终止
我正在使用centos 7.3而且我不知道我是否可以成为与se_linux
相关的问题......
如您所见,我设置mongo存储目录位于/mnt/data/mng
。这个问题似乎与某种权限有关。我看了看那里:
# ls -lha /mnt/data/
drwxr-xr-x. 3 root root 17 Jun 1 10:01 .
drwxr-xr-x. 3 root root 18 Jun 1 10:01 ..
drwxr-xr-x. 2 mongod mongod 6 Jun 1 10:01 mng
您可以在此处看到完整的消息:
I CONTROL [main] ***** SERVER RESTARTED *****
I CONTROL [initandlisten] MongoDB starting : pid=3373 port=30158 dbpath=/mnt/data/mng 64-bit host=localhost.localdomain
I CONTROL [initandlisten] db version v3.4.2
I CONTROL [initandlisten] git version: 3f76e40c105fc223b3e5aac3e20dcd026b83b38b
I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
I CONTROL [initandlisten] allocator: tcmalloc
I CONTROL [initandlisten] modules: none
I CONTROL [initandlisten] build environment:
I CONTROL [initandlisten] distmod: rhel70
I CONTROL [initandlisten] distarch: x86_64
I CONTROL [initandlisten] target_arch: x86_64
I CONTROL [initandlisten] options: { command: [ "run" ], config: "/etc/mongod.conf", net: { bindIp: "localhost", port: 30158 }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, security: { authorization: "enabled" }, storage: { dbPath: "/mnt/data/mng", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log", quiet: true } }
I STORAGE [initandlisten] exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /mnt/data/mng, terminating
I NETWORK [initandlisten] shutdown: going to close listening sockets...
I NETWORK [initandlisten] shutdown: going to flush diaglog...
I CONTROL [initandlisten] now exiting
I CONTROL [initandlisten] shutting down with code:100