Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the basic configuration for Mongdb startup

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about the basic configuration of Mongdb startup, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Background: have a preliminary understanding of MongoDB

Reading purpose: learn more about how to install MongoDB on a Linux machine

1: download MongoDB

Please go directly to MongoDB's official website to download MongoDB. The address for download is:

Http://www.mongodb.org/downloads

In the blog post in this chapter, MongoDB Linux-64bit,prouction Release Version (2.6.5) was downloaded

The downloaded file is called mongodb-linux-x86_64-2.6.5.gz

2: extract and install

2.1:

[root@localhost soft] # tar-zxvf mongodb-linux-i686-2.0.2-rc2.tgz mongodb-linux-i686-2.0.2-rc2/ mongodb-linux-i686-2.0.2-rc2/THIRD-PARTY-NOTICES mongodb-linux-i686-2.0.2-rc2/GNU-AGPL-3.0 mongodb-linux-i686-2.0.2-rc2/README mongodb-linux-i686-2.0.2-rc2/bin/ mongodb-linux-i686-2. 0.2-rc2/bin/mongofiles mongodb-linux-i686-2.0.2-rc2/bin/mongostat mongodb-linux-i686-2.0.2-rc2/bin/bsondump mongodb-linux-i686-2.0.2-rc2/bin/mongos mongodb-linux-i686-2.0.2-rc2/bin/mongotop mongodb-linux-i686-2.0.2-rc2/bin/mongodump mongodb-linux-i686-2.0.2-rc2/bin/mongoimport mongodb-linux-i686-2.0 2-rc2/bin/mongosniff mongodb-linux-i686-2.0.2-rc2/bin/mongo mongodb-linux-i686-2.0.2-rc2/bin/mongod mongodb-linux-i686-2.0.2-rc2/bin/mongoexport mongodb-linux-i686-2.0.2-rc2/bin/mongorestore

You need to create 2 folders for MongoDb, one of which is log and the other is db. The default folder is: / mongodb/data

The default log address is / mongodb/data

The startup command is as follows:

[root@localhost mongodb] #. / bin/mongod-port 10001-dbpath data/-logpath log/mongodb.log

Here, the address of the log and database is specified

Verify:

Use the bin/mongo command to connect to the database

/ bin/mongo localhost:10001

Insert a value into the database

Connecting to: localhost:10001/test > db.foo.save ({aVl1})

Query:

> db.foo.find () {"_ id": ObjectId ("4ee66eb440ef7803a9873d2d"), "a": 1} >

Through the browser, when asked about our MongoDB interface process. You need to add the rest command at startup.

Bin/mongod-port 10001-rest

This can be accessed through the console,

The above is the basic configuration of Mongdb startup, and the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report