我的 Debezium 连接器具有以下 docker-compose.yml 配置:
version: '3.1'
services:
db:
image: mysql
network_mode: host
environment:
MYSQL_ROOT_PASSWORD: 123456
volumes:
- ./mysql.cnf:/etc/mysql/conf.d/mysql.cnf
ports:
- 3306:3306
container_name: mydb
zookeeper:
image: confluentinc/cp-zookeeper
network_mode: host
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
container_name: myzookeeper
kafka:
image: confluentinc/cp-kafka
network_mode: host
depends_on:
- zookeeper
- db
ports:
- "9092:9092"
environment:
KAFKA_ZOOKEEPER_CONNECT: localhost:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_BROKER_ID: 1
KAFKA_MIN_INSYNC_REPLICAS: 1
container_name: mykafka
connector:
image: debezium/connect:0.10
network_mode: host
ports:
- "8083:8083"
environment:
GROUP_ID: 1
CONFIG_STORAGE_TOPIC: my_connect_configs
OFFSET_STORAGE_TOPIC: my_connect_offsets
BOOTSTRAP_SERVERS: localhost:9092
HOST_NAME: localhost
depends_on:
- zookeeper
- db
- kafka
container_name: myconnector
当我想创建连接器时,我收到以下错误:
curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" localhost:8083/connectors/ -d '{ "name": "mystore-connector", "config": { "connector.class": "io.debezium.connector.mysql.MySqlConnector", "tasks.max": "1", "database.hostname": "localhost", "database.port": "3306", "database.user": "morteza", "database.password": "morteza_password", "database.server.id": "223344", "database.server.name": "dbserver1", "database.whitelist": "mystore", "database.history.kafka.bootstrap.servers": "localhost:9092", "database.history.kafka.topic": "dbhistory.mystore" } }'
HTTP/1.1 400 Bad Request
Date: Fri, 08 Mar 2019 09:48:34 GMT
Content-Type: application/json
Content-Length: 255
Server: Jetty(9.4.12.v20180830)
{"error_code":400,"message":"Connector configuration is invalid and contains the following 1 error(s):\nUnable to connect: Public Key Retrieval is not allowed\nYou can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"}
Debezium 连接器显示此错误:
The connection password is empty [io.debezium.connector.mysql.MySqlConnector]
myconnector | 2019-03-08 09:38:26,755 INFO || Failed testing connection for jdbc:mysql://localhost:3306/?useInformationSchema=true&nullCatalogMeansCurrent=false&useSSL=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=CONVERT_TO_NULL with user 'morteza' [io.debezium.connector.mysql.MySqlConnector]
如您所见,我已经设置了该字段的值database.password
,但是我收到了数据库密码错误。