【发布时间】:2018-01-26 20:36:26
【问题描述】:
当我想使用 Kafka 与 Oracle 的源 RDBMS 连接时,数字类型字段被视为如下所示的字节,
已发送值为“4”作为数字的列“ID”,但在消费者控制台上,此值已被视为“ID”:“BA==”
我该怎么做才能解决这个问题?
Kafka 连接使用以下命令启动
connect-standalone ./etc/kafka/connect-standalone.properties /home/kafka/oracle.properties.test
######## connect-standalone.properties
# These are defaults. This file just demonstrates how to override some settings.
bootstrap.servers=kafkaserver01.localdomain:9092
# The converters specify the format of data in Kafka and how to translate it into Connect data. Every Connect user will
# need to configure these based on the format they want their data in when loaded from or stored into Kafka
key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
# Converter-specific settings can be passed in by prefixing the Converter's setting with the converter we want to apply
# it to
key.converter.schemas.enable=true
value.converter.schemas.enable=true
# The internal converter used for offsets and config data is configurable and must be specified, but most users will
# always want to use the built-in default. Offset and config data is never visible outside of Kafka Connect in this format.
internal.key.converter=org.apache.kafka.connect.json.JsonConverter
internal.value.converter=org.apache.kafka.connect.json.JsonConverter
internal.key.converter.schemas.enable=false
internal.value.converter.schemas.enable=false
offset.storage.file.filename=/tmp/connect.offsets
# Flush much faster than normal, which is useful for testing/debugging
offset.flush.interval.ms=10000
######## /home/kafka/oracle.properties.test Configuration File
name=oracle-connect-test1
connector.class=io.confluent.connect.jdbc.JdbcSourceConnector
tasks.max=1
topic.prefix=
connection.url=jdbc:oracle:thin:test/oracle@testsrv01:1521:testdb
table.whitelist=TEST1,TEST2
mode=timestamp
timestamp.column.name=CDC_TIMESTAMP
## Console Consumer
kafka-console-consumer --bootstrap-server kafkaserver01.localdomain:9092 --topic TEST1
谢谢。
【问题讨论】:
-
你使用的是什么版本的 Kafka?这已在此处提到的提交中修复 - github.com/confluentinc/kafka-connect-jdbc/issues/31
-
在服务器日志中 Kafka 版本被视为 0.11.0.0-cp1
-
那是最新版本,很奇怪。你可以在 Kafka group 上询问这个问题,可能会有开发人员回复。
-
应该有一些配置错误。
-
那是Kafka服务器版本。确保您运行的是最新版本的连接器或下载 Confluent 平台 3.3 并使用那里的捆绑版本以确保您拥有最新的连接器版本
标签: apache-kafka apache-kafka-connect