一、使用yum安装mongodb 3.2
[root@node2 ~]# cat /etc/yum.repos.d/mongodb.repo
1
2
3
4
5
|
[mongodb-org-3.2]
name=MongoDB Repository
baseurl=https:
//repo
.mongodb.org
/yum/redhat/
$releasever
/mongodb-org/3
.2
/x86_64/
gpgcheck=0
enabled=1
|
[root@node2 ~]# yum install mongodb-org*
[root@node2 ~]# egrep -v "^(#|$)" /etc/mongod.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
systemLog:
destination:
file
logAppend:
true
path:
/data/mongodb/log/mongod
.log
storage:
dbPath:
/data/mongodb/data
directoryPerDB:
true
journal:
enabled:
true
processManagement:
fork:
true
# fork and run in background
pidFilePath:
/data/mongodb/conf/mongod
.pid
# location of pidfile
net:
port: 27027
#bindIp: 127.0.0.1 # Listen to local interface only, comment to listen on all interfaces.
|
[root@node2 ~]# mkdir -p /data/mongodb/{conf,data,log}
[root@node2 ~]# chown -R mongod. /data/mongodb
[root@node2 ~]# tail /etc/security/limits.conf
1
2
3
4
5
6
7
8
9
10
|
# End of file
mongod soft nproc 40000
* hard nofile 1000000
* soft nofile 1000000
* soft core unlimited
* soft stack 10240
* - nofile 65535
push - nproc 65535
push - nofile 320000
work - nproc 10000
|
[root@node2 ~]# cat /etc/security/limits.d/90-nproc.conf
1
2
3
4
5
|
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 1024
root soft nproc unlimited
|
[root@node2 ~]#
[root@node2 ~]# sed -n '62,64p' /etc/init.d/mongod
1
2
3
|
if
[ -f
/sys/kernel/mm/transparent_hugepage/defrag
] ;
then
echo
never >
/sys/kernel/mm/transparent_hugepage/defrag
fi
|
[root@node2 ~]# service mongod start
二、macbook pro 上安装mongodb
参考: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/
安装brew: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
brew install mongodb
mongod - -config /usr/local/etc/mongod.conf
三、mongo 客户端工具有: http://docs.mongodb.org/ecosystem/tools/administration-interfaces/