In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
It is believed that many inexperienced people are at a loss about how to set up MongoDB boot self-boot in the Linux system. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
MongoDB is a distributed file storage database written by C++. Its main purpose is to provide a scalable high-performance data storage scheme. The following and you will explain in detail the method of setting up boot self-startup in Linux.
1 vi / etc/rc.local
Open the configuration file using the vi editor and add the following line of code to it
/ usr/local/mongodb/bin/mongod-dbpath=/usr/local/mongodb/data/db-fork-port 27017-logpath=/usr/local/mongodb/log/work.log-logappend-auth
Start the service
/ usr/local/mongodb/bin/mongod-dbpath=/usr/local/mongodb/data/db-fork-port 27017-logpath=/usr/local/mongodb/log/work.log-logappend-auth
Other:
Installation and configuration of Mongodb under Linux
I choose rehl 6 as its running carrier here.
1. Download the linux version of mongodb (note the difference between 32-bit and 64-bit) at http://www.mongodb.org/downloads
two。 Put the downloaded mongodb installation file mongodb-linux-i686-1.6.5.tgz under / usr/local/
3. Decompress tar-zxvf mongodb-linux-i686-1.6.5.tgz
Rename mv mongodb-linux-i686-1.6.5.tgz mongodb
4. Create the database file directory. The default is / data/db. I put the database file directory under the current folder, mkdir-p data/db, and create the log directory mkdir log.
5. Start the service cd / usr/local/mongodb/bin
. / mongod-dbpath=../data/db-logpath=../log/mongodb.log
6. Start the client-side shell test
[root@localhost bin] #. / mongoMongoDB shell version: 1.6.5connecting to: test
Db.foo.save ({aid 1}) db.foo.find () {"_ id": ObjectId ("4d292a457e289d5d90dc6f33"), "a": 1}
7. Add mongoDB service to random startup
Vi / etc/rc.local
Open the configuration file using the vi editor and add the following line of code to it
/ usr/local/mongodb/bin/mongod-dbpath=/usr/local/mongodb/data/db-port 27017
-logpath=/usr/local/mongodb/log-logappend
8. Connect to the mongoDB client and start successfully when the following message appears. / mongodbbin/mongoMongoDB shell version: 1.6.5connecting to: test
9, script starts and shuts down mongodb
Start-mongod.shMONGODIR = / usr/local/mongodb MONGOD = MONGODIR/ bin/mongo DBDIR = MONGODIR/log / mongodb.log
Mongod will print its pid, so store it in out.tmp, thenprint it using awk to mongod.pidDBDIR-fork-logpath $LOGPATH-logappend > out.tmp awk'NR = = 2 {print $3} 'mongod.pid
Sleep 3$ MONGO
In onstart.jsuse admin; db.runCommand ("logRotate")
After reading the above, have you mastered the method of setting MongoDB boot self-boot in the Linux system? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.