我正在尝试使用 stackexchange 库在 C# 上的 Redis 中获取集群信息。
我只是找不到相关信息。
我试图获得的输出就在 image 上.
例子:
127.0.0.1:7005>
cluster info
cluster_state:ok
cluster_slots_assigned:16384
cluster_slots_ok:16384
cluster_slots_pfail:0
cluster_slots_fail:0
cluster_known_nodes:6
cluster_size:3
cluster_current_epoch:7
cluster_my_epoch:1
cluster_stats_messages_ping_sent:8420
cluster_stats_messages_pong_sent:6418
cluster_stats_messages_sent:14838
最佳答案
其实很简单。在 IServer
上使用 Info
方法,如下所示。
ConnectionMultiplexer pool = ConnectionMultiplexer.Connect("127.0.0.1:6379, allowAdmin=true");
var infoResult = pool.GetServer("127.0.0.1:6379").Info();
请记住,您需要允许 adminMode
才能调用 Info
API。
关于c# - 我怎样才能像在终端上一样获取集群信息,但在我的 c# 客户端 (stackexchange) 上?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54765287/