With Ruiy brother to play with it;
< One, initialize play turn mongodb>
1, turn off SELinux (Ruiy, according to experience, Red Hat's selinux erection is a mistake, remember that no matter what the structure of the first to shut down is it);
2, set iptables release port=27017;
3, download the software media wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.0.tgz;
4, installation;
Tar zxvf mongodb-linux-x86_64-2.6.0.tgz
MV Mongodb-linux-x86_64-2.6.0/usr/local/mongodb
Mkdir-p/home/data/mongodb/mongodb_data/
Mkdir-p/home/data/mongodb/mongodb_log/
5, command line start;
/usr/local/mongodb/bin/mongod--port 27017 --fork --dbpath=/home/data/mongodb/mongodb_data/-- Logpath=/home/data/mongodb/mongodb_log/mongodb.log--logappend
6, view 27017 port;
Netstat-nalp|grep 27017
7, into the human mongodb shell console;
cd/usr/local/mongodb/bin/
8. View available databases and switch databases (initialize with 2 databases local/admin) show DBS && use admin;
9,mongodb the shell console to shut down the database;
Db.shutdownserver ()
< Two, set up Database >
1. Setting up a MongoDB configuration file
Emacs/usr/local/mongodb/mongodb.conf
The contents are as follows
2. Start MongoDB based on the new configuration file
cd/usr/local/mongodb/bin/
./mongod--config/usr/local/mongodb/mongodb.conf
3, command line shutdown database
./mongo 127.0.0.1:27017/admin--eval "Db.shutdownserver ()"
4. Configure the MongoDB startup script
Vi/etc/rc.d/init.d/mongod
The contents are as follows
5, add Execute permissions
chmod +x/etc/rc.d/init.d/mongod
6, set boot Chkconfig mongod on
7, service-based MongoDB services start
Service Mongod Start
8, setting the MONGODB environment variable
Vi/etc/profile
Join
Export path= $PATH:/usr/local/mongodb/bin
9,source
Source/etc/profile
10,mongo in-person shell console
Simple test
As this article MongoDB can be done, please continue to focus on the HA environment is coming out;