Phần 4 Monitoring trên MongoDB

Phần 4 Monitoring trên MongoDB

1./ Free Monitoring trên MongoDB

db.enableFreeMonitoring()

#

rs0:PRIMARY> db.enableFreeMonitoring()

{

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "state" : "enabled",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "message" : "To see your monitoring data, navigate to the unique URL below. Anyone you share the URL with will also be able to view this page. You can disable monitoring at any time by running db.disableFreeMonitoring().",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "url" : "https://cloud.mongodb.com/freemonitoring/cluster/SWD5QSOP3SSJBHBQQ72JTF3EM6CXGYBE",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "userReminder" : "",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "ok" : 1,

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "$clusterTime" : {

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "clusterTime" : Timestamp(1645613943, 1),

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "signature" : {

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "keyId" : NumberLong(0)

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ }

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ },

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "operationTime" : Timestamp(1645613943, 1)

}

 

db.enableFreeMonitoring()

rs0:PRIMARY> db.enableFreeMonitoring()

{

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "state" : "enabled",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "message" : "To see your monitoring data, navigate to the unique URL below. Anyone you share the URL with will also be able to view this page. You can disable monitoring at any time by running db.disableFreeMonitoring().",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "url" : "https://cloud.mongodb.com/freemonitoring/cluster/SWD5QSOP3SSJBHBQQ72JTF3EM6CXGYBE",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "userReminder" : "",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "ok" : 1,

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "$clusterTime" : {

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "clusterTime" : Timestamp(1645614111, 1),

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "signature" : {

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "keyId" : NumberLong(0)

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ }

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ },

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "operationTime" : Timestamp(1645614111, 1)

}

Để kiểm tra

rs0:PRIMARY> db.getFreeMonitoringStatus()​​ 

{

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "state" : "enabled",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "message" : "To see your monitoring data, navigate to the unique URL below. Anyone you share the URL with will also be able to view this page. You can disable monitoring at any time by running db.disableFreeMonitoring().",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "url" : "https://cloud.mongodb.com/freemonitoring/cluster/SWD5QSOP3SSJBHBQQ72JTF3EM6CXGYBE",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "userReminder" : "Free Monitoring URL:\nhttps://cloud.mongodb.com/freemonitoring/cluster/SWD5QSOP3SSJBHBQQ72JTF3EM6CXGYBE",

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "ok" : 1,

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "$clusterTime" : {

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "clusterTime" : Timestamp(1645614185, 1),

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "signature" : {

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "keyId" : NumberLong(0)

 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ }

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ },

 ​​ ​​ ​​ ​​ ​​ ​​ ​​​​ "operationTime" : Timestamp(1645614185, 1)

}

Truy cập

https://cloud.mongodb.com/freemonitoring/cluster/SWD5QSOP3SSJBHBQQ72JTF3EM6CXGYBE

https://docs.mongodb.com/manual/reference/method/db.enableFreeMonitoring/#mongodb-method-db.enableFreeMonitoring

 

#

2./ Tool Monitor MongoDB Performance

2.1/ Mongostat

mongostat -u "root" -p '=@!#@%$admin1' --authenticationDatabase "admin"

 

#​​ mongostat -u "mgadmin" -p 'mgpass1234321'​​ --authenticationDatabase "admin"

2.2/ Mongotop

#​​ mongotop​​ -u "mgadmin" -p 'mgpass1234321'​​ --authenticationDatabase "admin"

 

 

 

 

 

Tham khảo

https://www.tecmint.com/monitor-mongodb-performance/

SaKuRai

Xin chào, Mình là Sakurai. Blog này là nơi để note lại và chia sẻ những kiến thức, kinh nghiệm mà mình và anh em trong Team. Cảm ơn các bạn đã quan tâm theo dõi!

You may also like...

Leave a Reply