2.0重构版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

default-instance.xml 11 KiB

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