Installing MongoDB under CentOS

Source: Internet
Author: User
Tags install mongodb stop script

MongoDB is a nosql type of database, high-performance, easy to deploy, easy to use features in the IT industry is very popular.

The following describes the installation of MongoDB, here we are installed under Linux, using the centos6.4 64-bit, you can download the corresponding installation package on the official website, the official site is https://www.mongodb.org/, can also be downloaded on my network disk, 64-bit and 32-bit installation packages are available, as well as a Mongovue, visual MongoDB management tool with a network address of: Http://pan.baidu.com/s/1c0ocQFu. Windows installation can refer to: http://www.cnblogs.com/huangxincheng/archive/2012/02/18/2356595.html 1, first look at their system is 32-bit or 64-bit, Use uname-a can see the number of bits of the operating system, if there are 64 of the typeface is 64 bits, if not 32 bits, and then download the corresponding installation package;

1, upload the installation package to the Linux server, unzip, and then we install MongoDB into the/usr/local/mongodb directory, in/usr/local/create a MongoDB folder, Then copy the contents of the MongoDB installation package just extracted to the/usr/local/mongodb directory, the command is as follows:

1234 tar xvf mongodb-linux-x86_64-2.6.7.tar #解压安装包 mkdir /usr/local/mongodb #创建mongodb文件夹 CD MongoDB-linux-x86_64-2.6.7 #进去安装包目录 CP -RF * /usr/local/MongoDB #把安装包的内容复制到/usr/local/mongodb

2, create a folder to store MongoDB data and log file logs, the command is as follows:

123 cd /usr/local/mongodb             mkdir Data Touch Logs

3. Start MongoDB, write a startup script and close the script

12345 vi start_mongodb. SH #!/bin/bash/Usr/Local/Mongodb/Bin/Mongod--dbpath=/usr/local/mongodb/data --logpath=/usr/ local/mongodb/< Span class= "crayon-i" >logs --logappend  --port=27017 --fork echo ' MongoDB started! ' #如果是32位的系统, you will be prompted to add--journal on the startup parameters, plus you can

Then save and write a stop script.

--dbpath means to specify the folder where the data is stored

--logpath means to specify the log storage file

--logappend means that logs are generated in an incremental manner.

--PORT Specifies the port, if not written, the default is 27017

--fork to run on behalf of the background

1234 vi stop_mongodb. SH #!/bin/bash /usr/local/MongoDB/bin/mongod --shutdown --DBPath /usr/local/MongoDB/data/ echo ' MongoDB stoped '

Save and then assign the two scripts to the permissions that can be executed

1 chmod +x start_mongodb. SH stop_mongodb. SH

4, MongoDB installation is complete, now execute startup script start MongoDB

1 sh start_mongodb. SH#执行成功后会输出mongodb started!

Then look at the process and whether there is a MongoDB process

1 PS -EF| grep mongodb

You can see that there's a mongodb process, and it's started successfully.

5, enter the MongoDB command line, you can see the version of MongoDB information and Input MongoDB command.

1 /usr/local/MongoDB/bin/MONGO#进入mongodb命令行

6, MongoDB installed successfully, if the command line operation is not convenient, you can download Mongovue visualization tool, Operation MongoDB, installation package in the above network disk link, decompression can be used, after the installation is completed input IP and port connection, the default no account password, The Mongovue interface is as follows:

Installing MongoDB under CentOS

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.