簡單記錄一下安裝.
Yum install可以讓事情變得很簡單.
$ sudo yum install rh-mongodb32 rh-mongodb32-server
$ /usr/bin/mongod -version
./mongo: error while loading shared libraries: libstemmer.so.rh-mongodb32-0: cannot open shared object file: No such file or directory
如果跑起來有找不到lib的情況, 手動指一下路徑到/usr/lib64/.
$ sudo ln -s /opt/rh/rh-mongodb32/root/lib64/libstemmer.so.rh-mongodb32-0 /usr/lib64/libstemmer.so.rh-mongodb32-0
Config調整, authorization: 'enabled' 讓外部可以連到你.
net:
port: 27017 # default
...
bindIp: 127.0.0.1,{$your_IP}
....
security:
authorization: 'enabled'
Service start.
$ systemctl start rh-mongodb32.service
Check version:
$ /usr/bin/mongod -version
db version v3.2.6
Connection String format
mongodb://{username}:{password}@{host}:{port}/{Database}
可以遠端連進來測試看看
文件: