我正在尝试查看在任何给定时间有多少客户端连接到 Gemfire 服务器。我currentClientConnections
在文档中找到了,但不清楚如何读取这些数据。我尝试运行 VMWare VSD,但它在 Windows 下启动时崩溃。
任何想法如何访问这些数据?
您可以使用show metrics
GemFire Shellgfsh
中的命令来获取 currentClientConnections,如下所示:
gfsh>show metrics --member=serv1 --port=40404
您可以在输出的缓存服务器部分看到 currentClientConnections:
<snip>
cache-server | clientConnectionCount | 0
| hostnameForClients |
| getRequestAvgLatency | 0
| putRequestAvgLatency | 0
| totalConnectionsTimedOut | 0
<snip>
更多信息gfsh
可以在文档中找到。
您还可以使用 JConsole 或其他 JMX 客户端通过 JMX 访问此信息。如果您直接连接到服务器节点,则可以访问该服务器的 GemFire MBean。如果您连接到 GemFire JMX Manager 节点(默认为 Locator),那么您将看到每个服务器节点的 DistributedMXBean 以及 MemberMXBeans 和 CacheServerMXBeans。
+GemFire
+Distributed [1]
+System --> DistributedSystemMXBean [2]
...getNumClients() [3]
+Member [4]
+member1 --> MemberMXBean [5]
+member2 --> MemberMXBean [5]
+CacheServer
+2090
+member1 --> CacheServerMXBean [6]
..getClientConnectionCount() [7]
+2091
+member2 --> CacheServerMXBean [6]
..getClientConnectionCount() [7]
[1] these MBeans are viewable only in the JMX Manager (Locator by default)
[2] ObjectName is GemFire:service=System,type=Distributed
[3] returns the total number of client connections across the entire cluster
(number of client connections, not the number of unique clients)
[4] these MBeans are viewable in each server node as well as federated in the JMX Manager (Locator by default)
[5] ObjectName is GemFire:type=Member,member={0}
[6] ObjectName is GemFire:service=CacheServer,port={0},type=Member,member={1}
[7] returns the number of client connections for this server
以下命令行对我有用:
watch -n1 "gemfire stats -archive=logs/server/stats/gemfire_stats.gfs | grep -i currentClientConnections"
意思是,它列出了所有统计信息,只打印 的值currentClientConnections
,并每秒重复该过程。