Search in sources :

Example 1 with SentinelMeta

use of com.ctrip.xpipe.redis.core.entity.SentinelMeta in project x-pipe by ctripcorp.

the class MetaServiceTest method testSetinelMetaService.

@Test
public void testSetinelMetaService() {
    SentinelMeta expect = new SentinelMeta().setId(1L).setAddress("1").setParent(null);
    SetinelTbl setinelTbl = new SetinelTbl().setSetinelId(1L).setSetinelAddress("1");
    assertEquals(expect, new SentinelMetaServiceImpl().encodeSetinelMeta(setinelTbl, null));
}
Also used : SentinelMeta(com.ctrip.xpipe.redis.core.entity.SentinelMeta) Test(org.junit.Test) AbstractConsoleTest(com.ctrip.xpipe.redis.console.AbstractConsoleTest)

Example 2 with SentinelMeta

use of com.ctrip.xpipe.redis.core.entity.SentinelMeta in project x-pipe by ctripcorp.

the class DefaultXpipeMetaManagerTest method testGetSentinel.

@Test
public void testGetSentinel() {
    SentinelMeta sentinelMeta = metaManager.getSentinel(dc, clusterId, shardId);
    Assert.assertEquals("127.0.0.1:17171,127.0.0.1:17171", sentinelMeta.getAddress());
}
Also used : SentinelMeta(com.ctrip.xpipe.redis.core.entity.SentinelMeta) Test(org.junit.Test) AbstractRedisTest(com.ctrip.xpipe.redis.core.AbstractRedisTest)

Example 3 with SentinelMeta

use of com.ctrip.xpipe.redis.core.entity.SentinelMeta in project x-pipe by ctripcorp.

the class AbstractSentinelMonitorsCheck method doCheck.

@Override
public void doCheck() {
    logger.info("[doCheck] check sentinel monitors");
    Collection<DcMeta> dcMetas = metaCache.getXpipeMeta().getDcs().values();
    for (DcMeta dcMeta : dcMetas) {
        Collection<SentinelMeta> sentinelMetas = dcMeta.getSentinels().values();
        for (SentinelMeta sentinelMeta : sentinelMetas) {
            List<HostPort> sentinels = IpUtils.parseAsHostPorts(sentinelMeta.getAddress());
            for (HostPort hostPort : sentinels) {
                checkSentinel(sentinelMeta, hostPort);
            }
        }
    }
}
Also used : DcMeta(com.ctrip.xpipe.redis.core.entity.DcMeta) SentinelMeta(com.ctrip.xpipe.redis.core.entity.SentinelMeta) HostPort(com.ctrip.xpipe.endpoint.HostPort)

Example 4 with SentinelMeta

use of com.ctrip.xpipe.redis.core.entity.SentinelMeta in project x-pipe by ctripcorp.

the class SentinelMetaServiceImpl method encodeSetinelMeta.

@Override
public SentinelMeta encodeSetinelMeta(SetinelTbl sentinel, DcMeta dcMeta) {
    SentinelMeta sentinelMeta = new SentinelMeta();
    if (null != sentinel) {
        sentinelMeta.setId(sentinel.getSetinelId());
        sentinelMeta.setAddress(sentinel.getSetinelAddress());
        sentinelMeta.setParent(dcMeta);
    }
    return sentinelMeta;
}
Also used : SentinelMeta(com.ctrip.xpipe.redis.core.entity.SentinelMeta)

Example 5 with SentinelMeta

use of com.ctrip.xpipe.redis.core.entity.SentinelMeta in project x-pipe by ctripcorp.

the class DefaultSentinelManagerTest method beforeDefaultSentinelManagerTest.

@Before
public void beforeDefaultSentinelManagerTest() throws Exception {
    sentinelManager = new DefaultSentinelManager(dcMetaCache, getXpipeNettyClientKeyedObjectPool());
    executionLog = new ExecutionLog(currentTestName());
    redisMaster = new RedisMeta().setIp("127.0.0.1").setPort(port);
    when(dcMetaCache.getSentinelMonitorName(getClusterId(), getShardId())).thenReturn(sentinelMonitorName);
    when(dcMetaCache.getSentinel(getClusterId(), getShardId())).thenReturn(new SentinelMeta().setAddress(allSentinels));
}
Also used : ExecutionLog(com.ctrip.xpipe.redis.meta.server.dcchange.ExecutionLog) SentinelMeta(com.ctrip.xpipe.redis.core.entity.SentinelMeta) RedisMeta(com.ctrip.xpipe.redis.core.entity.RedisMeta) DefaultSentinelManager(com.ctrip.xpipe.redis.meta.server.dcchange.impl.DefaultSentinelManager) Before(org.junit.Before)

Aggregations

SentinelMeta (com.ctrip.xpipe.redis.core.entity.SentinelMeta)7 Test (org.junit.Test)4 HostPort (com.ctrip.xpipe.endpoint.HostPort)3 AbstractConsoleTest (com.ctrip.xpipe.redis.console.AbstractConsoleTest)1 AbstractRedisTest (com.ctrip.xpipe.redis.core.AbstractRedisTest)1 DcMeta (com.ctrip.xpipe.redis.core.entity.DcMeta)1 RedisMeta (com.ctrip.xpipe.redis.core.entity.RedisMeta)1 ExecutionLog (com.ctrip.xpipe.redis.meta.server.dcchange.ExecutionLog)1 DefaultSentinelManager (com.ctrip.xpipe.redis.meta.server.dcchange.impl.DefaultSentinelManager)1 Before (org.junit.Before)1