Linux is divided into the following units
192.68. 68.89:790192.68. 68.89:890192.68. 68.89:990192.68. 68.89:1090
1. Use SSH to move the mongodb-linux-x86_64-3.0.6.tgz to the Linux/root
2. Unzip to/root/mongodb-3.0.6/
Tar zxf mongodb-linux-x86_64-3.0. 6. tgz
3. Add the data and log folders
mkdir Datemkdir Log
4. Add Logs.log to the log folder
Touch Logs.log
5. Create a file/root/mongodb-3.0.6/mongodb.conf
6. Create a file/root/mongostar.sh put it anywhere.
777 mongostar.sh
7. Turn off MongoDB
Pkill MONGO
8. Check if MONGO is turned off
Ps-ef|grep MONGO
9. sharding
Log on to the Linux MONGOs
CD//root/mongodb-3.0. 6/bin. 27017 Mongosuse Admin
Db.runcommand ({addshard: "192.68.68.89:990"})
Db.runcommand ({addshard: "192.68.68.89:1090"})
Mongodb.conf
1.mongos
port=27017 #端口 logpath=/root/mongodb-3.0. 6/log/logs.log #日志文件存放目录 logappend=true #使用追加的方式写日志 Fork=true #以守护程序的方式启用, that is, run configdb=192.68in the background. 68.89:890 #config服务器地址
2.mongocfg
port=27017 #端口 dbpath=/root/mongodb-3.0. 6/data #数据文件存放目录 logpath=/root/mongodb-3.0. 6/log/logs.log #日志文件存放目录 logappend=true #使用追加的方式写日志 Fork=true #以守护程序的方式启用, which is running in the background configsvr=true #config服务器
3.mongod
port=27017 #端口 dbpath=/root/mongodb-3.0. 6/data #数据文件存放目录 logpath=/root/mongodb-3.0. 6/log/logs.log #日志文件存放目录 logappend=true #使用追加的方式写日志 Fork=true #以守护程序的方式启用, which runs in the background
mongostar.sh
MONGOs
/root/mongodb-3.0.6/bin/mongos-f/root/mongodb-3.0.6/mongodb.conf
Other
/root/mongodb-3.0. 6/bin/mongod-f/root/mongodb-3.0. 6/mongodb.conf
MONGO Learning Note (vi): Build on Linux