Search in sources :

Example 1 with RedisConf

use of com.ctrip.xpipe.redis.console.health.redisconf.RedisConf in project x-pipe by ctripcorp.

the class DefaultDiskLessCollector method versionMatches.

@VisibleForTesting
protected boolean versionMatches(HostPort hostPort) {
    RedisConf redisConf = redisConfManager.findOrCreateConfig(hostPort.getHost(), hostPort.getPort());
    String targetVersion = consoleConfig.getReplDisklessMinRedisVersion();
    String version = redisConf.getRedisVersion();
    logger.debug("[versionMatches]Redis {} version is {}", hostPort, version);
    logger.debug("[versionMatches]Redis {} alert version is {}", hostPort, targetVersion);
    return version != null && StringUtil.compareVersion(version, targetVersion) < 1;
}
Also used : RedisConf(com.ctrip.xpipe.redis.console.health.redisconf.RedisConf) VisibleForTesting(com.ctrip.xpipe.utils.VisibleForTesting)

Example 2 with RedisConf

use of com.ctrip.xpipe.redis.console.health.redisconf.RedisConf in project x-pipe by ctripcorp.

the class DefaultBacklogActiveCollectorTest method analysisInfoReplication3.

@Test
public void analysisInfoReplication3() throws Exception {
    doNothing().when(alertManager).alert(any(), any(), any(), any(), any());
    Assert.assertNotNull(redisConfManager);
    RedisConf redisConf = new RedisConf(new HostPort(), "", "");
    redisConf.setXredisVersion("1.0.0");
    redisConf.setRedisVersion("4.0.1");
    when(redisConfManager.findOrCreateConfig("127.0.0.1", 6379)).thenReturn(redisConf);
    collector.analysisInfoReplication("role:unkown\n" + "master_host:10.2.54.233\n" + "master_port:7381\n" + "master_link_status:up\n" + "master_last_io_seconds_ago:0\n" + "master_sync_in_progress:0\n" + "slave_repl_offset:1439009182\n" + "slave_priority:100\n" + "slave_read_only:1\n" + "connected_slaves:0\n" + "master_replid:204b8d599765dd3dead6faa089aeb77d9d8726f5\n" + "master_replid2:0000000000000000000000000000000000000000\n" + "master_repl_offset:1439009182\n" + "second_repl_offset:-1\n" + "repl_backlog_active:0\n" + "repl_backlog_size:104857600\n" + "repl_backlog_first_byte_offset:1340037212\n" + "repl_backlog_histlen:98971971", "cluster", "shard", new HostPort("127.0.0.1", 6379));
    verify(alertManager, never()).alert(any(), any(), any(), any(), any());
}
Also used : HostPort(com.ctrip.xpipe.endpoint.HostPort) RedisConf(com.ctrip.xpipe.redis.console.health.redisconf.RedisConf) Test(org.junit.Test)

Example 3 with RedisConf

use of com.ctrip.xpipe.redis.console.health.redisconf.RedisConf in project x-pipe by ctripcorp.

the class DefaultBacklogActiveCollectorTest method analysisInfoReplication.

@Test
public void analysisInfoReplication() throws Exception {
    doNothing().when(alertManager).alert(any(), any(), any(), any(), any());
    Assert.assertNotNull(redisConfManager);
    RedisConf redisConf = new RedisConf(new HostPort(), "", "");
    redisConf.setXredisVersion("1.0.0");
    redisConf.setRedisVersion("4.0.1");
    when(redisConfManager.findOrCreateConfig("127.0.0.1", 6379)).thenReturn(redisConf);
    collector.analysisInfoReplication("role:slave\n" + "master_host:10.2.54.233\n" + "master_port:7381\n" + "master_link_status:up\n" + "master_last_io_seconds_ago:0\n" + "master_sync_in_progress:0\n" + "slave_repl_offset:1439009182\n" + "slave_priority:100\n" + "slave_read_only:1\n" + "connected_slaves:0\n" + "master_replid:204b8d599765dd3dead6faa089aeb77d9d8726f5\n" + "master_replid2:0000000000000000000000000000000000000000\n" + "master_repl_offset:1439009182\n" + "second_repl_offset:-1\n" + "repl_backlog_active:0\n" + "repl_backlog_size:104857600\n" + "repl_backlog_first_byte_offset:1340037212\n" + "repl_backlog_histlen:98971971", "cluster", "shard", new HostPort("127.0.0.1", 6379));
    verify(alertManager).alert(any(), any(), any(), any(), any());
}
Also used : HostPort(com.ctrip.xpipe.endpoint.HostPort) RedisConf(com.ctrip.xpipe.redis.console.health.redisconf.RedisConf) Test(org.junit.Test)

Example 4 with RedisConf

use of com.ctrip.xpipe.redis.console.health.redisconf.RedisConf in project x-pipe by ctripcorp.

the class DefaultVersionCollector method cacheRedisInfo.

private void cacheRedisInfo(HostPort hostPort, String info) {
    String redisVersion = RedisInfoUtils.getRedisVersion(info);
    String xredisVersion = RedisInfoUtils.getXRedisVersion(info);
    logger.debug("[cacheRedisInfo] Cache Redis {}, Redis Version: {}, XRedis Version: {}", hostPort, redisVersion, xredisVersion);
    RedisConf redisConf = redisConfManager.findOrCreateConfig(hostPort.getHost(), hostPort.getPort());
    redisConf.setRedisVersion(redisVersion);
    redisConf.setXredisVersion(xredisVersion);
}
Also used : RedisConf(com.ctrip.xpipe.redis.console.health.redisconf.RedisConf)

Example 5 with RedisConf

use of com.ctrip.xpipe.redis.console.health.redisconf.RedisConf in project x-pipe by ctripcorp.

the class DiskLessCollectorTest method testCheckRedisVersion.

@Test
public void testCheckRedisVersion() {
    RedisConf redisConf = new RedisConf(new HostPort(host, port), clusterId, shardId);
    redisConf.setRedisVersion("3.0.7");
    redisConf.setXredisVersion("0.0.4");
    when(confManager.findOrCreateConfig(host, port)).thenReturn(redisConf);
    when(config.getReplDisklessMinRedisVersion()).thenReturn("2.8.22");
    HostPort hostPort = new HostPort(host, port);
    Assert.assertTrue(collector.isReplDiskLessSync(diskLess));
    Assert.assertFalse(collector.versionMatches(hostPort));
}
Also used : HostPort(com.ctrip.xpipe.endpoint.HostPort) RedisConf(com.ctrip.xpipe.redis.console.health.redisconf.RedisConf) AbstractConsoleIntegrationTest(com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest) Test(org.junit.Test)

Aggregations

RedisConf (com.ctrip.xpipe.redis.console.health.redisconf.RedisConf)7 HostPort (com.ctrip.xpipe.endpoint.HostPort)4 Test (org.junit.Test)4 VisibleForTesting (com.ctrip.xpipe.utils.VisibleForTesting)2 AbstractConsoleIntegrationTest (com.ctrip.xpipe.redis.console.AbstractConsoleIntegrationTest)1