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

Installation and configuration of MongoDB

2025-04-07 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. Its flexible data storage method is favored by current IT employees. Mongo DB well implements the object-oriented idea (OO idea). 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.

First, download

Note: official download address: http://www.mongodb.org/downloads

Choose the appropriate version to download according to your actual situation. My virtual machine is a 64-bit CentOS6.5, so I downloaded a version of MongoDB for Linux 64bit.

# cd / usr/local/src

# wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.5.tgz

II. Installation and configuration

OK, after downloading, I will prepare the environment and installation configuration.

# tar xzvf mongodb-linux-x86_64-2.6.5.tgz / / extract the downloaded package

# mkdir-p / apps

# mkdir-p / data/db

# mv mongodb-linux-x86_64-2.6.5 / apps/mongo

# mkdir-p / apps/mongo/logs

# touch / apps/mongo/logs/mongodb.log

# so the installation and configuration is finished! You sure? Yes, it's that simple!

3. Start MongoDB

Note: there are three ways to start MongoDB: command line, configuration file, Daemon and so on. Generally speaking, we choose the last one, as follows:

# / apps/mongo/bin/mongod-dbpath=/data/db-logpath=/apps/mongo/logs/mongodb.log-fork

Note: the default port of MongoDB is 27017 help. The Web port is based on it and has many parameters. You can change them according to your own needs. You can simply add the-parameter parameter to view the relevant parameters.

IV. Verification and testing

# netstat-tunlp | grep 27017

Tcp 0 0 0.0.0 0 27017 0.0.0 0 15 * LISTEN 1495/mongod

# / apps/mongo/bin/mongo

MongoDB shell version: 2.6.5

Connecting to: test

>

OK, at this point, your installation and configuration is successful. Start playing with your MongoDB!

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