Installing MongoDB under CENTOS7

Source: Internet
Author: User
Tags install mongodb stop script

MongoDB Network Disk Path: Link: https://pan.baidu.com/s/1rWJCPZ59EAW25ha1UF5czw Password: u3zq

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:

RZ upload

Yum Install Lrzsz

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 that stores MongoDB data and log file logs, with the following command: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 --logpath=/usr/ local/mongodb/< Span class= "crayon-i" >logs --logappend  --port=27017 --FORK&NBSP; 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 MongoDBsh start_mongodb. SH#执行成功后会输出mongodb started! then look at the process and whether there is a MongoDB processPS -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#进入mongodb命令行

Installing MongoDB under CENTOS7

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.