In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to boot self-boot mongodb under Linux, which is very detailed and has a certain reference value. Interested friends must read it!
Method 1 (not recommended)
Ubuntu Editor / etc/rc.local
/ home/wyt/bin/mongodb-linux-x86_64-ubuntu1404-3.2.8/bin/mongod-dbpath=/home/wyt/bin/mongodb/data-logpath=/home/wyt/bin/mongodb/logs-logappend-port=27017-fork
Method 2 (not recommended)
/ home/wyt/bin/mongodb-linux-x86_64-ubuntu1404-3.2.8/bin/mongod-config / home/wyt/bin/mongodb.conf
Configuration file content:
# specify database path dbpath = / home/wyt/bin/mongodb/data # specify service port number, default port 27017port = 27017 # set each database will be saved in a separate directory directoryperdb = true # enable authentication (note, later change to true) auth = false # run MongoDB as daemon, create server process fork = true # provide http interface httpinterface = true # specify MongoDB log file Note that the specified file is not a directory logpath = / home/wyt/bin/mongodb/logs # write log logappend = true by appending
Show details
Note that the data folder above needs to be created. Logs is a file, not a folder. There is no need to create a logs.
Method 3 (recommended)
The configuration file is the same as in mode 2, copy mongodb to / etc/init.d, copy mongodb.conf to the appropriate place, and then execute
Chmod 777 / etc/init.d/mongodb
Update-rc.d mongodb defaults
Update-rc.d-f mongodb remove
Attachment:
The / etc/init.d/mongodb script is as follows
#! / bin/sh### BEGIN INIT INFO# Provides: mongodb# Required-Start:# Required-Stop:# Default-Start: 23 4 "Default-Stop: 0 1" Short-Description: mongodb# Description: mongodb server### END INIT INFOEXE_FILE=/home/wyt/bin/mongodb-linux-x86_64-ubuntu1404-3.2.9/bin/mongodCONFIG_FILE=/home/wyt/bin/mongodb.conf. / lib/lsb/init-functionsMONGOPID= `ps-ef | grep mongod | grep-v grep | awk'{print $2} '`test-x $EXE_FILE | | exit 0case "$1" instart) ulimit-n 3000 log_begin_msg "Starting MongoDB server" $EXE_FILE-- config $CONFIG_FILE log_end_msg 0;; stop) log_begin_msg "Stopping MongoDB server" if [!-z "$MONGOPID"]; then kill-15$ MONGOPID fi log_end_msg 0;; status) ps-aux | grep mongod *) log_success_msg "Usage: / etc/init.d/mongodb {start | stop | status}" exit 1esacexit 0
The above is all the contents of the article "how to boot mongodb in Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.