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.

file-instance.xml 10 KiB

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