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 is to share with you about how to set up mongodb boot under Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
MongoDB is a distributed file storage-based NoSQL database written by C++ language, which runs stably and has high performance. It aims to provide scalable and high-performance data storage solutions for WEB applications.
Set up the mongodb.service startup service cd / lib/systemd/system vi mongodb.service
[Unit] Description=mongodb After=network.target remote-fs.target nss-lookup.target [Service] Type=forking RuntimeDirectory=mongodb RuntimeDirectoryMode=0751 PIDFile=/var/run/mongodb/mongod.pid ExecStart=/usr/mongodb/bin/mongod-- config / usr/mongodb/mongodb.conf ExecStop=/usr/mongodb/bin/mongod-- shutdown-- config / usr/mongodb/mongodb.conf PrivateTmp=false [Install] WantedBy=multi- User.targetmongodb.service service sets mongodb.service permissions
Chmod 754 mongodb.service
System mongodb.service operation command
# start Service systemctl start mongodb.service # close Service systemctl stop mongodb.service # Boot start systemctl enable mongodb.service mongodb.service start Test
Mongodb service startup test
Service mongodb start https://www.cnblogs.com/lanbosm/articles/8312725.html
If the one above doesn't work,
Use
#! / 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 # OPTIONS OPTIONS= "- dbpath=/home/data/mongodb/-- logpath=/home/data/mongodb/mongodb.log-- logappend &" # mongod mongod= "/ usr/local/mongodb/bin/mongod" lockfile=/var/lock/subsys/mongod start () {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 12000 RETVAL=0 case "$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=1 esac exit $RETVAL saves the code to / etc/init.d/mongodb, and then uses chmod + x / etc/init.d/mongodb to add execution permissions.
# chmod + x / etc/init.d/mongodb # chkconfig-- add mongodb # chkconfig mongodb on # service mongodb start can now use the service command to control mongodb:
Https://www.jianshu.com/p/9882745767fd
Thank you for reading! This is the end of this article on "how to set up mongodb boot under Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.