mongodb 服务器时区设置_关于MongoDB-Balancer设置时间窗口的问题

本文记录了在MongoDB 3.0.2版本中设置Balancer时间窗口为12:00-12:10的过程,并描述了在非设定时间内自动启动Balancer导致的数据库性能问题。在插入大量数据后,Balancer在凌晨23:29开始迁移操作,导致服务器卡顿,一个moveChunk操作运行了52415秒,影响了系统正常运行。
摘要由CSDN通过智能技术生成

##7月1日19点过5分,设置时间窗口为12:00-12:10

[mongodb@cst ~]$ date

Wed Jul 1 19:05:41 CST 2015

[mongodb@cst ~]$ /home/mongodb/mongodb3.0.2/bin/mongo –port=30000

MongoDB shell version: 3.0.2

connecting to: 127.0.0.1:30000/test

mongos> use config

switched to db config

mongos> sh.setBalancerState(true)

mongos> db.settings.update({ _id :”balancer” }, { $set : { activeWindow : { start :”12:00″, stop :”12:10″ } } }, true )

WriteResult({ “nMatched” : 1, “nUpserted” : 0, “nModified” : 1 })

mongos> db.settings.find()

{ “_id” : “chunksize”, “value” : 64 }

{ “_id” : “balancer”, “stopped” : false, “activeWindow” : { “start” : “12:00”, “stop” : “12:10” } }

mongos>

##此时balancer状态和数据块状态如下,数据库无任何增删改查操作:

balancer:

Currently enabled: yes

Currently running: no

Balancer active window is set between 12:00 and 12:10 server local time

Failed balancer rounds in last 5 attempts: 0

Migration Results for the last 24 hours:

No recent migrations

wy_test.Test

shard key: { “number” : “hashed” }

chunks:

rs172

rs272

rs372

too many chunks to print, use verbose if you want to force print

{ “_id” : “test”, “partitioned” : false, “primary” : “rs3” }

##向数据库insert30000000条数据

##期间由于工作原因,没有查看其状态。

##7月2日上午11点多查看状态。

balancer:

Currently enabled: yes

Currently running: yes

Balancer lock taken at Wed Jul 01 2015 23:29:05 GMT+0800 (CST) by cst.test.111:30000:1435563620:1804289383:Balancer:846930886

Balancer active window is set between 12:00 and 12:10 server local time

Collections with active migrations:

wy_test.Test started at Wed Jul 01 2015 23:29:35 GMT+0800 (CST)

Failed balancer rounds in last 5 attempts: 0

Migration Results for the last 24 hours:

No recent migrations

{ “_id” : “wy_test”, “partitioned” : true, “primary” : “rs3” }

wy_test.Test

shard key: { “number” : “hashed” }

chunks:

rs176

rs274

rs376

too many chunks to print, use verbose if you want to force print

{ “_id” : “test”, “partitioned” : false, “primary” : “rs3”

##而且服务器变得很卡,查看currentOp中慢的操作发现:moveChunk运行了52415秒。

{

“desc” : “conn623”,

“threadId” : “0x31915260”,

“connectionId” : 623,

“opid” : “rs1:45011063”,

“active” : true,

“secs_running” : 52415,

“microsecs_running” : NumberLong(“52415931651”),

“op” : “query”,

“ns” : “wy_test.Test”,

“query” : {

“moveChunk” : “wy_test.Test”,

“from” : “rs1/172.16.5.110:27017,172.16.5.111:27017”,

“to” : “rs2/172.16.5.110:27018,172.16.5.112:27018”,

“fromShard” : “rs1”,

“toShard” : “rs2”,

“min” : {

“number” : { “$minKey” : 1 }

},

“max” : {

“number” : NumberLong(“-9153541293874985355”)

},

“maxChunkSizeBytes” : NumberLong(67108864),

“shardId” : “wy_test.Test-number_MinKey”,

“configdb” : “172.16.5.110:20000,172.16.5.111:20000,172.16.5.112:20000”,

“secondaryThrottle” : true,

“waitForDelete” : false,

“maxTimeMS” : 0,

“epoch” : ObjectId(“55910a2a2f531a312c7922ff”)

},

“client_s” : “172.16.5.111:55843”,

“msg” : “step 3 of 6”,

“numYields” : 1176,

“locks” : {

},

“waitingForLock” : false,

“lockStats” : {

“Global” : {

“acquireCount” : {

“r” : NumberLong(1177),

“w” : NumberLong(1),

“R” : NumberLong(1)

},

“acquireWaitCount” : {

“R” : NumberLong(1)

},

“timeAcquiringMicros” : {

“R” : NumberLong(81107)

}

},

“Database” : {

“acquireCount” : {

“r” : NumberLong(1177),

“w” : NumberLong(1)

}

},

“Collection” : {

“acquireCount” : {

“r” : NumberLong(1177),

“W” : NumberLong(1)

}

}

}

},

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值