Kafka Connect JDBC Source OutOfMemoryError

时间:2018-05-29 19:09:02

标签: jdbc apache-kafka apache-kafka-connect confluent

我使用Confluent JDBC-Source connector运行以下作业:

{
    "name": "jobName",
    "config": {
        "connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
        "mode": "timestamp",
        "timestamp.column.name": "dateColumn",
        "topic.prefix": "connect-test.",
        "connection.password": "pw",
        "tasks.max": "1",
        "connection.user": "un",
        "poll.interval.ms": "300000",
        "name": "jobName",
        "connection.url": "jdbc:sqlserver://serverName;Database=dbName;user=un;password=pw",
        "table.whitelist": "tableName"
    }
}

我有一个类似的Kafka-Connect作业针对同一个数据库和同一个用户成功运行,但是有另一个较小的表。所以连接不是问题。

在运行作业的Kafka-connect服务器上的日志中,我看到了:

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "KafkaBasedLog Work Thread - connect-configs"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "kafka-coordinator-heartbeat-thread | connect-cluster"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "kafka-producer-network-thread | producer-1"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "KafkaBasedLog Work Thread - connect-offsets"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "kafka-producer-network-thread | producer-3"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "pool-4-thread-1"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "kafka-producer-network-thread | producer-2"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "KafkaBasedLog Work Thread - connect-status"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "DistributedHerder"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "pool-1-thread-5"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "org.eclipse.jetty.server.session.HashSessionManager@2c243a24Timer"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "qtp1434297727-21"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "qtp1434297727-26"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "qtp1434297727-27"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "kafka-producer-network-thread | producer-14"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "kafka-producer-network-thread | producer-15"

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "pool-1-thread-4"

所以,继续下去并不多。运行此作业的服务器现在没有响应,并且没有响应REST调用。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

你需要

  1. 通过SSH登录每个连接工作者,或者你到达那里
  2. 强行停止Kafka Connect流程
  3. export KAFKA_HEAP_OPTS大于运行Kafka Connect的每台服务器上的默认值。例如KAFKA_HEAP_OPTS="-Xms512M -Xmx4G"。假设Linux,那么最佳位置将是kafka用户的bashrc文件。
  4. 再次以导出
  5. 变量的用户身份再次运行connect-distributed

    您可能还想导出更多值以启用JMX。这样,您就可以在崩溃之前监控进程