Mongodb:
https://docs.mongodb.com/manual/tutorial/install-mongodb-on-linux/#install-mongodb-community-edition
First, download the installation
# Curl-o Https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.2.9.tgz
Or
# wget Https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.2.9.tgz
# TAR-XF Mongodb-linux-x86_64-rhel62-3.2.9.tgz-c/opt/
# ln-s/opt/mongodb-linux-x86_64-rhel62-3.2.9//opt/mongodb
# Cat >>/etc/profile <
Path= $PATH:/opt/mongodb/bin
Here
# Source/etc/profile
# Mkdir-p/opt/mongodb/{log,db,conf}
Second, start
# Mongod--fork--httpinterface--rest--jsonp--setparameter enablelocalhostauthbypass=0--pidfilepath/opt/mongodb/ Mongod.pid--dbpath/opt/mongodb/db--logpath/opt/mongodb/log/mongod.log--logappend--logRotate Rename-- Timestampformat CTime
/** can join/etc/rc.d/rc.local to self-boot with the operating system reboot **/
/** Partial parameter explanation **/
--fork #后台daemon运行
--bind_ip #监听IP地址列表, separated by commas
--port #监听端口, default 27017
--setparameter enablelocalhostauthbypass=0 #所有接口都需要认证
--pidfilepath #pid文件
--dbpath #db存放路径
--logpath #日志文件
--config #配置文件
--auth #启用认证
--httpinterface #启用web接口
--rest #rest API
--JSONP #json API
/** if the idle command parameter is too many, you can specify a configuration file **/
WARNING
Ensure that the HTTP status interface, the REST API, and the JSON API is all disabled in production environments to Preve NT potential data exposure and vulnerability to attackers
[Email protected]:~ #netstat-tunlp|grep Mongod
TCP 0 0 0.0.0.0:28017 0.0.0.0:* LISTEN 11896/mongod
TCP 0 0 0.0.0.0:27017 0.0.0.0:* LISTEN 11896/mongod
Default listening port, DB port is 27017, Web port is 28017
# Vi/etc/sysconfig/iptables
-A input-p tcp-m state--state new-m TCP--dport 27017-j ACCEPT
-A input-p tcp-m state--state new-m TCP--dport 28017-j ACCEPT
Third, close
# Mongod--shutdown--dbpath/opt/mongod/db
It's OK
command-line mode execution shutdown
# Use Admin
Db.shutdownserver ()
Or
MONGO admin--port 27017--eval "Db.shutdownserver ()"
Iv. Configuration Files
The default binary package does not have a profile template that can be extracted from the source package
# cp-rp/usr/local/src/mongodb-src-r3.2.9/rpm/mongod.conf/opt/mongodb/conf/
/** The following is a simple configuration file that corresponds to the above command-line parameters **/
# mongod.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# Where to write logging data.
Systemlog:
Destination:file
Logappend:true
Logrotate:rename
Timestampformat:ctime
Path:/opt/mongodb/log/mongod.log
# Where and how to store data.
Storage
DbPath:/opt/mongodb/db
Journal
Enabled:true
# Engine:
# Mmapv1:
# Wiredtiger:
# How the process runs
Processmanagement:
Fork:true # Fork and run in background
Pidfilepath:/opt/mongodb/mongod.pid # Location of Pidfile
# Network Interfaces
Net
port:27017
#bindIp: 127.0.0.1 # Listen to local interface only, comment to Listen on all interfaces.
http
Enabled:true
Jsonpenabled:true
Restinterfaceenabled:true
Setparameter:
Enablelocalhostauthbypass:false
#security:
#operationProfiling:
#replication:
#sharding:
# # Enterprise-only Options
#auditLog:
#snmp:
For more parameters and explanations, please refer to the official documentation
V. Init control startup script
# useradd-s/sbin/nologin-r Mongod
# chown-r Mongod:/opt/mongodb-linux-x86_64-rhel62-3.2.9
# Cp-rp/usr/local/src/mongodb-src-r3.2.9/rpm/init.d-mongod/etc/init.d/mongod
/** template can still take **/from the source package
# chmod +x/etc/init.d/mongod
# sed-i '/configfile=/i mongod= "/opt/mongodb/bin/mongod" '/etc/init.d/mongod
# sed-i '/configfile=/s:/etc/mongod.conf:/opt/mongodb/conf/mongod.conf:g '/etc/init.d/mongod
Vi. Modifying kernel parameters
# Cat >>/etc/rc.d/rc.local <
# echo never >/sys/kernel/mm/transparent_hugepage/enabled
# echo never >/sys/kernel/mm/transparent_hugepage/defrag
# here
Seven, restart the service access;
# Service Mongod Restart
http://IP:28017/
This article is from the "Logs" blog, make sure to keep this source http://51log.blog.51cto.com/6076767/1856995
Single-Chip MongoDB