Search in sources :

Example 1 with Canal

use of com.alibaba.otter.canal.instance.manager.model.Canal in project canal by alibaba.

the class ManagerCanalInstanceGenerator method generate.

public CanalInstance generate(String destination) {
    Canal canal = canalConfigClient.findCanal(destination);
    String filter = canalConfigClient.findFilter(destination);
    return new CanalInstanceWithManager(canal, filter);
}
Also used : Canal(com.alibaba.otter.canal.instance.manager.model.Canal)

Example 2 with Canal

use of com.alibaba.otter.canal.instance.manager.model.Canal in project canal by alibaba.

the class BaseCanalServerWithEmbededTest method setUp.

@Before
public void setUp() {
    server = CanalServerWithEmbedded.instance();
    server.setCanalInstanceGenerator(new CanalInstanceGenerator() {

        public CanalInstance generate(String destination) {
            Canal canal = buildCanal();
            return new CanalInstanceWithManager(canal, FILTER);
        }
    });
    server.start();
    server.start(DESTINATION);
}
Also used : CanalInstance(com.alibaba.otter.canal.instance.core.CanalInstance) Canal(com.alibaba.otter.canal.instance.manager.model.Canal) CanalInstanceGenerator(com.alibaba.otter.canal.instance.core.CanalInstanceGenerator) CanalInstanceWithManager(com.alibaba.otter.canal.instance.manager.CanalInstanceWithManager) Before(org.junit.Before)

Example 3 with Canal

use of com.alibaba.otter.canal.instance.manager.model.Canal in project canal by alibaba.

the class CanalServerWithEmbedded_StandaloneTest method buildCanal.

protected Canal buildCanal() {
    Canal canal = new Canal();
    canal.setId(1L);
    canal.setName(DESTINATION);
    canal.setDesc("test");
    CanalParameter parameter = new CanalParameter();
    parameter.setZkClusters(Arrays.asList("127.0.0.1:2188"));
    parameter.setMetaMode(MetaMode.MEMORY);
    parameter.setHaMode(HAMode.HEARTBEAT);
    parameter.setIndexMode(IndexMode.MEMORY);
    parameter.setStorageMode(StorageMode.MEMORY);
    parameter.setMemoryStorageBufferSize(32 * 1024);
    parameter.setSourcingType(SourcingType.MYSQL);
    parameter.setDbAddresses(Arrays.asList(new InetSocketAddress(MYSQL_ADDRESS, 3306), new InetSocketAddress(MYSQL_ADDRESS, 3306)));
    parameter.setDbUsername(USERNAME);
    parameter.setDbPassword(PASSWORD);
    parameter.setPositions(Arrays.asList("{\"journalName\":\"mysql-bin.000001\",\"position\":6163L,\"timestamp\":1322803601000L}", "{\"journalName\":\"mysql-bin.000001\",\"position\":6163L,\"timestamp\":1322803601000L}"));
    parameter.setSlaveId(1234L);
    parameter.setDefaultConnectionTimeoutInSeconds(30);
    parameter.setConnectionCharset("UTF-8");
    parameter.setConnectionCharsetNumber((byte) 33);
    parameter.setReceiveBufferSize(8 * 1024);
    parameter.setSendBufferSize(8 * 1024);
    parameter.setDetectingEnable(false);
    parameter.setDetectingIntervalInSeconds(10);
    parameter.setDetectingRetryTimes(3);
    parameter.setDetectingSQL(DETECTING_SQL);
    canal.setCanalParameter(parameter);
    return canal;
}
Also used : CanalParameter(com.alibaba.otter.canal.instance.manager.model.CanalParameter) Canal(com.alibaba.otter.canal.instance.manager.model.Canal) InetSocketAddress(java.net.InetSocketAddress)

Example 4 with Canal

use of com.alibaba.otter.canal.instance.manager.model.Canal in project canal by alibaba.

the class CanalServerWithEmbedded_StandbyTest method buildCanal.

protected Canal buildCanal() {
    Canal canal = new Canal();
    canal.setId(1L);
    canal.setName(DESTINATION);
    canal.setDesc("test");
    CanalParameter parameter = new CanalParameter();
    parameter.setZkClusters(Arrays.asList("127.0.0.1:2188"));
    // 冷备,可选择混合模式
    parameter.setMetaMode(MetaMode.MIXED);
    parameter.setHaMode(HAMode.HEARTBEAT);
    // 内存版store,需要选择meta做为index
    parameter.setIndexMode(IndexMode.META);
    parameter.setStorageMode(StorageMode.MEMORY);
    parameter.setMemoryStorageBufferSize(32 * 1024);
    parameter.setSourcingType(SourcingType.MYSQL);
    parameter.setDbAddresses(Arrays.asList(new InetSocketAddress(MYSQL_ADDRESS, 3306), new InetSocketAddress(MYSQL_ADDRESS, 3306)));
    parameter.setDbUsername(USERNAME);
    parameter.setDbPassword(PASSWORD);
    parameter.setPositions(Arrays.asList("{\"journalName\":\"mysql-bin.000001\",\"position\":6163L,\"timestamp\":1322803601000L}", "{\"journalName\":\"mysql-bin.000001\",\"position\":6163L,\"timestamp\":1322803601000L}"));
    parameter.setSlaveId(1234L);
    parameter.setDefaultConnectionTimeoutInSeconds(30);
    parameter.setConnectionCharset("UTF-8");
    parameter.setConnectionCharsetNumber((byte) 33);
    parameter.setReceiveBufferSize(8 * 1024);
    parameter.setSendBufferSize(8 * 1024);
    parameter.setDetectingEnable(false);
    parameter.setDetectingIntervalInSeconds(10);
    parameter.setDetectingRetryTimes(3);
    parameter.setDetectingSQL(DETECTING_SQL);
    canal.setCanalParameter(parameter);
    return canal;
}
Also used : CanalParameter(com.alibaba.otter.canal.instance.manager.model.CanalParameter) Canal(com.alibaba.otter.canal.instance.manager.model.Canal) InetSocketAddress(java.net.InetSocketAddress)

Example 5 with Canal

use of com.alibaba.otter.canal.instance.manager.model.Canal in project canal by alibaba.

the class CanalServerWithNettyTest method buildCanal.

private Canal buildCanal() {
    Canal canal = new Canal();
    canal.setId(1L);
    canal.setName(DESTINATION);
    canal.setDesc("test");
    CanalParameter parameter = new CanalParameter();
    parameter.setZkClusters(Arrays.asList("127.0.0.1:2188"));
    parameter.setMetaMode(MetaMode.MEMORY);
    parameter.setHaMode(HAMode.HEARTBEAT);
    parameter.setIndexMode(IndexMode.MEMORY);
    parameter.setStorageMode(StorageMode.MEMORY);
    parameter.setMemoryStorageBufferSize(32 * 1024);
    parameter.setSourcingType(SourcingType.MYSQL);
    parameter.setDbAddresses(Arrays.asList(new InetSocketAddress(MYSQL_ADDRESS, 3306), new InetSocketAddress(MYSQL_ADDRESS, 3306)));
    parameter.setDbUsername(USERNAME);
    parameter.setDbPassword(PASSWORD);
    parameter.setPositions(Arrays.asList("{\"journalName\":\"mysql-bin.000001\",\"position\":6163L,\"timestamp\":1322803601000L}", "{\"journalName\":\"mysql-bin.000001\",\"position\":6163L,\"timestamp\":1322803601000L}"));
    parameter.setSlaveId(1234L);
    parameter.setDefaultConnectionTimeoutInSeconds(30);
    parameter.setConnectionCharset("UTF-8");
    parameter.setConnectionCharsetNumber((byte) 33);
    parameter.setReceiveBufferSize(8 * 1024);
    parameter.setSendBufferSize(8 * 1024);
    parameter.setDetectingEnable(false);
    parameter.setDetectingIntervalInSeconds(10);
    parameter.setDetectingRetryTimes(3);
    parameter.setDetectingSQL(DETECTING_SQL);
    canal.setCanalParameter(parameter);
    return canal;
}
Also used : CanalParameter(com.alibaba.otter.canal.instance.manager.model.CanalParameter) Canal(com.alibaba.otter.canal.instance.manager.model.Canal) InetSocketAddress(java.net.InetSocketAddress)

Aggregations

Canal (com.alibaba.otter.canal.instance.manager.model.Canal)18 CanalParameter (com.alibaba.otter.canal.instance.manager.model.CanalParameter)6 ArrayList (java.util.ArrayList)6 RepeatConfigureException (com.alibaba.otter.manager.biz.common.exceptions.RepeatConfigureException)5 InetSocketAddress (java.net.InetSocketAddress)5 CanalInstance (com.alibaba.otter.canal.instance.core.CanalInstance)3 CanalInstanceGenerator (com.alibaba.otter.canal.instance.core.CanalInstanceGenerator)3 CanalInstanceWithManager (com.alibaba.otter.canal.instance.manager.CanalInstanceWithManager)3 ManagerException (com.alibaba.otter.manager.biz.common.exceptions.ManagerException)3 AutoKeeperCluster (com.alibaba.otter.shared.common.model.autokeeper.AutoKeeperCluster)3 Pipeline (com.alibaba.otter.shared.common.model.config.pipeline.Pipeline)3 HashMap (java.util.HashMap)3 Paginator (com.alibaba.citrus.util.Paginator)2 CanalException (com.alibaba.otter.canal.common.CanalException)2 DataSourcing (com.alibaba.otter.canal.instance.manager.model.CanalParameter.DataSourcing)2 SourcingType (com.alibaba.otter.canal.instance.manager.model.CanalParameter.SourcingType)2 SeniorCanal (com.alibaba.otter.manager.web.common.model.SeniorCanal)2 List (java.util.List)2 Before (org.junit.Before)2 MediaHAController (com.alibaba.otter.canal.extend.ha.MediaHAController)1