我刚刚使用brew安装了mongodb。尝试连接到端口27017时,出现以下错误:
2019-05-07T18:02:05.630+0200 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-05-07T18:02:05.644+0200 I CONTROL [initandlisten] MongoDB starting : pid=75196 port=27017 dbpath=/data/db 64-bit host=Andreis-MacBook-Pro.local
2019-05-07T18:02:05.644+0200 I CONTROL [initandlisten] db version v4.0.9
2019-05-07T18:02:05.644+0200 I CONTROL [initandlisten] git version: fc525e2d9b0e4bceff5c2201457e564362909765
2019-05-07T18:02:05.644+0200 I CONTROL [initandlisten] allocator: system
2019-05-07T18:02:05.644+0200 I CONTROL [initandlisten] modules: none
2019-05-07T18:02:05.644+0200 I CONTROL [initandlisten] build environment:
2019-05-07T18:02:05.644+0200 I CONTROL [initandlisten] distarch: x86_64
2019-05-07T18:02:05.644+0200 I CONTROL [initandlisten] target_arch: x86_64
2019-05-07T18:02:05.645+0200 I CONTROL [initandlisten] options: {}
2019-05-07T18:02:05.645+0200 I STORAGE [initandlisten] exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db, terminating
2019-05-07T18:02:05.645+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-05-07T18:02:05.645+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-05-07T18:02:05.645+0200 I CONTROL [initandlisten] now exiting
2019-05-07T18:02:05.645+0200 I CONTROL [initandlisten] shutting down with code:100
我已经卸载并安装了mongo,没有帮助:( 我试图将端口更改为27018,但没有帮助:( 我试图将目录设为根目录,而不起作用:(
Andreis-MacBook-Pro:~ Andrei$ > sudo chown -R $USER /data/db
chown: /data/db: Operation not permitted
Andreis-MacBook-Pro:~ Andrei$ > sudo chmod -R go+w /data/db
chmod: Unable to change file mode on /data/db: Operation not permitted
Andreis-MacBook-Pro:~ Andrei$
答案 0 :(得分:0)
由于您对文件夹 data / db
没有写权限,因此安装失败Attempted to create a lock file on a read-only directory: /data/db, terminating