日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

MongoDB 常用故障排查工具

發布時間:2024/4/15 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MongoDB 常用故障排查工具 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

MongoDB 常用故障排查工具

1.profile
profiling levels

???????? 0,關閉profile1,只抓取slow查詢;2,抓取所有數據。

啟動profile并且設置Profile級別:

?????可以通過mongo shell啟動,也可以通過驅動中的profile命令啟動,啟動后記錄會被保存在system.profile collection下,可以使用db.setProfilingLevel來啟動。默認slow100???毫秒。db.setProfilingLevel可以有2個參數,第一個參數指定Profiling?級別,第二個參?????數指定slow閥值。

?????????檢查當前Profiling?級別:可以通過db.getProfilingStatus()獲取當前profiling級別,slowms??????標記慢查詢閥值。

?????????關閉Profiling還是使用db.setProfilingLevel(0)來關閉profiling

?????????整個實例開啟Profilingmongod --prifile=1 --slowms=15

???????? shardProfiling:對shardprofiling要對每一個實例進行profiling

查看Profiling數據

?????????可以直接在system.profilecollection上查看如:db.systen.profile.find()。或者使用show ?????? profile,會顯示最近至少1ms時間運行的前5條記錄。

Profiler概述

?????????要修改system.profile collection的大小必須:1.關閉profiling2.刪除system.profile3.然后重新創建system.profile4.重啟profile

???????? shell如下:db.setProfilingLevel(0)

???????? ,db.system.profile.drop()

???????? ,db.createCollect("system.profile",{cappedLtrue,size:4000000})

???????? ,db.setProfilingLevel(1)

2.Mongostat mongostat n?n:刷新秒數?反應當前mongod的負荷 http://docs.mongodb.org/manual/reference/program/mongostat/ ? ? inserts????? - # of inserts per second (* means replicated op)
query??????? - # of queries per second
update?????? - # of updates per second
delete?????? - # of deletes per second
getmore????? - # of get mores (cursor batch) per second
command????? - # of commands per second, on a slave its local|replicated
flushes????? - # of fsync flushes per second
mapped?????? - amount of data mmaped (total data size) megabytes
vsize??????? - virtual size of process in megabytes
res????????? - resident size of process in megabytes
faults?????? - # of pages faults per sec
locked?????? - name of and percent time for most locked database
idx miss???? - percent of btree page misses (sampled)
qr|qw??????? - queue lengths for clients waiting (read|write)
ar|aw??????? - active clients (read|write)
netIn??????? - network traffic in - bits
netOut?????? - network traffic out - bits
conn???????? - number of open connections
set????????? - replica set name
repl???????? - replication type
????????????????? PRI - primary (master)
????????????????? SEC - secondary
????????????????? REC - recovering
????????????????? UNK - unknown
????????????????? SLV - slave
????????????????? RTR - mongos process ("router")
? 3.Mongoop collection級別反應,讀寫的時間 http://docs.mongodb.org/manual/reference/program/mongotop/ mongotop -h 192.168.10.69 2,每間隔2秒返回一次結果 ? ? ? ? ? ? ? ? ? ? ?ns?????? total??????? read?????? write????????????? 2014-05-09T14:00:55
??? ub1405.system.users???????? 0ms???????? 0ms???????? 0ms
? ub1405.system.profile???????? 0ms???????? 0ms???????? 0ms
b1405.system.namespaces???????? 0ms???????? 0ms???????? 0ms
? ub1405.system.indexes???????? 0ms???????? 0ms???????? 0ms
??? ub1405.WapRecommend???????? 0ms???????? 0ms???????? 0ms
?? ub1405.VisitPageInfo???????? 0ms???????? 0ms???????? 0ms
?????? ub1405.UsageInfo???????? 0ms???????? 0ms???????? 0ms
???? ub1405.UpgradeInfo???????? 0ms???????? 0ms???????? 0ms
????????? ub1405.Switch???????? 0ms???????? 0ms???????? 0ms
?

?

4.mongoperf

用來測試io性能,可以用來做mongo的io壓力測試,和sql server的SQLIOSim http://docs.mongodb.org/manual/reference/program/mongoperf/ ? 5.?ServerStatus?db.serverStatus() ? 包含了很多信息

1.實例信息

2.

3.全局鎖

4.內存使用

5.連接

6.額外信息

7.索引計數器

8.cursors

9.網絡

10.復制集

11.復制集操作集數

12.操作計數器

13.斷言

14.writeBackQueued

15.Journal(dur)持久性

16.recordStats

17.工作集(workingSet

18.指標(metrics)

? 6.db.stats() ? 反應數據庫所占用的存儲 {
??????? "db" : "ub1405",
??????? "collections" : 17,
??????? "objects" : 9939344,
??????? "avgObjSize" : 336.2453477815035,
??????? "dataSize" : 3342058180,
??????? "storageSize" : 4501643264,
??????? "numExtents" : 111,
??????? "indexes" : 15,
??????? "indexSize" : 322633136,
??????? "fileSize" : 8519680000,
??????? "nsSizeMB" : 16,
??????? "dataFileVersion" : {
??????????????? "major" : 4,
??????????????? "minor" : 5
??????? },
??????? "ok" : 1
}
? 7.db.collection.stats() 返回collection的一些信息: {
??????? "ns" : "ub1405.WapRecommend",
??????? "count" : 514,
??????? "size" : 174416,
??????? "avgObjSize" : 339.3307392996109,
??????? "storageSize" : 430080,
??????? "numExtents" : 3,
??????? "nindexes" : 1,
??????? "lastExtentSize" : 327680,
??????? "paddingFactor" : 1,
??????? "systemFlags" : 1,
??????? "userFlags" : 0,
??????? "totalIndexSize" : 24528,
??????? "indexSizes" : {
??????????????? "_id_" : 24528
??????? },
??????? "ok" : 1
}

總結

以上是生活随笔為你收集整理的MongoDB 常用故障排查工具的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。