MongoDB introduction, installation, and setup of a simple mongoDB server (1 ).

Source: Internet
Author: User
Tags mongodb server mongorestore

MongoDB introduction, installation, and setup of a simple mongoDB server (1 ).

Related Websites

1. http://www.mongodb.org/official website, you can download the installation program, and doc, and driver. 2. http://www.mongoing.com/domestic official website, blog, questions and so on 3. http://docs.mongoing.com/manual-zh/ Chinese document translation. 4. https://github.com/mongodb GitHub source code, program source code, driver source code. And tools. (See all versions) 5. https://jira.mongodb.org MongoDB BUG feedback. 6. google groups: mongodb-user and mongo-cn
Compared with traditional databases (NoSql gave up the left-side feature. But the right side brings advantages)
Why MongoDB 1. no data structure restrictions 1. there is no table structure concept, and the daily records can have completely different structures. 2. convenient Business Development 3. SQL database needs to define the table structure before using 2. full index Support 1. redis key-value 2. hbase single index, headset index needs to be implemented by yourself
3. Convenient redundancy and expansion 1. Replica set to ensure data security 2. Expand data size in Parts

MongoDB installation environment: 32-bit LinuxMongoDB version: 2.6.5 (2: Major version; 6: Odd development version, even stable version; 5: minor version)
1. You can download the corresponding version from GitHub. Https://github.com/mongodb/mongo/tree/r2.6.5 (Baidu Network Disk link: http://pan.baidu.com/s/1kTGJBc7 password: k5x0)
Decompress, compile (go to the specified directory,-j 12 represents 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 link directly to the official website: http://pan.baidu.com/s/1c0GXQyG password: 0ax9
# Tar zxf mongodb-linux-i686-2.6.10.gz
: # Cd bin # lsbsondump mongod ‑export ‑import mongoperf mongos ‑topmongo ‑dump ‑files ‑oplog mongorestore ‑stat
The execution program mongod connects to the Mongo client of the mongo server to import and export mongoexport Export Import, which is similar to the import and export, but these two are binary data and cannot be directly read. It is generally used for data backup and recovery. Mongodump mongorestore for Operation Log playback mongooplog to view various statuses of mongostat
Build a simple mongoDB Server 1. first create a mongodb_simple directory and go to directory 2. create a folder: data, used to store database data files 3. create a folder: log, used to store the log files of the database 4. create a folder: bin to store executable files of the database. create a folder: conf to store database configuration files
[Root @ localhost test] # mkdir mongodb_simple
[Root @ localhost test] # cd mongodb_simple/
[Root @ localhost mongodb_simple] # mkdir data
[Root @ localhost mongodb_simple] # mkdir log
[Root @ localhost mongodb_simple] # mkdir conf
[Root @ localhost mongodb_simple] # mkdir bin
Copy compiled mongo to bin # cp/home/hadoop/Desktop/mongodb-linux-i686-2.6.10/bin/mongod bin/
Go to conf and edit the Startup File [root @ localhost mongodb_simple] # cd conf
[Root @ localhost conf] # vim mongod. confpath = 12345 dbpath = datalogpath = log/mongod. logfork = true
Save and exit. Note: the path of the logpath log file (to specify the actual file) in the data storage directory of the port listening port dbpath indicates that a background process is started.
Start,-f sets the configuration file to be executed at startup./bin/mongod-f conf/mongod. conf (the following method is used for failure)
The above cannot be started. You can use this to start it. /bin/mongod-dbpath =/test/mongodb_simple/data/-logpath =/test/mongodb_simple/log/mongod. log-port = 12345 -- fork
Started successfully.
Enter the data directory to view the initialized directories and files.
Log information can also be viewed under log tail.

Connect to the mongoDB server (easy to copy mongo to the previous bin) [root @ localhost mongodb_simple] # cp/home/hadoop/Desktop/mongodb-linux-i686-3.0.3/bin/mongo./bin
Connect to [root @ localhost momgodb_simple] #./bin/mongo 127.0.0.1: 12345/test
If you see the scissors, the request is successful. But there is a warning
Shut down the mongoDB service> db. shutdownServer () (you can also use kill-15 instead of-9) ctrl + c to exit. View log
You can see that it has exited.
Conclusion: MOOC

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.