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.

group-instance.xml 15 KiB

2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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.MemoryMetaManager" />
  37. <bean id="eventStore" class="com.alibaba.otter.canal.store.memory.MemoryEventStoreWithBuffer">
  38. <property name="bufferSize" value="${canal.instance.memory.buffer.size:16384}" />
  39. <property name="bufferMemUnit" value="${canal.instance.memory.buffer.memunit:1024}" />
  40. <property name="batchMode" value="${canal.instance.memory.batch.mode:MEMSIZE}" />
  41. <property name="ddlIsolation" value="${canal.instance.get.ddl.isolation:false}" />
  42. <property name="raw" value="${canal.instance.memory.rawEntry:true}" />
  43. </bean>
  44. <bean id="eventSink" class="com.alibaba.otter.canal.sink.entry.EntryEventSink">
  45. <property name="eventStore" ref="eventStore" />
  46. <property name="filterTransactionEntry" value="${canal.instance.filter.transaction.entry:false}"/>
  47. </bean>
  48. <bean id="eventParser" class="com.alibaba.otter.canal.parse.inbound.group.GroupEventParser">
  49. <property name="eventParsers">
  50. <list>
  51. <ref bean="eventParser1" />
  52. <ref bean="eventParser2" />
  53. </list>
  54. </property>
  55. </bean>
  56. <bean id="eventParser1" parent="baseEventParser">
  57. <property name="destination" value="${canal.instance.destination}" />
  58. <property name="slaveId" value="${canal.instance.mysql.slaveId:0}" />
  59. <!-- 心跳配置 -->
  60. <property name="detectingEnable" value="${canal.instance.detecting.enable:false}" />
  61. <property name="detectingSQL" value="${canal.instance.detecting.sql}" />
  62. <property name="detectingIntervalInSeconds" value="${canal.instance.detecting.interval.time:5}" />
  63. <property name="haController">
  64. <bean class="com.alibaba.otter.canal.parse.ha.HeartBeatHAController">
  65. <property name="detectingRetryTimes" value="${canal.instance.detecting.retry.threshold:3}" />
  66. <property name="switchEnable" value="${canal.instance.detecting.heartbeatHaEnable:false}" />
  67. </bean>
  68. </property>
  69. <property name="alarmHandler" ref="alarmHandler" />
  70. <!-- 解析过滤处理 -->
  71. <property name="eventFilter">
  72. <bean class="com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter" >
  73. <constructor-arg index="0" value="${canal.instance.filter.regex:.*\..*}" />
  74. </bean>
  75. </property>
  76. <property name="eventBlackFilter">
  77. <bean class="com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter" >
  78. <constructor-arg index="0" value="${canal.instance.filter.black.regex:}" />
  79. <constructor-arg index="1" value="false" />
  80. </bean>
  81. </property>
  82. <property name="fieldFilter" value="${canal.instance.filter.field}" />
  83. <property name="fieldBlackFilter" value="${canal.instance.filter.black.field}" />
  84. <!-- 最大事务解析大小,超过该大小后事务将被切分为多个事务投递 -->
  85. <property name="transactionSize" value="${canal.instance.transaction.size:1024}" />
  86. <!-- 网络链接参数 -->
  87. <property name="receiveBufferSize" value="${canal.instance.network.receiveBufferSize:16384}" />
  88. <property name="sendBufferSize" value="${canal.instance.network.sendBufferSize:16384}" />
  89. <property name="defaultConnectionTimeoutInSeconds" value="${canal.instance.network.soTimeout:30}" />
  90. <!-- 解析编码 -->
  91. <!-- property name="connectionCharsetNumber" value="${canal.instance.connectionCharsetNumber:33}" /-->
  92. <property name="connectionCharset" value="${canal.instance.connectionCharset:UTF-8}" />
  93. <!-- 解析位点记录 -->
  94. <property name="logPositionManager">
  95. <bean class="com.alibaba.otter.canal.parse.index.MemoryLogPositionManager" />
  96. </property>
  97. <!-- failover切换时回退的时间 -->
  98. <property name="fallbackIntervalInSeconds" value="${canal.instance.fallbackIntervalInSeconds:60}" />
  99. <!-- 解析数据库信息 -->
  100. <property name="masterInfo">
  101. <bean class="com.alibaba.otter.canal.parse.support.AuthenticationInfo" init-method="initPwd">
  102. <property name="address" value="${canal.instance.master1.address}" />
  103. <property name="username" value="${canal.instance.dbUsername:retl}" />
  104. <property name="password" value="${canal.instance.dbPassword:retl}" />
  105. <property name="pwdPublicKey" value="${canal.instance.pwdPublicKey:retl}" />
  106. <property name="enableDruid" value="${canal.instance.enableDruid:false}" />
  107. <property name="defaultDatabaseName" value="${canal.instance.defaultDatabaseName:}" />
  108. </bean>
  109. </property>
  110. <property name="standbyInfo">
  111. <bean class="com.alibaba.otter.canal.parse.support.AuthenticationInfo" init-method="initPwd">
  112. <property name="address" value="${canal.instance.standby1.address}" />
  113. <property name="username" value="${canal.instance.dbUsername:retl}" />
  114. <property name="password" value="${canal.instance.dbPassword:retl}" />
  115. <property name="pwdPublicKey" value="${canal.instance.pwdPublicKey:retl}" />
  116. <property name="enableDruid" value="${canal.instance.enableDruid:false}" />
  117. <property name="defaultDatabaseName" value="${canal.instance.defaultDatabaseName:}" />
  118. </bean>
  119. </property>
  120. <!-- 解析起始位点 -->
  121. <property name="masterPosition">
  122. <bean class="com.alibaba.otter.canal.protocol.position.EntryPosition">
  123. <property name="journalName" value="${canal.instance.master1.journal.name}" />
  124. <property name="position" value="${canal.instance.master1.position}" />
  125. <property name="timestamp" value="${canal.instance.master1.timestamp}" />
  126. <property name="gtid" value="${canal.instance.master1.gtid}" />
  127. </bean>
  128. </property>
  129. <property name="standbyPosition">
  130. <bean class="com.alibaba.otter.canal.protocol.position.EntryPosition">
  131. <property name="journalName" value="${canal.instance.standby1.journal.name}" />
  132. <property name="position" value="${canal.instance.standby1.position}" />
  133. <property name="timestamp" value="${canal.instance.standby1.timestamp}" />
  134. <property name="gtid" value="${canal.instance.standby1.gtid}" />
  135. </bean>
  136. </property>
  137. <property name="filterQueryDml" value="${canal.instance.filter.query.dml:false}" />
  138. <property name="filterQueryDcl" value="${canal.instance.filter.query.dcl:false}" />
  139. <property name="filterQueryDdl" value="${canal.instance.filter.query.ddl:false}" />
  140. <property name="useDruidDdlFilter" value="${canal.instance.filter.druid.ddl:true}" />
  141. <property name="filterDmlInsert" value="${canal.instance.filter.dml.insert:false}" />
  142. <property name="filterDmlUpdate" value="${canal.instance.filter.dml.update:false}" />
  143. <property name="filterDmlDelete" value="${canal.instance.filter.dml.delete:false}" />
  144. <property name="filterTableError" value="${canal.instance.filter.table.error:false}" />
  145. <property name="supportBinlogFormats" value="${canal.instance.binlog.format}" />
  146. <property name="supportBinlogImages" value="${canal.instance.binlog.image}" />
  147. <!-- parallel parser -->
  148. <property name="parallel" value="${canal.instance.parser.parallel:true}" />
  149. <property name="parallelThreadSize" value="${canal.instance.parser.parallelThreadSize}" />
  150. <property name="parallelBufferSize" value="${canal.instance.parser.parallelBufferSize:256}" />
  151. <property name="autoResetLatestPosMode" value="${canal.auto.reset.latest.pos.mode:false}" />
  152. </bean>
  153. <bean id="eventParser2" parent="baseEventParser">
  154. <property name="destination" value="${canal.instance.destination}" />
  155. <property name="slaveId" value="${canal.instance.mysql.slaveId:0}" />
  156. <!-- 心跳配置 -->
  157. <property name="detectingEnable" value="${canal.instance.detecting.enable:false}" />
  158. <property name="detectingSQL" value="${canal.instance.detecting.sql}" />
  159. <property name="detectingIntervalInSeconds" value="${canal.instance.detecting.interval.time:5}" />
  160. <property name="haController">
  161. <bean class="com.alibaba.otter.canal.parse.ha.HeartBeatHAController">
  162. <property name="detectingRetryTimes" value="${canal.instance.detecting.retry.threshold:3}" />
  163. <property name="switchEnable" value="${canal.instance.detecting.heartbeatHaEnable:false}" />
  164. </bean>
  165. </property>
  166. <property name="alarmHandler" ref="alarmHandler" />
  167. <!-- 解析过滤处理 -->
  168. <property name="eventFilter">
  169. <bean class="com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter" >
  170. <constructor-arg index="0" value="${canal.instance.filter.regex:.*\..*}" />
  171. </bean>
  172. </property>
  173. <property name="eventBlackFilter">
  174. <bean class="com.alibaba.otter.canal.filter.aviater.AviaterRegexFilter" >
  175. <constructor-arg index="0" value="${canal.instance.filter.black.regex:}" />
  176. <constructor-arg index="1" value="false" />
  177. </bean>
  178. </property>
  179. <!-- 最大事务解析大小,超过该大小后事务将被切分为多个事务投递 -->
  180. <property name="transactionSize" value="${canal.instance.transaction.size:1024}" />
  181. <!-- 网络链接参数 -->
  182. <property name="receiveBufferSize" value="${canal.instance.network.receiveBufferSize:16384}" />
  183. <property name="sendBufferSize" value="${canal.instance.network.sendBufferSize:16384}" />
  184. <property name="defaultConnectionTimeoutInSeconds" value="${canal.instance.network.soTimeout:30}" />
  185. <!-- 解析编码 -->
  186. <!-- property name="connectionCharsetNumber" value="${canal.instance.connectionCharsetNumber:33}" /-->
  187. <property name="connectionCharset" value="${canal.instance.connectionCharset:UTF-8}" />
  188. <!-- 解析位点记录 -->
  189. <property name="logPositionManager">
  190. <bean class="com.alibaba.otter.canal.parse.index.MemoryLogPositionManager" />
  191. </property>
  192. <!-- failover切换时回退的时间 -->
  193. <property name="fallbackIntervalInSeconds" value="${canal.instance.fallbackIntervalInSeconds:60}" />
  194. <!-- 解析数据库信息 -->
  195. <property name="masterInfo">
  196. <bean class="com.alibaba.otter.canal.parse.support.AuthenticationInfo" init-method="initPwd">
  197. <property name="address" value="${canal.instance.master2.address}" />
  198. <property name="username" value="${canal.instance.dbUsername:retl}" />
  199. <property name="password" value="${canal.instance.dbPassword:retl}" />
  200. <property name="pwdPublicKey" value="${canal.instance.pwdPublicKey:retl}" />
  201. <property name="enableDruid" value="${canal.instance.enableDruid:false}" />
  202. <property name="defaultDatabaseName" value="${canal.instance.defaultDatabaseName:}" />
  203. </bean>
  204. </property>
  205. <property name="standbyInfo">
  206. <bean class="com.alibaba.otter.canal.parse.support.AuthenticationInfo" init-method="initPwd">
  207. <property name="address" value="${canal.instance.standby2.address}" />
  208. <property name="username" value="${canal.instance.dbUsername:retl}" />
  209. <property name="password" value="${canal.instance.dbPassword:retl}" />
  210. <property name="pwdPublicKey" value="${canal.instance.pwdPublicKey:retl}" />
  211. <property name="enableDruid" value="${canal.instance.enableDruid:false}" />
  212. <property name="defaultDatabaseName" value="${canal.instance.defaultDatabaseName:}" />
  213. </bean>
  214. </property>
  215. <!-- 解析起始位点 -->
  216. <property name="masterPosition">
  217. <bean class="com.alibaba.otter.canal.protocol.position.EntryPosition">
  218. <property name="journalName" value="${canal.instance.master2.journal.name}" />
  219. <property name="position" value="${canal.instance.master2.position}" />
  220. <property name="timestamp" value="${canal.instance.master2.timestamp}" />
  221. <property name="gtid" value="${canal.instance.master2.gtid}" />
  222. </bean>
  223. </property>
  224. <property name="standbyPosition">
  225. <bean class="com.alibaba.otter.canal.protocol.position.EntryPosition">
  226. <property name="journalName" value="${canal.instance.standby2.journal.name}" />
  227. <property name="position" value="${canal.instance.standby2.position}" />
  228. <property name="timestamp" value="${canal.instance.standby2.timestamp}" />
  229. <property name="gtid" value="${canal.instance.standby2.gtid}" />
  230. </bean>
  231. </property>
  232. <property name="filterQueryDml" value="${canal.instance.filter.query.dml:false}" />
  233. <property name="filterQueryDcl" value="${canal.instance.filter.query.dcl:false}" />
  234. <property name="filterQueryDdl" value="${canal.instance.filter.query.ddl:false}" />
  235. <property name="useDruidDdlFilter" value="${canal.instance.filter.druid.ddl:true}" />
  236. <property name="filterDmlInsert" value="${canal.instance.filter.dml.insert:false}" />
  237. <property name="filterDmlUpdate" value="${canal.instance.filter.dml.update:false}" />
  238. <property name="filterDmlDelete" value="${canal.instance.filter.dml.delete:false}" />
  239. <property name="filterRows" value="${canal.instance.filter.rows:false}" />
  240. <property name="filterTableError" value="${canal.instance.filter.table.error:false}" />
  241. <property name="supportBinlogFormats" value="${canal.instance.binlog.format}" />
  242. <property name="supportBinlogImages" value="${canal.instance.binlog.image}" />
  243. <!-- parallel parser -->
  244. <property name="parallel" value="${canal.instance.parser.parallel:true}" />
  245. <property name="parallelThreadSize" value="${canal.instance.parser.parallelThreadSize}" />
  246. <property name="parallelBufferSize" value="${canal.instance.parser.parallelBufferSize:256}" />
  247. <property name="autoResetLatestPosMode" value="${canal.auto.reset.latest.pos.mode:false}" />
  248. </bean>
  249. <bean id="mqConfig" class="com.alibaba.otter.canal.instance.core.CanalMQConfig">
  250. <property name="topic" value="${canal.mq.topic}" />
  251. <property name="dynamicTopic" value="${canal.mq.dynamicTopic}" />
  252. <property name="partition" value="${canal.mq.partition}" />
  253. <property name="partitionsNum" value="${canal.mq.partitionsNum}" />
  254. <property name="partitionHash" value="${canal.mq.partitionHash}" />
  255. <property name="dynamicTopicPartitionNum" value="${canal.mq.dynamicTopicPartitionNum}" />
  256. <property name="enableDynamicQueuePartition" value="${canal.mq.enableDynamicQueuePartition}" />
  257. </bean>
  258. </beans>