我正在使用Apache Ignite 2.8.0。 我已经开发了用于监控Ignite性能的小型仪表板。 现在,我的问题是查找服务器数量。 首先我找到了节点总数(在节点变量中),然后
total_servers = 0
port = 8080
for j in range(0,node + 1):
if(persistence == True):
url_cache = "http://localhost:" + str(port) + "/ignite?cmd=top&sessionToken=" +sessionToken
else:
url_cache = "http://localhost:" + str(port) + "/ignite?cmd=top"
try:
print(j)
try:
res = requests.get(url = url_cache)
print(res.status_code)
if(res.status_code == 200):
total_servers = total_servers + 1
except:
pass
except:
pass
port = port + 1
但是要花很多时间,我不想要那样。 是否有任何简单方法通过使用REST API http请求来查找在Apache Ignite中运行的服务器数量?
从REST,您可以运行SQL命令SELECT * FROM SYS.NODES;
来确定。