MongoDB 3.2.5安装过程详细记录(2)

dbpath=/data/mongo_27117/db
logpath=/data/mongo_27117/log/mongo_27117.log
pidfilepath = /data/mongo_27117/tmp/mongo_27117.pid
storageEngine = wiredTiger
wiredTigerCacheSizeGB = 2
syncdelay = 30
wiredTigerCollectionBlockCompressor = zlib
port=27117
auth = true
directoryperdb = true
oplogSize=2048
logappend=true
fork=true
#rest=true
journal = true
journalCommitInterval = 50
slowms = 200

修改目录、文件的权限和属组:

chown -R mongodb:mongodb /data/mongo_27117/

chown -R mongodb:mongodb /etc/mongodb

确认目录和配置文件都已经准备完毕:

ls -l /data/mongo_27117/

ls -l  /etc/mongodb

cat  /etc/mongodb/mongo_27117.conf

该步骤实际操作过程如下:

[root@linuxidc local]#
[root@linuxidc local]# mkdir -p /data/mongo_27117/{db,log,tmp}
[root@linuxidc local]# mkdir -p /etc/mongodb
[root@yq

-mapp-otadb248 local]#
[root@linuxidc local]#
[root@linuxidc local]# vim /etc/mongodb/mongo_27117.conf
dbpath=/data/mongo_27117/db
logpath=/data/mongo_27117/log/mongo_27117.log
pidfilepath = /data/mongo_27117/tmp/mongo_27117.pid
storageEngine = wiredTiger
wiredTigerCacheSizeGB = 2
syncdelay = 30
wiredTigerCollectionBlockCompressor = zlib
port=27117
auth = true
directoryperdb = true
oplogSize=2048
logappend=true
fork=true
#rest=true
journal = true
journalCommitInterval = 50
slowms = 200
~
[root@linuxidc local]#
[root@linuxidc local]# chown -R mongodb:mongodb /data/mongo_27117/
[root@linuxidc local]# chown -R mongodb:mongodb /etc/mongodb
[root@linuxidc local]# ls -l /data/mongo_27117/
total 12
drwxr-xr-x 2 mongodb mongodb 4096 Oct 19 12:02 db
drwxr-xr-x 2 mongodb mongodb 4096 Oct 19 12:02 log
drwxr-xr-x 2 mongodb mongodb 4096 Oct 19 12:02 tmp
[root@linuxidc local]#
[root@linuxidc local]#
[root@linuxidc local]# ls -l  /etc/mongodb
total 4
-rw-r--r-- 1 mongodb mongodb 392 Oct 19 12:05 mongo_27117.conf
[root@linuxidc local]#
[root@linuxidc local]# cat  /etc/mongodb/mongo_27117.conf
dbpath=/data/mongo_27117/db
logpath=/data/mongo_27117/log/mongo_27117.log
pidfilepath = /data/mongo_27117/tmp/mongo_27117.pid
storageEngine = wiredTiger
wiredTigerCacheSizeGB = 2
syncdelay = 30
wiredTigerCollectionBlockCompressor = zlib
port=27117
auth = true
directoryperdb = true
oplogSize=2048
logappend=true
fork=true
#rest=true
journal = true
journalCommitInterval = 50
slowms = 200

5. 启动mongodb实例,修改管理员密码

使用下面的命令启动mongodb服务:

/usr/local/mongodb/bin/mongod --config /etc/mongodb/mongo_27117.conf

确认密码,mongodb的管理员密码,可以根据各自的规则设置:

echo $MONGODB_ROOT_PASS

mongodb_020248_Pass

修改管理员密码,注意 mongodb 3.2要对admin授予三个角色,这点与之前的版本不同:

/usr/local/mongodb/bin/mongo --port=27117

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/837f8e0606de11eff08e167001205cb5.html