标签:
#linux 网络优化1. 文件中/etc/sysctl.conf, 加入
net.core.somaxconn = 2048
fs.file-max = 2000000
fs.nr_open = 2000000
net.ipv4.ip_local_port_range = 1024 65535
2. 文件/etc/security/limits.conf中加入:
3. mongo部分的优化
echo never >/sys/kernel/mm/transparent_hugepage/enabled
echo never > /sys/kernel/mm/transparent_hugepage/defrag
2. 加入PATH
vim /etc/profile
export PATH=$PATH:/tools/mongodb/bin
对于rpm包, 运行下面命令
rpm -ivh *.rpm
常见配置文件, 并启动
mongod --config configdb.conf
=====================================
https://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/
2. 启动
mongod --config configsrv1.conf
非文件方式
mongod --configsvr --replSet configReplSet --port <port> --dbpath <path>
2. 查看状态
rs.status()
2. 加入分片
// sh.addShard( "rs1/192.168.1.234:27018" ) // add a shard for a replica set named rs1
sh.addShard( "192.168.1.234:27018" )
sh.addShard( "192.168.1.234:27019" )
3. 激活分片
sh.enableSharding("<database>") // db.runCommand( { enableSharding: <database> } )
sh.enableSharding("mydb")
4. 查看状态
sh.status()
#########################
插入前的准备
sh.enableSharding("<database>") // db.runCommand( { enableSharding: <database> } )
sh.enableSharding("gwgps")
db.location.ensureIndex({"hostid":1})
db.location.ensureIndex({"posTime":1})
sh.shardCollection("gwgps.location", { "hostid": 1})
标签:
原文地址:http://www.cnblogs.com/myibm/p/5939328.html