Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-1712

MySQL connector doesn't use default value of connector.port

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 1.0.1.Final, 1.1.0.Beta1
    • 0.1, 0.9.5.Final, 0.10.0.Alpha1, 0.10.0.Alpha2, 0.10.0.Beta1, 0.10.0.Beta2, 0.10.0.Beta3, 0.10.0.Beta4, 0.10.0.CR1, 0.10.0.CR2, 0.10.0.Final, 1.0.0.Beta1, 1.0.0.Beta2, 1.0.0.Beta3, 1.0.0.CR1, 1.0.0.Final
    • mysql-connector
    • None
    • Hide

      Start Zookeeper

      docker run -d --rm --name zookeeper -p 2181:2181 -p 2888:2888 -p 3888:3888 debezium/zookeeper
      

      Start Kafka

      docker run -d --rm --name kafka -p 9092:9092 --link zookeeper:zookeeper debezium/kafka
      

      Start Connect

      docker run -it --rm --name connect -p 5005:5005 -p 8083:8083 \
      -e GROUP_ID=1 \
      -e CONFIG_STORAGE_TOPIC=my_connect_configs \
      -e OFFSET_STORAGE_TOPIC=my_connect_offsets \
      -e STATUS_STORAGE_TOPIC=my_connect_statuses \
      --link zookeeper:zookeeper --link kafka:kafka \
      debezium/connect
      

      Create connector config with missing port number

      cat << 'EOF' > /tmp/connector-config.json
      {
        "name": "debezium",
        "config": {
          "connector.class": "io.debezium.connector.mysql.MySqlConnector",
          "database.hostname": "172.17.0.1",
          "database.user": "debezium",
          "database.password": "dbz",
          "database.server.name": "dbz",
          "database.whitelist": "debezium_test",
          "table.whitelist": "debezium_test.sample",
          "database.history.kafka.topic": "history",
          "database.history.kafka.bootstrap.servers": "kafka:9092",
          "include.schema.changes": "false",
          "heartbeat.interval.ms": 1000
        }
      }
      EOF
      

      Deploy connector with above config

      curl -X POST -H "Accept:application/json" -H "Content-Type:application/json" localhost:8083/connectors/ -d @/tmp/connector-config.json
      
      Show
      Start Zookeeper docker run -d --rm --name zookeeper -p 2181:2181 -p 2888:2888 -p 3888:3888 debezium/zookeeper Start Kafka docker run -d --rm --name kafka -p 9092:9092 --link zookeeper:zookeeper debezium/kafka Start Connect docker run -it --rm --name connect -p 5005:5005 -p 8083:8083 \ -e GROUP_ID=1 \ -e CONFIG_STORAGE_TOPIC=my_connect_configs \ -e OFFSET_STORAGE_TOPIC=my_connect_offsets \ -e STATUS_STORAGE_TOPIC=my_connect_statuses \ --link zookeeper:zookeeper --link kafka:kafka \ debezium/connect Create connector config with missing port number cat << 'EOF' > /tmp/connector-config.json { "name": "debezium", "config": { "connector.class": "io.debezium.connector.mysql.MySqlConnector", "database.hostname": "172.17.0.1", "database.user": "debezium", "database.password": "dbz", "database.server.name": "dbz", "database.whitelist": "debezium_test", "table.whitelist": "debezium_test.sample", "database.history.kafka.topic": "history", "database.history.kafka.bootstrap.servers": "kafka:9092", "include.schema.changes": "false", "heartbeat.interval.ms": 1000 } } EOF Deploy connector with above config curl -X POST -H "Accept:application/json" -H "Content-Type:application/json" localhost:8083/connectors/ -d @/tmp/connector-config.json

    Description

      Not passing database.port: "3306" results in an exception for MySQL connector. This is not expected since a default value is defined.

      {
        "error_code": 400,
        "message": "Connector configuration is invalid and contains the following 2 error(s):
      Unable to connect: Cannot load connection class because of underlying exception:
      com.mysql.cj.exceptions.WrongArgumentException: Failed to parse the host:port pair '172.17.0.1:${port}'.
      A value is required
      You can also find the above list of errors at the endpoint `/{connectorType}/config/validate`"
      }
      

      And with TRACE logs I see:

      2020-01-13 10:52:08,907 TRACE  ||  Config: {useLegacyDatetimeCode=false, hostname=172.17.0.1, user=debezium, password=dbz, server.name=dbz, white
      list=debezium_test, useSSL=false}   [io.debezium.jdbc.JdbcConnection]
      2020-01-13 10:52:08,908 TRACE  ||  Props: {useLegacyDatetimeCode=false, user=debezium, password=dbz, server.name=dbz, whitelist=debezium_test}
      [io.debezium.jdbc.JdbcConnection]
      2020-01-13 10:52:08,908 TRACE  ||  URL: jdbc:mysql://172.17.0.1:${port}/?useInformationSchema=true&nullCatalogMeansCurrent=false&useSSL=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=CONVERT_TO_NULL   [io.debezium.jdbc.JdbcConnection]
      2020-01-13 10:52:08,918 TRACE  ||  Class 'com.mysql.cj.LocalizedErrorMessages' not found. Delegating to parent   [org.apache.kafka.connect.runtime.isolation.PluginClassLoader]
      2020-01-13 10:52:08,925 TRACE  ||  Class 'com.mysql.cj.LocalizedErrorMessages_en' not found. Delegating to parent   [org.apache.kafka.connect.runtime.isolation.PluginClassLoader]
      2020-01-13 10:52:08,926 TRACE  ||  Class 'com.mysql.cj.LocalizedErrorMessages_en_US' not found. Delegating to parent   [org.apache.kafka.connect.runtime.isolation.PluginClassLoader]
      2020-01-13 10:52:08,931 INFO   ||  Failed testing connection for jdbc:mysql://172.17.0.1:${port}/?useInformationSchema=true&nullCatalogMeansCurre
      nt=false&useSSL=false&useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&zeroDateTimeBehavior=CONVERT_TO_NULL with user 'debezium'
         [io.debezium.connector.mysql.MySqlConnector]
      

      Attachments

        Activity

          People

            ccranfor@redhat.com Chris Cranford
            hashhar Ashhar Hasan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: