mongodb 分片記錄

配置節點:mongodb

conf27917app

dbpath=/home/mongodb/confing/data
	replSet=configs
	port=27917
	fork=true
	configsvr=true

conf27918code

logpath=/home/mongodb/logs/confing27918.log
	dbpath=/home/mongodb/confing/data27918
	replSet=configs
	port=27918
	fork=true
	configsvr=true

經過admin 進入配置節點:ip

rs.reconfig({_id: 'configs', members: [{_id: 0, host: '192.168.78.30:27917'}, {_id: 1, host: '192.168.78.30:27918'}]})

路由節點路由

route27919class

port=27919
	logpath=/home/mongodb/logs/route.log
	logappend=true
	fork=true
	bind_ip = 0.0.0.0
	configdb=configs/192.168.78.30:27918,192.168.78.30:27917

添加分片配置配置

sh.addShard("192.168.78.30:27920")
	  sh.addShard("192.168.78.30:27921")

分片節點route

sd27920.cnfember

logpath=/home/mongodb/logs/sd27920.log
	dbpath=/home/mongodb/confing/data27920
	port=27920
	fork=true
	shardsvr=true

sd27921.cnfgdb

logpath=/home/mongodb/logs/sd27921.log
	dbpath=/home/mongodb/confing/data27921
	port=27921
	fork=true
	shardsvr=true
相關文章
相關標籤/搜索