Installation and configuration of MongoDB for Linux services (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:

Tar xvf mongodb-linux-x86_64-2.6.7.tar #解压安装包 mkdir/usr/local/mongodb #创建mongodb文件夹 cd Mongodb-linu x-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:

Cd/usr/local/mongodb mkdir Data Touch logs

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

VI start_mongodb.sh #!/bin/bash/usr/local/mongodb/bin/mongod--dbpath=/usr/local/mongodb/data--l             Ogpath=/usr/local/mongodb/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

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

chmod +x start_mongodb.sh stop_mongodb.sh

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

SH start_mongodb.sh# will output MongoDB started! after successful execution

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

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.

/usr/local/mongodb/bin/mongo# into the MongoDB command line

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:

Installation and configuration of MongoDB for Linux services (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.