mongodb 单点部署
官方文档:
https://docs.mongodb.com/v3.4/tutorial/install-mongodb-on-red-hat/
MongoDB 单点部署
服务器信息
ip | 系统 | 配置 | 目录 | 版本 |
---|---|---|---|---|
172.24.32.201 | centos7.7 | 2c4g | /var/lib/mongo (the data directory) /var/log/mongodb (the log directory) | 3.4 |
1、配置mongo源
cat >>/etc/yum.repos.d/mongodb-org-3.4.repo<<EOF
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=http://mirrors.tuna.tsinghua.edu.cn/mongodb/yum/el7-3.4/
gpgcheck=0
enabled=1
EOF
官网源404了,所以这里换成清华的源
2、安装mongo
sudo yum install -y mongodb-org
默认目录:
/var/lib/mongo (the data directory)
/var/log/mongodb (the log directory)
/etc/mongod.conf (config file)
3、启动并且加入开机自启动
sudo service mongod start
sudo systemctl enable mongod.service
4、检查mongo的版本和引擎
[root@test02 lib]# mongo -version
MongoDB shell version v3.4.24
git version: 865b4f6a96d0f5425e39a18337105f33e8db504d
OpenSSL version: OpenSSL 1.0.1e-fips 11 Feb 2013
allocator: tcmalloc
modules: none
build environment:
distmod: rhel70
distarch: x86_64
target_arch: x86_64
查看mongo引擎
echo "db.serverStatus()"| mongo|grep -C 3 wiredTiger
结果
[root@test02 ~]# echo "db.serverStatus()"| mongo|grep -C 3 wiredTiger
"command" : 0
},
"storageEngine" : {
"name" : "wiredTiger",
"supportsCommittedReads" : true,
"readOnly" : false,
"persistent" : true
--
"1.3" : NumberLong(0),
"unknown" : NumberLong(0)
},
"wiredTiger" : {
"uri" : "statistics:",
"LSM" : {
"application work units currently queued" : 0,
mongodb单机部署完毕