通过mongoDB Java驱动程序获取mongoStat [英] Getting mongoStat through mongoDB Java driver

查看:73
本文介绍了通过mongoDB Java驱动程序获取mongoStat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以获取 mongostat 实用程序的结果,例如否.通过Java驱动程序进行查询/秒,插入/秒等操作. 我发现的一种方法是通过Mongo对象获取serverstatus:

Is there a way to get the results of the mongostat utility such as no. of queries/sec, inserts/sec, etc. through java driver. One way I find out was to get the serverstatus through the Mongo object as:

db.command("serverStatus")

然后获取到现在为止执行的查询总数,然后对其进行处理以每秒获取查询.

and then get the total queries performed till now and then manipulate it to get queries per second.

还有其他更好的方法来获取此信息吗?

Is there any other better way to get this information?

推荐答案

您可以使用Db.command("ServerStatus")函数获取服务器状态,并且可以继续进行轮询

You can use the Db.command("ServerStatus") function to get the Server Status and you can keep polling

这篇关于通过mongoDB Java驱动程序获取mongoStat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆