我刚刚在arch中安装了带有AUR的mongoDB,并试图像运行它一样;
mongod
但总是这样;
2019-05-11T17:07:09.608+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-05-11T17:07:09.611+0000 I CONTROL [initandlisten] MongoDB starting : pid=27076 port=27017 dbpath=/data/db 64-bit host=manjaro
2019-05-11T17:07:09.611+0000 I CONTROL [initandlisten] db version v4.0.9
2019-05-11T17:07:09.611+0000 I CONTROL [initandlisten] git version: fc525e2d9b0e4bceff5c2201457e564362909765
2019-05-11T17:07:09.611+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1b 26 Feb 2019
2019-05-11T17:07:09.611+0000 I CONTROL [initandlisten] allocator: tcmalloc
2019-05-11T17:07:09.611+0000 I CONTROL [initandlisten] modules: none
2019-05-11T17:07:09.611+0000 I CONTROL [initandlisten] build environment:
2019-05-11T17:07:09.611+0000 I CONTROL [initandlisten] distmod: ubuntu1804
2019-05-11T17:07:09.611+0000 I CONTROL [initandlisten] distarch: x86_64
2019-05-11T17:07:09.611+0000 I CONTROL [initandlisten] target_arch: x86_64
2019-05-11T17:07:09.611+0000 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db", mmapv1: { smallFiles: true } } }
2019-05-11T17:07:09.611+0000 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
2019-05-11T17:07:09.612+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-05-11T17:07:09.612+0000 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-05-11T17:07:09.612+0000 I CONTROL [initandlisten] now exiting
2019-05-11T17:07:09.612+0000 I CONTROL [initandlisten] shutting down with code:100
我该怎么办?
答案 0 :(得分:0)
2019-05-11T17:07:09.611+0000 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
您缺少指向它的db目录的路径。使用以下命令在根文件夹中创建一个:
sudo mkdir /data/db
在这里推荐sudo,有时mongoDB可以运行以解决权限问题。