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

Install mongodb 2.6.5 under CentOS 6.5

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Mongo DB is a very popular non-relational database (NoSql) in the IT industry, and its flexible data storage method is favored by current IT employees. Mongo DB implements the object-oriented idea very well. In Mongo DB, each record is a Document object. The biggest advantage of Mongo DB is that all data persistence operations do not need developers to write SQL statements manually, and you can easily implement CRUD operations by calling methods directly. Here's how to install mongodb:

1. Check whether mongodb has been installed, and if so, delete it

# rpm-qa | grep mongodb

2. Download mongodb (download to / doiido/soft)

# mkdir / doiido/soft# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.5.tgz-P / doiido/soft

3. Decompress mongodb

# cd / doiido/soft# tar zxvf mongodb-linux-x86_64-2.6.5.tgz# mv mongodb-linux-x86_64-2.6.5 / doiido/mongodb

4. Set up the storage directory of database and log

# mkdir / doiido/mongodb/data# mkdir / doiido/mongodb/logs# touch / doiido/mongodb/logs/mongodb.log

5. Establish a configuration file

# vi / doiido/mongodb/bin/mongodb.confdbpath=/doiido/mongodb/datalogpath=/doiido/mongodb/logs/mongodb.logport=27017fork=truenohttpinterface=true

6. Start mongodb

# / doiido/mongodb/bin/mongod-- bind_ip localhost-f / doiido/mongodb/bin/mongodb.conf

7. Set up boot boot

# echo "/ doiido/mongodb/bin/mongod-- config / doiido/mongodb/bin/mongodb.conf" > > / etc/rc.local

8. Testing

8.1. Enter shell mode of mongodb

# / doiido/mongodb/bin/mongo

8.2. View the list of databases

> show dbs

8.3. Current db version

> db.version ()

9. Stop mongodb

9.1. Enter mongodb and close

# / doiido/mongodb/bin/mongo > db.shutdownServer ()

9.2. Use the mongodb instruction to close

# mongod-shutdown-config / doiido/mongodb/bin/mongodb.conf

9.3. Use the kill instruction

# ps-ef | grep mongo# kill pid

Note: kill-9 pid cannot be used in this place, which will result in data loss and mongodb may report an error.

If you shut down mongodb using kill-9 pid and mongodb does not start properly, delete the mongod.lock file:

# rm-f / doiido/mongodb/data/mongod.lock# / doiido/mongodb/bin/mongod-- config / doiido/mongodb/bin/mongodb.conf

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

Database

Wechat

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

12
Report