安装参考教程
异常
缺少依赖库
关键信息:No such file or directory
bei@bei-pc:/usr/local/lib/mongodb/mongodb/bin$ mongod
mongod: error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory
安装 libcurl4-openssl-dev
sudo apt-get install libcurl4-openssl-dev
权限问题
异常描述:执行 mongod 出现如下提示。
关键信息:exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db
bei@bei-pc:/usr/local/lib/mongodb/mongodb/bin$ mongod
2019-09-22T23:12:48.708+0800 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2019-09-22T23:12:48.712+0800 I CONTROL [initandlisten] MongoDB starting : pid=4791 port=27017 dbpath=/data/db 64-bit host=bei-pc
2019-09-22T23:12:48.712+0800 I CONTROL [initandlisten] db version v4.2.0
2019-09-22T23:12:48.712+0800 I CONTROL [initandlisten] git version: a4b751dcf51dd249c5865812b390cfd1c0129c30
2019-09-22T23:12:48.712+0800 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1 11 Sep 2018
2019-09-22T23:12:48.713+0800 I CONTROL [initandlisten] allocator: tcmalloc
2019-09-22T23:12:48.713+0800 I CONTROL [initandlisten] modules: none
2019-09-22T23:12:48.713+0800 I CONTROL [initandlisten] build environment:
2019-09-22T23:12:48.713+0800 I CONTROL [initandlisten] distmod: ubuntu1804
2019-09-22T23:12:48.713+0800 I CONTROL [initandlisten] distarch: x86_64
2019-09-22T23:12:48.713+0800 I CONTROL [initandlisten] target_arch: x86_64
2019-09-22T23:12:48.713+0800 I CONTROL [initandlisten] options: {}
2019-09-22T23:12:48.713+0800 I STORAGE [initandlisten] exception in initAndListen: IllegalOperation: Attempted to create a lock file on a read-only directory: /data/db, terminating
2019-09-22T23:12:48.713+0800 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2019-09-22T23:12:48.713+0800 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2019-09-22T23:12:48.713+0800 I - [initandlisten] Stopping further Flow Control ticket acquisitions.
2019-09-22T23:12:48.713+0800 I CONTROL [initandlisten] now exiting
2019-09-22T23:12:48.713+0800 I CONTROL [initandlisten] shutting down with code:100