快速部署MongoDB
MongoDB是一个基于分布式文件存储的数据库。由C++语言编写。旨在为WEB应用提供可扩展的高性能数据存储解决方案。本文安装的版本为3.0,其他版本可对照。
设置mongodb repo
vi /etc/yum.repos.d/mongodb-org-3.0.repo
添加如下内容:
[mongodb-org-3.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.0.asc
安装mongodb-org
yum -y install mongodb-org
会依次安装如下软件:
正在安装:
mongodb-org x86_64 3.0.15-1.el7 mongodb-org-3.0 5.8 k
为依赖而安装:
mongodb-org-mongos x86_64 3.0.15-1.el7 mongodb-org-3.0 4.6 M
mongodb-org-server x86_64 3.0.15-1.el7 mongodb-org-3.0 9.7 M
mongodb-org-shell x86_64 3.0.15-1.el7 mongodb-org-3.0 5.0 M
mongodb-org-tools x86_64 3.0.15-1.el7 mongodb-org-3.0 38 M
查看/etc.init.d/
可以看到mongod
服务:
[root@node1 init.d]# ls /etc/init.d
functions mongod netconsole network README
启动mongodb
[root@node1 init.d]# mongo localhost
MongoDB shell version: 3.0.15
connecting to: localhost
Server has startup warnings:
2017-07-24T17:52:42.621+0800 I STORAGE [initandlisten]
2017-07-24T17:52:42.621+0800 I STORAGE [initandlisten] ** WARNING: Readahead for /var/lib/mongo is set to 4096KB
2017-07-24T17:52:42.621+0800 I STORAGE [initandlisten] ** We suggest setting it to 256KB (512 sectors) or less
2017-07-24T17:52:42.621+0800 I STORAGE [initandlisten] ** http://dochub.mongodb.org/core/readahead
2017-07-24T17:52:42.775+0800 I CONTROL [initandlisten]
2017-07-24T17:52:42.776+0800 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 4096 processes, 64000 files. Number of processes should be at least 32000 : 0.5 times number of files.
>
退出mongodb:
> exit
bye