Windows and CentOS under MongoDB installation using

Source: Internet
Author: User
Tags create mongodb install mongodb

Official website: https://www.mongodb.org/downloadsversion: 2.6.10 (2. X final stable version)http://www.jb51.net/article/48217.htm (MongoDB Common Operations Command)http://snowolf.iteye.com/blog/1796749/(MongoDB crud)http://www.cnblogs.com/zengen/archive/2011/04/23/2025722.html (permissions, users)http://www.cnblogs.com/huangxincheng/archive/2012/02/18/2356595.html (a tutorial) Summary: Mongo DB is a non-relational database (NOSQL) that is currently very popular in the IT industry, and its flexible data storage methods are highly favored by current it practitioners. Mongo DB is a good implementation of object-oriented thinking (Oo idea), in Mongo db each record is a document object. The biggest advantage of Mongo DB is that no developer is required for all data persistence operations .manually write SQL statements, directly invoke the method can easily implement CRUD operations.  MongoDB Tool Class:

....

under Windows, register as a system service, using the configuration file method: Unfortunately, the official download of the installation package does not have a default configuration file, if you want to use the configuration file can only build one, and the other person also recommended to use the configuration file to manage MongoDB configuration, using the configuration file configuration database files, log files and other configuration is at a glance. First step: Unzip the directoryunpack the installation package to D:\mongodbset up the database directory D:\mongodb\dataCreate log directory D:\mongodb\logsCreate profile directory D:\mongodb\etcsetting up the configuration file D:\mongodb\etc\mongodb.conf Step Two: Configuration file mongodb.conf---------mongodb.conf Start---------------#数据库路径Dbpath=d:\mongodb\data#日志输出文件路径Logpath=d:\mongodb\logs\mongodb.log#错误日志采用追加模式, after configuring this option, the MongoDB log is appended to the existing log file instead of creating a new filelogappend=true#启用日志文件, enabled by defaultjournal=true#这个选项可以过滤掉一些无用的日志信息, set to False if you need to use debugquiet=true#端口号 defaults to 27017port=27017----------mongodb.conf Stop--------------
only a few common items are specified here, more detailed configuration please refer to the official text Step Three: Register/uninstall System services, start cmd normal start : # mongod--config D:\mongodb\etc\mongodb.conf  Install/Uninstall for Windows services, one way :# CD D:\mongodb\bin# mongod--config D:\mongodb\etc\mongodb.conf--install# Mongod--removeif the 2.6 version of this way in Win7, Win8 64-bit version can not be installed successfully, in the following way (start cmd as an administrator, try should be OK); Install as a Windows service, using SC installation, mode two :# sc Create MongoDB binpath= "D:\mongodb\bin\mongod.exe--service--config=d:\mongodb\etc\mongodb.conf"      start : # net start MongoDB        Viewer input http://localhost:27017/can see the display information: It looks like you is trying to access MongoDB over HTTP on the native driver Port. Indicates the installation was successful;
Fourth Step, test:# cd CD D:\MongoDB\bin# MONGO# >db.help (); View the DB function help
# >db.version (); View version# >show DBS; Querying all databases
# >use test; Switch database
# >db.getmongo (); View the link machine address of the current DB# >show Collections; View all the tables under the library
# >db.createcollection (' User_info ');//Create a new table (hint {' OK ': 1} indicates success)# >db.userinfo.find (); SELECT * FROM User_info# >db.userinfo.find ({"user_name": "Jack"}); SELECT * from user_info where user_name = ' Jack '; Some common operations, set up Super Administrator, new database, new table, CRUD, need to learn slowly later, do not repeat; under CentOS, install MongoDB, configure file Mode: # Cd/home/root/temp
# wget Https://fastdl.mongodb.org/linux/mongodb-linux-i686-2.6.10.tgz# TAR-ZXVF Mongodb-linux-i686-2.6.10.tgz# mv Mongodb-linux-i686-2.6.10/home/root# mkdir-p/home/root/mongodb-linux-i686-2.6.10/data# mkdir-p/home/root/mongodb-linux-i686-2.6.10/logs
# mkdir-p/home/root/mongodb-linux-i686-2.6.10/etc
# vi/home/root/mongodb-linux-i686-2.6.10/etc/mongodb.conf##################################数据文件存放目录
DBPath =/home/root/mongodb-linux-i686-2.6.10/data#日志文件存放目录
LogPath =/home/root/mongodb-linux-i686-2.6.10/logs/mongodb.log #端口port = 27017 #以守护程序的方式启用, that is, running fork in the background = True Nohttpint Erface = true################################ #关闭Http访问端口, after MongoDB installation, the default is the HTTP-enabled access port, which is 1000 larger than the port of MongoDB listening, that is, 28017  start from profile, run in background:#/home/root/mongodb-linux-i686-2.6.10/bin/mongod--config/home/root/mongodb-linux-i686-2.6.10/etc/ Mongodb.conf Boot start:# vi/etc/rc.d/rc.localAdd the following content:#/home/root/mongodb-linux-i686-2.6.10/bin/mongod--config/home/root/mongodb-linux-i686-2.6.10/etc/ Mongodb.conf  Test:#/home/root/mongodb-linux-i686-2.6.10/bin/mongo  Start Error Resolution: #./mongod:cannot Execute binary fileScenario One: Suspect file does not have Execute permissionAdd executable Permissions# chmod +x/home/root/mongodb-linux-i686-2.6.10/bin/mongod Scenario Two: Suspicion of server bits and the number of installation packages, inconsistent# cat/etc/redhat-release# File/bin/ls//Sure enough, download the 64-bit, install package for 32-bit 

Windows and CentOS under MongoDB installation using

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.