default-instance.xml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
  4. xmlns:aop="http://www.springframework.org/schema/aop" xmlns:lang="http://www.springframework.org/schema/lang"
  5. xmlns:context="http://www.springframework.org/schema/context"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  7. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
  8. http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang-2.0.xsd
  9. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
  10. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
  11. default-autowire="byName">
  12. <import resource="classpath:spring/base-instance.xml" />
  13. <bean id="instance" class="com.alibaba.otter.canal.instance.spring.CanalInstanceWithSpring">
  14. <property name="destination" value="${canal.instance.destination}" />
  15. <property name="eventParser">
  16. <ref local="eventParser" />
  17. </property>
  18. <property name="eventSink">
  19. <ref local="eventSink" />
  20. </property>
  21. <property name="eventStore">
  22. <ref local="eventStore" />
  23. </property>
  24. <property name="metaManager">
  25. <ref local="metaManager" />
  26. </property>
  27. <property name="alarmHandler">
  28. <ref local="alarmHandler" />
  29. </property>
  30. </bean>
  31. <!-- 报警处理类 -->
  32. <bean id="alarmHandler" class="com.alibaba.otter.canal.common.alarm.LogAlarmHandler" />
  33. <bean id="zkClientx" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" >
  34. <property name="targetClass" value="com.alibaba.otter.canal.common.zookeeper.ZkClientx" />
  35. <property name="targetMethod" value="getZkClient" />
  36. <property name="arguments">
  37. <list>
  38. <value>${canal.zkServers:127.0.0.1:2181}</value>
  39. </list>
  40. </property>
  41. </bean>
  42. <bean id="metaManager" class="com.alibaba.otter.canal.meta.PeriodMixedMetaManager">
  43. <property name="zooKeeperMetaManager">
  44. <bean class="com.alibaba.otter.canal.meta.ZooKeeperMetaManager">
  45. <property name="zkClientx" ref="zkClientx" />
  46. </bean>
  47. </property>
  48. <property name="period" value="${canal.zookeeper.flush.period:1000}" />
  49. </bean>
  50. <bean id="eventStore" class="com.alibaba.otter.canal.store.memory.MemoryEventStoreWithBuffer">
  51. <property name="bufferSize" value="${canal.instance.memory.buffer.size:16384}" />
  52. <property name="bufferMemUnit" value="${canal.instance.memory.buffer.memunit:1024}" />
  53. <property name="batchMode" value="${canal.instance.memory.batch.mode:MEMSIZE}" />
  54. <property name="ddlIsolation" value="${canal.instance.get.ddl.isolation:false}" />
  55. </bean>
  56. <bean id="eventSink" class="com.alibaba.otter.canal.sink.entry.EntryEventSink">
  57. <property name="eventStore" ref="eventStore" />
  58. <property name="filterTransactionEntry" value="${canal.instance.filter.transaction.entry:false}"/>
  59. </bean>
  60. <bean id="eventParser" parent="baseEventParser" >
  61. <property name="destination" value="${canal.instance.destination}" />
  62. <property name="slaveId" value="${canal.instance.mysql.slaveId:0}" />
  63. <!-- 心跳配置 -->
  64. <property name="detectingEnable" value="${canal.instance.detecting.enable:false}" />
  65. <property name="detectingSQL" value="${canal.instance.detecting.sql}" />
  66. <property name="detectingIntervalInSeconds" value="${canal.instance.detecting.interval.time:5}" />
  67. <property name="haController">
  68. <bean class="com.alibaba.otter.canal.parse.ha.HeartBeatHAController">
  69. <property name="detectingRetryTimes" value="${canal.instance.detecting.retry.threshold:3}" />
  70. <property name="switchEnable" value="${canal.instance.detecting.heartbeatHaEnable:false}" />
  71. </bean>
  72. </property>
  73. <property name="alarmHandler" ref="alarmHandler" />
  74. <!-- 解析过滤处理 -->
  75. <property name="eventFilter">
  76. <bean class="com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter" >
  77. <constructor-arg index="0" value="${canal.instance.filter.regex:.*\..*}" />
  78. </bean>
  79. </property>
  80. <property name="eventBlackFilter">
  81. <bean class="com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter" >
  82. <constructor-arg index="0" value="${canal.instance.filter.black.regex:}" />
  83. <constructor-arg index="1" value="false" />
  84. </bean>
  85. </property>
  86. <!-- 最大事务解析大小,超过该大小后事务将被切分为多个事务投递 -->
  87. <property name="transactionSize" value="${canal.instance.transaction.size:1024}" />
  88. <!-- 网络链接参数 -->
  89. <property name="receiveBufferSize" value="${canal.instance.network.receiveBufferSize:16384}" />
  90. <property name="sendBufferSize" value="${canal.instance.network.sendBufferSize:16384}" />
  91. <property name="defaultConnectionTimeoutInSeconds" value="${canal.instance.network.soTimeout:30}" />
  92. <!-- 解析编码 -->
  93. <!-- property name="connectionCharsetNumber" value="${canal.instance.connectionCharsetNumber:33}" /-->
  94. <property name="connectionCharset" value="${canal.instance.connectionCharset:UTF-8}" />
  95. <!-- 解析位点记录 -->
  96. <property name="logPositionManager">
  97. <bean class="com.alibaba.otter.canal.parse.index.FailbackLogPositionManager">
  98. <constructor-arg>
  99. <bean class="com.alibaba.otter.canal.parse.index.MemoryLogPositionManager" />
  100. </constructor-arg>
  101. <constructor-arg>
  102. <bean class="com.alibaba.otter.canal.parse.index.MetaLogPositionManager">
  103. <constructor-arg ref="metaManager"/>
  104. </bean>
  105. </constructor-arg>
  106. </bean>
  107. </property>
  108. <!-- failover切换时回退的时间 -->
  109. <property name="fallbackIntervalInSeconds" value="${canal.instance.fallbackIntervalInSeconds:60}" />
  110. <!-- 解析数据库信息 -->
  111. <property name="masterInfo">
  112. <bean class="com.alibaba.otter.canal.parse.support.AuthenticationInfo" init-method="initPwd">
  113. <property name="address" value="${canal.instance.master.address}" />
  114. <property name="username" value="${canal.instance.dbUsername:retl}" />
  115. <property name="password" value="${canal.instance.dbPassword:retl}" />
  116. <property name="pwdPublicKey" value="${canal.instance.pwdPublicKey:retl}" />
  117. <property name="enableDruid" value="${canal.instance.enableDruid:false}" />
  118. <property name="defaultDatabaseName" value="${canal.instance.defaultDatabaseName:test}" />
  119. </bean>
  120. </property>
  121. <property name="standbyInfo">
  122. <bean class="com.alibaba.otter.canal.parse.support.AuthenticationInfo" init-method="initPwd">
  123. <property name="address" value="${canal.instance.standby.address}" />
  124. <property name="username" value="${canal.instance.dbUsername:retl}" />
  125. <property name="password" value="${canal.instance.dbPassword:retl}" />
  126. <property name="pwdPublicKey" value="${canal.instance.pwdPublicKey:retl}" />
  127. <property name="enableDruid" value="${canal.instance.enableDruid:false}" />
  128. <property name="defaultDatabaseName" value="${canal.instance.defaultDatabaseName:test}" />
  129. </bean>
  130. </property>
  131. <!-- 解析起始位点 -->
  132. <property name="masterPosition">
  133. <bean class="com.alibaba.otter.canal.protocol.position.EntryPosition">
  134. <property name="journalName" value="${canal.instance.master.journal.name}" />
  135. <property name="position" value="${canal.instance.master.position}" />
  136. <property name="timestamp" value="${canal.instance.master.timestamp}" />
  137. <property name="gtid" value="${canal.instance.master.gtid}" />
  138. </bean>
  139. </property>
  140. <property name="standbyPosition">
  141. <bean class="com.alibaba.otter.canal.protocol.position.EntryPosition">
  142. <property name="journalName" value="${canal.instance.standby.journal.name}" />
  143. <property name="position" value="${canal.instance.standby.position}" />
  144. <property name="timestamp" value="${canal.instance.standby.timestamp}" />
  145. <property name="gtid" value="${canal.instance.standby.gtid}" />
  146. </bean>
  147. </property>
  148. <property name="filterQueryDml" value="${canal.instance.filter.query.dml:false}" />
  149. <property name="filterQueryDcl" value="${canal.instance.filter.query.dcl:false}" />
  150. <property name="filterQueryDdl" value="${canal.instance.filter.query.ddl:false}" />
  151. <property name="useDruidDdlFilter" value="${canal.instance.filter.druid.ddl:true}" />
  152. <property name="filterRows" value="${canal.instance.filter.rows:false}" />
  153. <property name="filterTableError" value="${canal.instance.filter.table.error:false}" />
  154. <property name="supportBinlogFormats" value="${canal.instance.binlog.format}" />
  155. <property name="supportBinlogImages" value="${canal.instance.binlog.image}" />
  156. <!--表结构相关-->
  157. <property name="enableTsdb" value="${canal.instance.tsdb.enable:true}"/>
  158. <property name="tsdbSpringXml" value="${canal.instance.tsdb.spring.xml:}"/>
  159. <!--是否启用GTID模式-->
  160. <property name="isGTIDMode" value="${canal.instance.gtidon:false}"/>
  161. <!-- parallel parser -->
  162. <property name="parallel" value="${canal.instance.parser.parallel:true}" />
  163. <property name="parallelThreadSize" value="${canal.instance.parser.parallelThreadSize}" />
  164. <property name="parallelBufferSize" value="${canal.instance.parser.parallelBufferSize:256}" />
  165. </bean>
  166. </beans>