1. The configuration file mongodb is missing when being installed. Create the mongod. conf file in the etc directory as follows # mongo. conf # logging. logappendtrue # forkandruninbackgroundforktrue # port27017dbpathdatadb # Enablesperiodic
1. when installing mongodb, the configuration file is missing. Create mongod In The/etc directory. the conf configuration file is as follows # mongo. conf # where to loglogpath =/data/logs/db. loglogappend = true # fork and run in backgroundfork = true # port = 27017 dbpath =/data/db # Enables periodic
1. Create a configuration file
The configuration file is missing during mongodb installation.
Create the mongod. conf configuration file in the/etc directory.
The content is as follows:
# Mongo. conf # where to loglogpath =/data/logs/db. loglogappend = true # fork and run in backgroundfork = true # port = 27017 dbpath =/data/db # Enables periodic logging of CPU utilization and I/O wait # cpu = true # Turn on /off security. off is currently the default # noauth = true # auth = true # Verbose logging output. # verbose = true # Inspect all client data for validity on receept (useful for # developing drivers) # objcheck = true # Enable db quota management # quota = true "/etc/issue D. conf "82L, 1628C # mongo. conf # where to loglogpath =/data/logs/db. loglogappend = true # fork and run in backgroundfork = true # port = 27017 dbpath =/data/db # Enables periodic logging of CPU utilization and I/O wait # cpu = true # Turn on /off security. off is currently the default # noauth = true # auth = true # Verbose logging output. # verbose = true # Inspect all client data for validity on receept (useful for # developing drivers) # objcheck = true # Enable db quota management # quota = true # Set oplogging level where n is #0 = off (default) #1 = W #2 = R #3 = both #7 = W + some reads # oplog = 0 # Diagnostic/debugging option # nocursors = true # Ignore query hints # nohints = true # Disable the HTTP interface (Defaults to localhost: 27018 ). # nohttpinterface = true # Turns off server-side scripting. this will result in greatly limited # functionality # noscripting = true # Turns off table scans. any query that wocould do a table scan fails. # notablescan = true # Disable data file preallocation. # noprealloc = true # Specify. ns file size for new databases. # nssize =
# Accout token for Mongo monitoring server. # mms-token =
# Server name for Mongo monitoring server. # mms-name =
# Ping interval for Mongo monitoring server. # mms-interval =
# Replication Options # in replicated mongo databases, specify here whether this is a slave or master # slave = true # source = master.example.com # Slave only: specify a single database to replicate # only = master.example.com # or # master = true # source = slave. example. com2. start
Mongodb/bin/mongod-f/etc/mongod. conf
This kind of startup I feel very uncomfortable, then I will make it a service
3. service (service) script
Create a mongod file in the/etc/init. d directory
The content is as follows:
#!/bin/sh##mongod - Startup script for mongod## chkconfig: - 85 15# description: Mongodb database.# processname: mongod# Source function library. /etc/rc.d/init.d/functions# things from mongod.conf get there by mongod reading it# OPTIONSOPTIONS=" -f /etc/mongod.conf"#mongodmongod="/root/mongodb/bin/mongod"lockfile=/var/lock/subsys/mongodstart(){ echo -n $"Starting mongod: " daemon $mongod $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $lockfile}"/etc/init.d/mongod" 70L, 1036C#!/bin/sh##mongod - Startup script for mongod## chkconfig: - 85 15# description: Mongodb database.# processname: mongod# Source function library. /etc/rc.d/init.d/functions# things from mongod.conf get there by mongod reading it# OPTIONSOPTIONS=" -f /etc/mongod.conf"#mongodmongod="/root/mongodb/bin/mongod"lockfile=/var/lock/subsys/mongodstart(){ echo -n $"Starting mongod: " daemon $mongod $OPTIONS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $lockfile}stop(){ echo -n $"Stopping mongod: " killproc $mongod -QUIT RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f $lockfile}restart () { stop start}ulimit -n 12000RETVAL=0case "$1" in start) start ;; stop) stop ;; restart|reload|force-reload) restart ;; condrestart) [ -f $lockfile ] && restart || : ;; status) status $mongod RETVAL=$? ;; *) echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}" RETVAL=1esacexit $RETVAL
4. Add the File Execution permission
# Chmod + x/etc/init. d/mongod
5. service Command
Service Producer d start
Service producer D stop
Service producer D restart
6. view the port of the mongod service.
Netstat-treaty | grep mongod
7. My brother will write the script.
8. Here I want to write the boot and startup information, but the power is limited. The boot can only be placed under/etc/rc. local.
# Mongodb start
/Root/mongodb/bin/mongod -- repair
/Root/mongodb/bin/mongod-f/etc/mongod. conf
9. linux is profound and profound.