一、使用yum安装mongodb 3.2 [iyunv@node2 ~]# cat /etc/yum.repos.d/mongodb.repo [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 [iyunv@node2 ~]# yum install mongodb-org*
[iyunv@node2 ~]# egrep -v "^(#|$)" /etc/mongod.conf 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. [iyunv@node2 ~]# mkdir -p /data/mongodb/{conf,data,log} [iyunv@node2 ~]# chown -R mongod. /data/mongodb
[iyunv@node2 ~]# tail /etc/security/limits.conf # 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
[iyunv@node2 ~]# cat /etc/security/limits.d/90-nproc.conf # 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 [iyunv@node2 ~]#
[iyunv@node2 ~]# sed -n '62,64p' /etc/init.d/mongod if [ -f /sys/kernel/mm/transparent_hugepage/defrag ] ; then echo never > /sys/kernel/mm/transparent_hugepage/defrag fi [iyunv@node2 ~]# service mongod start
二、macbook pro 上安装mongodb brew update brew install mongodb mongod - -config /usr/local/etc/mongod.conf
|