Linux installation and configuration mongodb method

  

mongodb is a non-relational database, a lot of people use, the installation under Linux is not simple, many users have suffered some hardships in the Linux system installation and configuration mongodb, the following small series I will introduce you to the installation and configuration method of mongodb.

1. download the package

wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.2.tgz

Unzip the compressed package after the download is complete

tar zxf mongodb-linux-i686-1.8.2.tgz

2. Prepare for installation

Move mongodb to /usr/local /server/mongdb folder

mv mongodb-linux-i686-1.4.4 /usr/local/mongodb

Creating database folders and log files

mkdir /usr /local/mongodb/data

touch /usr/local/mongodb/logs

3. Set boot from boot

Add mongodb boot project to rc.local to ensure mongodb Start when the server is powered on

echo “/usr/local/server/mongodb/bin/mongod –dbpath=/usr/local/server/mongodb/data –

logpath= /usr/local/server/mongodb/logs –logappend –auth –port=27017″ 》” /etc/rc.local

echo “/usr/local/mongodb/bin/mongod &ndash ;dbpath=/usr/local/mongodb/data –

logpat h=/usr/local/mongodb/logs –logappend –auth –port=27017″ 》” /etc/rc.local

4. Start mongodb

cd to mongodb directory The bin folder under the start mongodb

//The following is the login method that requires permission. The user connection requires a username and password

/usr/local/server/mongodb/bin/mongod – Dbpath=/usr/local/server/mongodb/data –

logpath=/usr/local/server/mongodb/logs –logappend –auth –port=27017 –fork

//This is a password that does not require a password

/usr/local/server/mongodb/bin/mongod –dbpath=/usr/local/server/mongodb/data –

Logpath=/usr/local/server/mongodb/logs –logappend –port=27017 –fork

5. Parameter Explanation: –dbpath Database Path (Data File)

&ndash ;logpath log file path

–master specified as the primary machine

–slave specified as slave

–source The IP address of the host

–pologSize specifies that the log file size does not exceed 64M. Because resync is very computationally intensive and time consuming, it is best to avoid by setting a large enough

oplogSize Resync (the default oplog size is 5% of the free disk size).

–logappend Add

–port at the end of the log file Enable port number

–fork Run in the background

–only Specify which to copy only A database

–slavedelay refers to the time interval from replication detection

–auth whether to verify the permission login (username and password)

-h [ --help ] Show this usage information

–version show version information

-f [ --config ] arg configuration file specifying additional options

–port arg specify port number

–bind_ip arg local ip address to bind listener – all local ips

bound by default

-v [ --verbose ] be more verbose (include multiple times for more

verbosity eg -vvvvv)

–dbpath arg (=/data/db/) directory for datafiles Specify data storage directory

–quiet quieter output Silent mode< Br>

&ndash ;logpath arg file to send all output to instead of stdout Specify the log storage directory

–logappend appnd to logpath instead of over-writing Specify whether the log is appended or overridden

Write to log file
Previous12Next page Total 2 pages

Copyright © Windows knowledge All Rights Reserved