Mongodb平衡器有很大差异

时间:2013-08-04 09:53:40

标签: mongodb sharding

我有一个分片的mongo env,一切都很好,但最近我注意到了 碎片有很大的不同:

chunks:
            ProductionShardC    939
            ProductionShardB    986
            ProductionShardA    855
            edPrimaryShard  1204

平衡器正在运行,我也可以在锁中看到它:

db.locks.find( { _id : "balancer" } ).pretty()

{
"_id" : "balancer",
"process" : "ip-10-0-0-100:27017:1371132087:1804289383",
"state" : 2,
"ts" : ObjectId("51e1e5d75e1777de5f007ea5"),
"when" : ISODate("2013-07-13T23:42:15.660Z"),
"who" : "ip-10-0-0-100:27017:1371132087:1804289383:Balancer:846930886",
"why" : "doing balance round"
}

这是mongos的/var/log/mongo/mongos.log

 cat mongos.log 
Sun Aug  4 15:33:29.859 [mongosMain] MongoS version 2.4.4 starting: pid=8520 port=27017 64-bit host=ip-10-0-0-100 (--help for usage)
Sun Aug  4 15:33:29.859 [mongosMain] git version: 4ec1fb96702c9d4c57b1e06dd34eb73a16e407d2
Sun Aug  4 15:33:29.859 [mongosMain] build info: Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Sun Aug  4 15:33:29.859 [mongosMain] options: { configdb: "10.0.1.200:27019,10.0.1.201:27019,10.0.1.202:27019", keyFile: "/media/Data/db/mongoKeyFile", logpath: "/var/log/mongo/mongos.log" }
Sun Aug  4 15:33:30.078 [mongosMain] SyncClusterConnection connecting to [10.0.1.200:27019]
Sun Aug  4 15:33:30.079 [mongosMain] SyncClusterConnection connecting to [10.0.1.201:27019]
Sun Aug  4 15:33:30.080 [mongosMain] SyncClusterConnection connecting to [10.0.1.202:27019]
Sun Aug  4 15:33:30.092 [mongosMain] SyncClusterConnection connecting to [10.0.1.200:27019]
Sun Aug  4 15:33:30.093 [mongosMain] SyncClusterConnection connecting to [10.0.1.201:27019]
Sun Aug  4 15:33:30.093 [mongosMain] SyncClusterConnection connecting to [10.0.1.202:27019]
Sun Aug  4 15:33:30.809 [mongosMain] waiting for connections on port 27017
Sun Aug  4 15:33:30.809 [Balancer] about to contact config servers and shards
Sun Aug  4 15:33:30.810 [websvr] admin web console waiting for connections on port 28017
Sun Aug  4 15:33:30.810 [Balancer] starting new replica set monitor for replica set edPrimaryShard with seed of 10.0.1.150:27017,10.0.1.151:27017,10.0.1.152:27017
Sun Aug  4 15:33:30.811 [Balancer] successfully connected to seed 10.0.1.150:27017 for replica set edPrimaryShard
Sun Aug  4 15:33:30.811 [Balancer] changing hosts to { 0: "10.0.1.150:27017", 1: "10.0.1.152:27017", 2: "10.0.1.151:27017" } from edPrimaryShard/
Sun Aug  4 15:33:30.811 [Balancer] trying to add new host 10.0.1.150:27017 to replica set edPrimaryShard
Sun Aug  4 15:33:30.812 [Balancer] successfully connected to new host 10.0.1.150:27017 in replica set edPrimaryShard
Sun Aug  4 15:33:30.812 [Balancer] trying to add new host 10.0.1.151:27017 to replica set edPrimaryShard
Sun Aug  4 15:33:30.813 [Balancer] successfully connected to new host 10.0.1.151:27017 in replica set edPrimaryShard
Sun Aug  4 15:33:30.813 [Balancer] trying to add new host 10.0.1.152:27017 to replica set edPrimaryShard
Sun Aug  4 15:33:30.813 [Balancer] successfully connected to new host 10.0.1.152:27017 in replica set edPrimaryShard
Sun Aug  4 15:33:31.013 [Balancer] Primary for replica set edPrimaryShard changed to 10.0.1.150:27017
Sun Aug  4 15:33:31.019 [Balancer] replica set monitor for replica set edPrimaryShard started, address is edPrimaryShard/10.0.1.150:27017,10.0.1.151:27017,10.0.1.152:27017
Sun Aug  4 15:33:31.019 [ReplicaSetMonitorWatcher] starting
Sun Aug  4 15:33:31.021 [Balancer] starting new replica set monitor for replica set ProductionShardA with seed of 10.0.1.160:27017,10.0.1.161:27017,10.0.1.162:27017
Sun Aug  4 15:33:31.021 [Balancer] successfully connected to seed 10.0.1.160:27017 for replica set ProductionShardA
Sun Aug  4 15:33:31.022 [Balancer] changing hosts to { 0: "10.0.1.160:27017", 1: "10.0.1.162:27017", 2: "10.0.1.161:27017" } from ProductionShardA/
Sun Aug  4 15:33:31.022 [Balancer] trying to add new host 10.0.1.160:27017 to replica set ProductionShardA
Sun Aug  4 15:33:31.022 [Balancer] successfully connected to new host 10.0.1.160:27017 in replica set ProductionShardA
Sun Aug  4 15:33:31.022 [Balancer] trying to add new host 10.0.1.161:27017 to replica set ProductionShardA
Sun Aug  4 15:33:31.023 [Balancer] successfully connected to new host 10.0.1.161:27017 in replica set ProductionShardA
Sun Aug  4 15:33:31.023 [Balancer] trying to add new host 10.0.1.162:27017 to replica set ProductionShardA
Sun Aug  4 15:33:31.024 [Balancer] successfully connected to new host 10.0.1.162:27017 in replica set ProductionShardA
Sun Aug  4 15:33:31.187 [Balancer] Primary for replica set ProductionShardA changed to 10.0.1.160:27017
Sun Aug  4 15:33:31.232 [Balancer] replica set monitor for replica set ProductionShardA started, address is ProductionShardA/10.0.1.160:27017,10.0.1.161:27017,10.0.1.162:27017
Sun Aug  4 15:33:31.234 [Balancer] starting new replica set monitor for replica set ProductionShardB with seed of 10.0.1.170:27017,10.0.1.171:27017,10.0.1.172:27017
Sun Aug  4 15:33:31.235 [Balancer] successfully connected to seed 10.0.1.170:27017 for replica set ProductionShardB
Sun Aug  4 15:33:31.237 [Balancer] changing hosts to { 0: "10.0.1.170:27017", 1: "10.0.1.172:27017", 2: "10.0.1.171:27017" } from ProductionShardB/
Sun Aug  4 15:33:31.237 [Balancer] trying to add new host 10.0.1.170:27017 to replica set ProductionShardB
Sun Aug  4 15:33:31.237 [Balancer] successfully connected to new host 10.0.1.170:27017 in replica set ProductionShardB
Sun Aug  4 15:33:31.237 [Balancer] trying to add new host 10.0.1.171:27017 to replica set ProductionShardB
Sun Aug  4 15:33:31.238 [Balancer] successfully connected to new host 10.0.1.171:27017 in replica set ProductionShardB
Sun Aug  4 15:33:31.238 [Balancer] trying to add new host 10.0.1.172:27017 to replica set ProductionShardB
Sun Aug  4 15:33:31.238 [Balancer] successfully connected to new host 10.0.1.172:27017 in replica set ProductionShardB
Sun Aug  4 15:33:31.361 [Balancer] Primary for replica set ProductionShardB changed to 10.0.1.170:27017
Sun Aug  4 15:33:31.379 [Balancer] replica set monitor for replica set ProductionShardB started, address is ProductionShardB/10.0.1.170:27017,10.0.1.171:27017,10.0.1.172:27017
Sun Aug  4 15:33:31.383 [Balancer] starting new replica set monitor for replica set ProductionShardC with seed of 10.0.1.180:27017,10.0.1.181:27017,10.0.1.182:27017
Sun Aug  4 15:33:31.383 [Balancer] successfully connected to seed 10.0.1.180:27017 for replica set ProductionShardC
Sun Aug  4 15:33:31.384 [Balancer] changing hosts to { 0: "10.0.1.180:27017", 1: "10.0.1.182:27017", 2: "10.0.1.181:27017" } from ProductionShardC/
Sun Aug  4 15:33:31.384 [Balancer] trying to add new host 10.0.1.180:27017 to replica set ProductionShardC
Sun Aug  4 15:33:31.385 [Balancer] successfully connected to new host 10.0.1.180:27017 in replica set ProductionShardC
Sun Aug  4 15:33:31.385 [Balancer] trying to add new host 10.0.1.181:27017 to replica set ProductionShardC
Sun Aug  4 15:33:31.385 [Balancer] successfully connected to new host 10.0.1.181:27017 in replica set ProductionShardC
Sun Aug  4 15:33:31.385 [Balancer] trying to add new host 10.0.1.182:27017 to replica set ProductionShardC
Sun Aug  4 15:33:31.386 [Balancer] successfully connected to new host 10.0.1.182:27017 in replica set ProductionShardC
Sun Aug  4 15:33:31.499 [Balancer] Primary for replica set ProductionShardC changed to 10.0.1.180:27017
Sun Aug  4 15:33:31.510 [Balancer] replica set monitor for replica set ProductionShardC started, address is ProductionShardC/10.0.1.180:27017,10.0.1.181:27017,10.0.1.182:27017
Sun Aug  4 15:33:31.513 [Balancer] config servers and shards contacted successfully
Sun Aug  4 15:33:31.513 [Balancer] balancer id: ip-10-0-0-100:27017 started at Aug  4 15:33:31
Sun Aug  4 15:33:31.513 [Balancer] SyncClusterConnection connecting to [10.0.1.200:27019]
Sun Aug  4 15:33:31.514 [Balancer] SyncClusterConnection connecting to [10.0.1.201:27019]
Sun Aug  4 15:33:31.514 [Balancer] SyncClusterConnection connecting to [10.0.1.202:27019]
Sun Aug  4 15:33:31.537 [LockPinger] creating distributed lock ping thread for 10.0.1.200:27019,10.0.1.201:27019,10.0.1.202:27019 and process ip-10-0-0-100:27017:1375619611:1804289383 (sleeping for 30000ms)
Sun Aug  4 15:33:35.777 [mongosMain] connection accepted from 84.108.44.142:50916 #1 (1 connection now open)
Sun Aug  4 15:33:35.963 [conn1]  authenticate db: admin { authenticate: 1, user: "root", nonce: "50c90ba9496d0a2d", key: "52390c478fffe89d03b776dd14e7c0d6" }
Sun Aug  4 15:33:37.704 [conn1] ChunkManager: time to load chunks for profiles.devices: 104ms sequenceNumber: 2 version: 2898|1177||51bb0e3a5e1777de5ffbf898 based on: (empty)
Sun Aug  4 15:33:37.712 [conn1] ChunkManager: time to load chunks for profiles.user_devices: 4ms sequenceNumber: 3 version: 92|25||51bb10be5e1777de5ffbf8d5 based on: (empty)
Sun Aug  4 15:33:37.715 [conn1] creating WriteBackListener for: 10.0.1.150:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:37.715 [conn1] creating WriteBackListener for: 10.0.1.151:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:37.715 [conn1] creating WriteBackListener for: 10.0.1.152:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:37.718 [conn1] creating WriteBackListener for: 10.0.1.160:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:37.718 [conn1] creating WriteBackListener for: 10.0.1.161:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:37.718 [conn1] creating WriteBackListener for: 10.0.1.162:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:37.722 [conn1] creating WriteBackListener for: 10.0.1.170:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:37.722 [conn1] creating WriteBackListener for: 10.0.1.171:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:37.722 [conn1] creating WriteBackListener for: 10.0.1.172:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:37.725 [conn1] creating WriteBackListener for: 10.0.1.180:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:37.725 [conn1] creating WriteBackListener for: 10.0.1.181:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:37.725 [conn1] creating WriteBackListener for: 10.0.1.182:27017 serverID: 51fe4a1a309fab9136fcd24a
Sun Aug  4 15:33:39.468 [conn1] warning: mongos collstats doesn't know about: systemFlags
Sun Aug  4 15:33:39.468 [conn1] warning: mongos collstats doesn't know about: userFlags
Sun Aug  4 15:33:39.469 [conn1] warning: mongos collstats doesn't know about: systemFlags
Sun Aug  4 15:33:39.469 [conn1] warning: mongos collstats doesn't know about: userFlags
Sun Aug  4 15:33:39.470 [conn1] warning: mongos collstats doesn't know about: systemFlags
Sun Aug  4 15:33:39.470 [conn1] warning: mongos collstats doesn't know about: userFlags
Sun Aug  4 15:33:39.470 [conn1] warning: mongos collstats doesn't know about: systemFlags
Sun Aug  4 15:33:39.470 [conn1] warning: mongos collstats doesn't know about: userFlags

为什么它有这么大的不同? 1个碎片有855个,另有1204个碎片 我该如何解决?

0 个答案:

没有答案