MongoDB Introduction, installation, build a simple MongoDB server (a)

Source: Internet
Author: User
Tags connect mongo log log mongodb server mongodump mongorestore


Related Websites
1.http://www.mongodb.org/ official website, you can download the installer, and doc, and driver etc. 2.http://www.mongoing.com/   Domestic official website, blog, problem talk etc 3.http://docs.mongoing.com/manual-zh/   translation of Chinese documents. 4.Https://github.com/mongodb   GitHub source code, program source code, drive source code. and tools. (All versions can be seen) 5.https://jira.mongodb.org   MongoDB Bug feedback. 6. Google Groups:mongodb-user and MONGO-CN
comparison with traditional databases(NoSQL abandons the function on the left.) But the right side brings advantages)
Why use MongoDB1. No data structure limit 1. Without the concept of a table structure, a daily record can have a completely different structure 2. Easy and quick business development 3. SQL database needs to implement the definition table structure and then use 2. Full index support 1. Redis's Key-value 2. Single index of HBase, headset index needs to be implemented by itself
3. Convenient redundancy and expansion 1. Replication sets guarantee data security 2. Shard Scale Data size

MongoDB InstallationBad: 32-bit LINUXMONGODB version: 2.6.5 (2: Large version; 6: Odd development version, even stable version; 5: minor version)
1. You can download the appropriate version to GitHub. https://github.com/mongodb/mongo/tree/r2.6.5 (Baidu Network diskLinks:Http://pan.baidu.com/s/1kTGJBc7Password: k5x0)
Unzip, compile (go to the specified directory,-j 12 for multi-core Accelerated compilation speed) # Unzip mongo-r2.6.5.zip# CD mongo-r2.6.5# scons all-j 12
2. You can also download the compiled binary directly to the website.Links:Http://pan.baidu.com/s/1c0GXQyGPassword: 0ax9
# tar zxf mongodb-linux-i686-2.6.10.gz
Description: # cd bin# lsbsondump mongod mongoexport mongoimport mongoperf mongos Mongotopmongo mongodump mongof Iles Mongooplog Mongorestore Mongostat
Execute program mongod connect MONGO Server client MONGO Import Export Mongoexport Mongoimport is similar to import export, except that these two are binary data and cannot be read directly. Generally used to do backup and recovery of data. Mongodump Mongorestore do the playback of the operation Log Mongooplog view various states Mongostat
build a simple MongoDB server1. First create a mongodb_simple directory and go to directory 2. Create folder: Data, which is used to store the database file 3. Create folder: Log, which is used to store the database 4. Create folder: Bin, the executable file used to store the database 5. Create folder: conf, the configuration file used to store the database
[[email protected]test]# mkdir Mongodb_simple
[[email protected]test]# CD mongodb_simple/
[[email protected]mongodb_simple]# mkdir Data
[[email protected]mongodb_simple]# mkdir Log
[[email protected]mongodb_simple]# mkdir conf
[[email protected]mongodb_simple]# MkDir Bin
Copy the compiled MONGO to the bin # Cp/home/hadoop/desktop/mongodb-linux-i686-2.6.10/bin/mongod bin/
Enter conf, edit startup file [[email protected]mongodb_simple]# CD conf
[[email protected]conf]# Vim Mongod.confpath = 12345dbpath = Datalogpath = Log/mongod.logfork = True
Save exit. Description: Port listening ports DBPath data store directory logpath log file path (to indicate the actual file) fork means start a background process
start,-F sets the configuration file to be executed at startup./bin/mongod-f conf/mongod.conf (failure using the following method)
It's not going to start, so you can start with this./bin/mongod-dbpath=/test/mongodb_simple/data/-logpath=/test/mongodb_simple/log/mongod.log-port= 12345--fork
successfully started.
Enter the data directory to see the initialized directories and files
Log information can also be seen under log tail.

Connect to a MongoDB serverconnection (for easy use, copy the MONGO to the previous bin)[[email protected]mongodb_simple]# Cp/home/hadoop/desktop/mongodb-linux-i686-3.0.3/bin/mongo./bin
Connection[email protected]momgodb_simple]#./bin/mongo 127.0.0.1:12345/test
See the haircut to show success. But there's a warning.
Close MongoDB Service > Db.shutdownserver () (You can also use kill-15 do not use -9) Ctrl + C to exit. View the next log log
you can see that you have exited.
Collation Summary reference from: MU class network

MongoDB Introduction, installation, build a simple MongoDB server (a)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.