Debezium MySQL错误:连接密码为空

时间:2019-03-08 09:55:04

标签: apache-kafka apache-kafka-connect debezium

我的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的值,但是收到数据库密码错误。

2 个答案:

答案 0 :(得分:0)

按照Jiri Pechanec的建议,我在docker-compose.yml文件中将image: mysql更改为image: mysql:5.7,现在可以正常使用了。

答案 1 :(得分:0)

当未向源MySQL数据库中的用户授予必需的特权时,在Debezium 0.9中可能会发生此错误(df2 %>% arrange(ID, as.Date(DOB)) %>% group_by(ID) %>% mutate(birthOrder = match(DOB, unique(DOB))) # A tibble: 7 x 3 # Groups: ID [3] # ID DOB birthOrder # <int> <chr> <int> #1 111 1994-08-08 1 #2 429 1995-09-20 1 #3 429 2001-01-08 2 #4 429 2001-01-08 2 #5 535 1994-03-06 1 #6 535 1999-06-12 2 #7 535 2001-04-06 3 。在Debezium 0.8中,错误为Public Key Retrieval is not allowed

我在这里写了一个quick blog,因为我遇到了这个问题,错误消息有点不明显:)