c# - 我怎样才能像在终端上一样获取集群信息,但在我的 c# 客户端 (stackexchange) 上?

标签 c# redis client cluster-computing

我正在尝试使用 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/

相关文章:

c# - 带有 C# 和 SQL Server 的 Amazon SQS

python - 自定义 Celery Task 类无法正常工作

windows - 在 Windows 上运行 Redis

javascript - 尝试从客户端发送数据但 req.session 无法正常工作

c - 错误: dereferencing pointer to incomplete type是什么意思

c# - 在 Connect C# 上获取 iphone 的 UDID

c# - 将 DataTable 从 View 传递到新的 Controller 方法

c# - 在 EF Core 中自动填充 Created 和 LastModified

node.js - 在 NodeJS 中缓存搜索结果有什么更好的选择?

Java - 通过服务器/客户端架构托管文件