debezium mysql错误:连接密码为空

kupeojn6  于 2021-06-06  发布在  Kafka
关注(0)|答案(2)|浏览(486)

我的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 如您所见,但是我收到了数据库密码的错误。

tjrkku2a

tjrkku2a1#

正如jiri pechanec所建议的,我改变了 image: mysqlimage: mysql:5.7 在docker-compose.yml文件中,现在可以正常工作了。

soat7uwm

soat7uwm2#

此错误( Public Key Retrieval is not allowed )在debezium0.9中,当源mysql数据库中的用户没有被授予所需的权限时,可能会出现这种情况。在debezium 0.8中,错误是 Unable to connect: Communications link failure .
我在这里写了一篇关于这个问题的博客,因为我遇到了这个问题,错误信息有点不明显:)

相关问题