Install mongoDB in Gentoolinux

Source: Internet
Author: User

Finally, Nosql products are used. We are using mongodb, which is currently popular. Of course it is not just a large stream, but a product that uses geospatial indexes.
This is my configuration process:

1, download the version you need, I use a mongodb-linux-x86_64-2.4.9.tgz

# wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.9.tgz# tar -xvzf mongodb-linux-x86_64-2.4.9.tgz
2. Create the mongodb directory and database directory.
# mv mongodb-linux-x86_64-2.4.9.tgz /opt/mongodb # mkdir -p /opt/mongodb/data
3. Added mongodb users.
# Useradd mongod-s/bin/false # chown-R mongod: mongod/data/mongodb 4. Write the configuration file and create the directory ext under/opt/mongodb:
#mkdir -p ext
Write:
#! /Bin/bash # file name: mongodb. conf # Configuration Options for MongoDB # For More Information, Consider: #-Configuration Parameters: http://www.mongodb.org/display/DOCS/Command+Line+Parameters#-File Based Configuration: http://www.mongodb.org/display/DOCS/File+Based+Configurationdbpath=/opt/mongodb/datalogpath=/opt/mongodb/data/mongodb.loglogappend=true# bind_ip = 127.0.0.1 # port = 27017 fork = tr Ueauth = true # noauth = true5. test: here, we can actually use mongodb, but the process is not started. Test:
#cd /opt/mongodb/bin
Here we can see mongo (this is mongodb shell) and mongod (this is the mongodb process)

6. Start the process:
In the/etc/init. d directory:
#vi mongodb

Write:
#! /Sbin/runscript # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $ Header: $ pai_home =/opt/mongodbdepend () {use net} start () {ebegin "Starting mongodb... "$ {pai_home}/bin/mongod \ -- config $ {MONGO_HOME}/ext/mongodb. conf eend $ ?} Stop () {ebegin "Stoping mongodb..." $ {MONGO_HOME}/bin/mongod \ -- shutdown \ -- config $ {MONGO_HOME}/ext/mongodb. conf eend $ ?} Restart () {start stop} ------------- OK. The configuration is complete.

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.