In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to configure mongodb on 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 database based on distributed file storage. Written in C++ language. Designed to provide scalable high-performance data storage solutions for WEB applications.
1. Download the Linux installation package
As shown in the following picture, put it in a local corner and remember the location.
two。 Connect to your server ssh root@ your IP / / enter password 3. Upload the installation package
Open another ssh window (command+n), if it is windows, open a new cmd window, because we have to manipulate the local file, the previous window we have logged on to the server. There are many ways to pass it on, and I'll show you only one of them. Cd "install package folder" / / go to the location where you just installed the package scp "local file" root@ your IP / / enter password to start sending as shown below, I am transferred to the root directory of the server. Actually, it is not recommended, you can put it in an inherent directory, such as / usr/local
Ls-l / / is expanded in the form of a list, and we can see that the download has been successful.
4. Extract the installation package
Tar-zxvf mongodb-linux-x86_64-3.4.6.tgz / / decompress different files with different decompression commands. Baidu can do it yourself.
5. A step in filling the hole
I just said that you can put each installation in a fixed folder, so I moved the unzipped files to the / usr/local/mongodb directory, if you have put it in your favorite location, you can skip this step. If you don't know how to move it, you can take a look. Cd / user/local / / enter localmkdir mongodb / / create a mongodb folder cd / / enter the root directory mv mongodb-linux-x86_64-3.4.6 / usr/local/mongodb / * move the extracted package into / usr/local/mongodb*/
6. Configure mongodb runtime environment mkdir data / / create data folder, store database db file mkdir logs / / create logs folder, store log file cd logs / / enter logs touch mongo.log / / create log file cd.. / / return to the previous level mkdir etc / / create a configuration folder cd etc / / enter etc vim mongo.conf / / Edit and create a mongo.conf file
The following is the code in the mongo.conf file, everyone is careful not to write wrong, after entering the file, you have to press the keyboard I to start writing code.
Dbpath = / usr/local/mongodb/data / / path must be absolute logpath = / usr/local/mongodb/logs/mongo.log / / path must be absolute logappend = true journal = true quiet = true port = 27017 / / Port
When you're done, press the ESC key to exit, then press shift+: to appear at the bottom: then type wq to save and exit.
At this point, it's almost over.
7. Start mongodbcd mongodb/mongodb-linux-x86_64-3.4.6/bin / / enter the mongod-f / usr/local/mongodb/etc/mongo.conf / / startup 1 method or. / mongod-f / usr/local/mongodb/etc/mongo.conf / / startup 2 method in the bin directory of the installation package.
If you enter this command, it appears as shown in the following figure, there is no change, only the cursor flashes.
8. Whether the local test was successful
I use the visualization tool Robo 3t, create a new link, address enter the server address, port fill in your mongo.conf configuration, basically 27027.
Click Save, as shown in the following figure, to Connect.
If it comes to this step, it will basically be a success.
9. Pit warning
What I wrote about the path in mongo.conf is relative, so the following problem arises.
And then that's what happened.
Thank you for reading! This is the end of this article on "how to configure mongodb on 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.