redis.clients.jedis.Jedis.sentinelMasters()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(262)

本文整理了Java中redis.clients.jedis.Jedis.sentinelMasters()方法的一些代码示例,展示了Jedis.sentinelMasters()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.sentinelMasters()方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:sentinelMasters

Jedis.sentinelMasters介绍

[英]```
redis 127.0.0.1:26381> sentinel masters

    1. "name"
  1. "mymaster"
  2. "ip"
  3. "127.0.0.1"
  4. "port"
  5. "6379"
  6. "runid"
  7. "93d4d4e6e9c06d0eea36e27f31924ac26576081d"
  8. "flags"
  9. "master"
  10. "pending-commands"
  11. "0"
  12. "last-ok-ping-reply"
  13. "423"
  14. "last-ping-reply"
  15. "423"
  16. "info-refresh"
  17. "6107"
  18. "num-slaves"
  19. "1"
  20. "num-other-sentinels"
  21. "2"
  22. "quorum"
  23. "2"
[中]```
redis 127.0.0.1:26381> sentinel masters 
1)  1) "name" 
2) "mymaster" 
3) "ip" 
4) "127.0.0.1" 
5) "port" 
6) "6379" 
7) "runid" 
8) "93d4d4e6e9c06d0eea36e27f31924ac26576081d" 
9) "flags" 
10) "master" 
11) "pending-commands" 
12) "0" 
13) "last-ok-ping-reply" 
14) "423" 
15) "last-ping-reply" 
16) "423" 
17) "info-refresh" 
18) "6107" 
19) "num-slaves" 
20) "1" 
21) "num-other-sentinels" 
22) "2" 
23) "quorum" 
24) "2"

代码示例

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public List<RedisServer> masters() {
  return JedisConverters.toListOfRedisServer(jedis.sentinelMasters());
}

代码示例来源:origin: io.leopard/leopard-redis

@Override
public List<Map<String, String>> sentinelMasters() {
  return jedis.sentinelMasters();
}

代码示例来源:origin: io.leopard/leopard-redis

@Override
public List<Map<String, String>> sentinelMasters() {
  return jedis.sentinelMasters();
}

代码示例来源:origin: wso2/msf4j

private static Jedis getJedisInternal(Jedis sentinel) {
    List<Map<String, String>> masters = sentinel.sentinelMasters();
    for (Map<String, String> master : masters) {
      if (MASTER_NAME.equals(master.get("name"))) {
        String masterIP = master.get("ip");
        int masterPort = Integer.parseInt(master.get("port"));
        log.info("Redis master : {}:{}", masterIP, masterPort);
        return new Jedis(masterIP, masterPort);
      }
    }
    return null;
  }
}

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public List<Map<String, String>> sentinelMasters() {
 String command = "sentinelMasters";
 return instrumented(command, () -> delegated.sentinelMasters());
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public List<RedisServer> masters() {
  return JedisConverters.toListOfRedisServer(jedis.sentinelMasters());
}

代码示例来源:origin: org.wso2.carbon.mss/petstore-util

private static Jedis getJedisInternal(Jedis sentinel) {
    List<Map<String, String>> masters = sentinel.sentinelMasters();
    for (Map<String, String> master : masters) {
      if (MASTER_NAME.equals(master.get("name"))) {
        String masterIP = master.get("ip");
        int masterPort = Integer.parseInt(master.get("port"));
        log.info("Redis master : {}:{}", masterIP, masterPort);
        return new Jedis(masterIP, masterPort);
      }
    }
    return null;
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public List<RedisServer> masters() {
  return JedisConverters.toListOfRedisServer(jedis.sentinelMasters());
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

Jedis jedis = getJedis();
try {
  return jedis.sentinelMasters();
} finally {Streams.safeClose(jedis);}

代码示例来源:origin: penggle/jedis-ms-sentinel

@Test
public void sentinelMasters() throws Exception {
  Jedis sentinel = null;
  try {
    sentinel = new Jedis("192.168.137.101", 63791);
    System.out.println(String.format(">>> sentinel = %s", sentinel));
    List<Map<String, String>> masters = sentinel.sentinelMasters();
    for(Map<String,String> master : masters){
      System.out.println("----------------------------------------------");
      for(Map.Entry<String,String> entry : master.entrySet()){
        System.out.println(entry.getKey() + " : " + entry.getValue());
      }
    }
  } finally {
    if(sentinel != null){
      sentinel.close();
    }
  }
}

相关文章

Jedis类方法