2017-05-19 16 views
1

私はこの問題を数日前から争ってきました。私は、EC2 Ubuntuインスタンスで単純な単一ノードのKafkaインスタンスをセットアップし、トピックを作成し、それらにポスト/消費することができます。しかし、すべてがローカルホストにバインドされているため、これが可能です。それでも、EC2インスタンスのパブリックIPアドレス(たとえばadvertised.listeners=PLAINTEXT://ec2_public_ip:9092)にadvertised.listenersを割り当てようとしたときに、リスナーをローカルホストに設定しようとすると(たとえばlisteners=PLAINTEXT://ec2_internal_ip:9092)、ローカルまたはリモートのコンシューマとプロデューサは接続できません。ローカルマシンからEC2でホストされているKafkaサーバーに接続する

私は、ポートがインスタンスのファイアウォールで開いていることを確認しました。問題なく、飼い猫のポート(2181)にリモートでtelnetできます。

これは簡単な設定の問題のようですが、これを明確にするための例やドキュメントは見つかりませんでした。

ここでEDIT#1server.propertiesファイルから関連情報です:

broker.id=0 
listeners=PLAINTEXT://<internal_ip>:9092 
advertised.listeners=PLAINTEXT://<external_ip>:9092 
zookeeper.connect=localhost:2181 
zookeeper.connection.timeout.ms=6000 

そして、ここで私はそれを実行すると、ログ出力です。

bin/kafka-server-start.sh config/server.properties 
[2017-05-22 15:41:58,909] INFO KafkaConfig values: 
    advertised.host.name = null 
    advertised.listeners = PLAINTEXT://<external_ip>:9092 
    advertised.port = null 
    authorizer.class.name = 
    auto.create.topics.enable = true 
    auto.leader.rebalance.enable = true 
    background.threads = 10 
    broker.id = 0 
    broker.id.generation.enable = true 
    broker.rack = null 
    compression.type = producer 
    connections.max.idle.ms = 600000 
    controlled.shutdown.enable = true 
    controlled.shutdown.max.retries = 3 
    controlled.shutdown.retry.backoff.ms = 5000 
    controller.socket.timeout.ms = 30000 
    create.topic.policy.class.name = null 
    default.replication.factor = 1 
    delete.topic.enable = false 
    fetch.purgatory.purge.interval.requests = 1000 
    group.max.session.timeout.ms = 300000 
    group.min.session.timeout.ms = 6000 
    host.name = 
    inter.broker.listener.name = null 
    inter.broker.protocol.version = 0.10.2-IV0 
    leader.imbalance.check.interval.seconds = 300 
    leader.imbalance.per.broker.percentage = 10 
    listener.security.protocol.map = SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,TRACE:TRACE,SASL_SSL:SASL_SSL,PLAINTEXT:PLAINTEXT 
    listeners = PLAINTEXT://<internal_ip>:9092 
    log.cleaner.backoff.ms = 15000 
    log.cleaner.dedupe.buffer.size = 134217728 
    log.cleaner.delete.retention.ms = 86400000 
    log.cleaner.enable = true 
    log.cleaner.io.buffer.load.factor = 0.9 
    log.cleaner.io.buffer.size = 524288 
    log.cleaner.io.max.bytes.per.second = 1.7976931348623157E308 
    log.cleaner.min.cleanable.ratio = 0.5 
    log.cleaner.min.compaction.lag.ms = 0 
    log.cleaner.threads = 1 
    log.cleanup.policy = [delete] 
    log.dir = /tmp/kafka-logs 
    log.dirs = /tmp/kafka-logs 
    log.flush.interval.messages = 9223372036854775807 
    log.flush.interval.ms = null 
    log.flush.offset.checkpoint.interval.ms = 60000 
    log.flush.scheduler.interval.ms = 9223372036854775807 
    log.index.interval.bytes = 4096 
    log.index.size.max.bytes = 10485760 
    log.message.format.version = 0.10.2-IV0 
    log.message.timestamp.difference.max.ms = 9223372036854775807 
    log.message.timestamp.type = CreateTime 
    log.preallocate = false 
    log.retention.bytes = -1 
    log.retention.check.interval.ms = 300000 
    log.retention.hours = 168 
    log.retention.minutes = null 
    log.retention.ms = null 
    log.roll.hours = 168 
    log.roll.jitter.hours = 0 
    log.roll.jitter.ms = null 
    log.roll.ms = null 
    log.segment.bytes = 1073741824 
    log.segment.delete.delay.ms = 60000 
    max.connections.per.ip = 2147483647 
    max.connections.per.ip.overrides = 
    message.max.bytes = 1000012 
    metric.reporters = [] 
    metrics.num.samples = 2 
    metrics.recording.level = INFO 
    metrics.sample.window.ms = 30000 
    min.insync.replicas = 1 
    num.io.threads = 8 
    num.network.threads = 3 
    num.partitions = 1 
    num.recovery.threads.per.data.dir = 1 
    num.replica.fetchers = 1 
    offset.metadata.max.bytes = 4096 
    offsets.commit.required.acks = -1 
    offsets.commit.timeout.ms = 5000 
    offsets.load.buffer.size = 5242880 
    offsets.retention.check.interval.ms = 600000 
    offsets.retention.minutes = 1440 
    offsets.topic.compression.codec = 0 
    offsets.topic.num.partitions = 50 
    offsets.topic.replication.factor = 3 
    offsets.topic.segment.bytes = 104857600 
    port = 9092 
    principal.builder.class = class org.apache.kafka.common.security.auth.DefaultPrincipalBuilder 
    producer.purgatory.purge.interval.requests = 1000 
    queued.max.requests = 500 
    quota.consumer.default = 9223372036854775807 
    quota.producer.default = 9223372036854775807 
    quota.window.num = 11 
    quota.window.size.seconds = 1 
    replica.fetch.backoff.ms = 1000 
    replica.fetch.max.bytes = 1048576 
    replica.fetch.min.bytes = 1 
    replica.fetch.response.max.bytes = 10485760 
    replica.fetch.wait.max.ms = 500 
    replica.high.watermark.checkpoint.interval.ms = 5000 
    replica.lag.time.max.ms = 10000 
    replica.socket.receive.buffer.bytes = 65536 
    replica.socket.timeout.ms = 30000 
    replication.quota.window.num = 11 
    replication.quota.window.size.seconds = 1 
    request.timeout.ms = 30000 
    reserved.broker.max.id = 1000 
    sasl.enabled.mechanisms = [GSSAPI] 
    sasl.kerberos.kinit.cmd = /usr/bin/kinit 
    sasl.kerberos.min.time.before.relogin = 60000 
    sasl.kerberos.principal.to.local.rules = [DEFAULT] 
    sasl.kerberos.service.name = null 
    sasl.kerberos.ticket.renew.jitter = 0.05 
    sasl.kerberos.ticket.renew.window.factor = 0.8 
    sasl.mechanism.inter.broker.protocol = GSSAPI 
    security.inter.broker.protocol = PLAINTEXT 
    socket.receive.buffer.bytes = 102400 
    socket.request.max.bytes = 104857600 
    socket.send.buffer.bytes = 102400 
    ssl.cipher.suites = null 
    ssl.client.auth = none 
    ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1] 
    ssl.endpoint.identification.algorithm = null 
    ssl.key.password = null 
    ssl.keymanager.algorithm = SunX509 
    ssl.keystore.location = null 
    ssl.keystore.password = null 
    ssl.keystore.type = JKS 
    ssl.protocol = TLS 
    ssl.provider = null 
    ssl.secure.random.implementation = null 
    ssl.trustmanager.algorithm = PKIX 
    ssl.truststore.location = null 
    ssl.truststore.password = null 
    ssl.truststore.type = JKS 
    unclean.leader.election.enable = true 
    zookeeper.connect = localhost:2181 
    zookeeper.connection.timeout.ms = 6000 
    zookeeper.session.timeout.ms = 6000 
    zookeeper.set.acl = false 
    zookeeper.sync.time.ms = 2000 
(kafka.server.KafkaConfig) 
[2017-05-22 15:41:58,951] INFO starting (kafka.server.KafkaServer) 
[2017-05-22 15:41:58,952] INFO Connecting to zookeeper on localhost:2181 (kafka.server.KafkaServer) 
[2017-05-22 15:41:58,965] INFO Starting ZkClient event thread. (org.I0Itec.zkclient.ZkEventThread) 
[2017-05-22 15:41:58,971] INFO Client environment:zookeeper.version=3.4.9-1757313, built on 08/23/2016 06:50 GMT (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:host.name=<internal_ip>.ec2.internal (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:java.version=1.8.0_121 (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:java.vendor=Oracle Corporation (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:java.home=/usr/lib/jvm/java-8-oracle/jre (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:java.class.path=:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/aopalliance-repackaged-2.5.0-b05.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/argparse4j-0.7.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/connect-api-0.10.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/connect-file-0.10.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/connect-json-0.10.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/connect-runtime-0.10.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/connect-transforms-0.10.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/guava-18.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/hk2-api-2.5.0-b05.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/hk2-locator-2.5.0-b05.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/hk2-utils-2.5.0-b05.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jackson-annotations-2.8.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jackson-annotations-2.8.5.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jackson-core-2.8.5.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jackson-databind-2.8.5.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jackson-jaxrs-base-2.8.5.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jackson-jaxrs-json-provider-2.8.5.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jackson-module-jaxb-annotations-2.8.5.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/javassist-3.20.0-GA.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/javax.annotation-api-1.2.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/javax.inject-1.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/javax.inject-2.5.0-b05.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/javax.servlet-api-3.1.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/javax.ws.rs-api-2.0.1.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jersey-client-2.24.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jersey-common-2.24.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jersey-container-servlet-2.24.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jersey-container-servlet-core-2.24.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jersey-guava-2.24.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jersey-media-jaxb-2.24.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jersey-server-2.24.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jetty-continuation-9.2.15.v20160210.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jetty-http-9.2.15.v20160210.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jetty-io-9.2.15.v20160210.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jetty-security-9.2.15.v20160210.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jetty-server-9.2.15.v20160210.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jetty-servlet-9.2.15.v20160210.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jetty-servlets-9.2.15.v20160210.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jetty-util-9.2.15.v20160210.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/jopt-simple-5.0.3.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/kafka_2.11-0.10.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/kafka_2.11-0.10.2.0-sources.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/kafka_2.11-0.10.2.0-test-sources.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/kafka-clients-0.10.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/kafka-log4j-appender-0.10.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/kafka-streams-0.10.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/kafka-streams-examples-0.10.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/kafka-tools-0.10.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/log4j-1.2.17.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/lz4-1.3.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/metrics-core-2.2.0.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/osgi-resource-locator-1.0.1.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/reflections-0.9.10.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/rocksdbjni-5.0.1.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/scala-library-2.11.8.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/scala-parser-combinators_2.11-1.0.4.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/slf4j-api-1.7.21.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/slf4j-log4j12-1.7.21.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/snappy-java-1.1.2.6.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/validation-api-1.1.0.Final.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/zkclient-0.10.jar:/home/ubuntu/kafka_2.11-0.10.2.0/bin/../libs/zookeeper-3.4.9.jar (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:java.io.tmpdir=/tmp (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:java.compiler=<NA> (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:os.name=Linux (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:os.arch=amd64 (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:os.version=4.4.0-36-generic (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:user.name=ubuntu (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:user.home=/home/ubuntu (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,971] INFO Client environment:user.dir=/home/ubuntu/kafka_2.11-0.10.2.0 (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,972] INFO Initiating client connection, connectString=localhost:2181 sessionTimeout=6000 [email protected] (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:58,983] INFO Waiting for keeper state SyncConnected (org.I0Itec.zkclient.ZkClient) 
[2017-05-22 15:41:58,986] INFO Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn) 
[2017-05-22 15:41:58,990] INFO Socket connection established to localhost/127.0.0.1:2181, initiating session (org.apache.zookeeper.ClientCnxn) 
[2017-05-22 15:41:59,010] INFO Session establishment complete on server localhost/127.0.0.1:2181, sessionid = 0x15c30cd33890000, negotiated timeout = 6000 (org.apache.zookeeper.ClientCnxn) 
[2017-05-22 15:41:59,011] INFO zookeeper state changed (SyncConnected) (org.I0Itec.zkclient.ZkClient) 
[2017-05-22 15:41:59,114] INFO Cluster ID = l-wScqxkQ9OIoKkySSuuLQ (kafka.server.KafkaServer) 
[2017-05-22 15:41:59,145] INFO [ThrottledRequestReaper-Fetch], Starting (kafka.server.ClientQuotaManager$ThrottledRequestReaper) 
[2017-05-22 15:41:59,146] INFO [ThrottledRequestReaper-Produce], Starting (kafka.server.ClientQuotaManager$ThrottledRequestReaper) 
[2017-05-22 15:41:59,205] INFO Loading logs. (kafka.log.LogManager) 
[2017-05-22 15:41:59,240] INFO Completed load of log __consumer_offsets-39 with 1 log segments and log end offset 0 in 17 ms (kafka.log.Log) 
[2017-05-22 15:41:59,245] INFO Completed load of log __consumer_offsets-1 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,248] INFO Completed load of log __consumer_offsets-40 with 1 log segments and log end offset 0 in 0 ms (kafka.log.Log) 
[2017-05-22 15:41:59,251] INFO Completed load of log __consumer_offsets-34 with 1 log segments and log end offset 0 in 2 ms (kafka.log.Log) 
[2017-05-22 15:41:59,253] INFO Completed load of log __consumer_offsets-35 with 1 log segments and log end offset 0 in 0 ms (kafka.log.Log) 
[2017-05-22 15:41:59,261] INFO Completed load of log __consumer_offsets-15 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,266] INFO Completed load of log __consumer_offsets-20 with 1 log segments and log end offset 91 in 3 ms (kafka.log.Log) 
[2017-05-22 15:41:59,269] INFO Completed load of log __consumer_offsets-48 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,271] INFO Completed load of log __consumer_offsets-32 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,274] INFO Completed load of log __consumer_offsets-46 with 1 log segments and log end offset 144 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,279] INFO Completed load of log __consumer_offsets-22 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,281] INFO Completed load of log __consumer_offsets-8 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,283] INFO Completed load of log __consumer_offsets-12 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,285] INFO Completed load of log __consumer_offsets-19 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,287] INFO Completed load of log __consumer_offsets-21 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,290] INFO Completed load of log __consumer_offsets-4 with 1 log segments and log end offset 0 in 0 ms (kafka.log.Log) 
[2017-05-22 15:41:59,292] INFO Completed load of log __consumer_offsets-5 with 1 log segments and log end offset 0 in 0 ms (kafka.log.Log) 
[2017-05-22 15:41:59,295] INFO Completed load of log __consumer_offsets-41 with 1 log segments and log end offset 852 in 2 ms (kafka.log.Log) 
[2017-05-22 15:41:59,298] INFO Completed load of log __consumer_offsets-23 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,301] INFO Completed load of log __consumer_offsets-25 with 1 log segments and log end offset 49 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,304] INFO Completed load of log __consumer_offsets-2 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,307] INFO Completed load of log __consumer_offsets-26 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,310] INFO Completed load of log __consumer_offsets-24 with 1 log segments and log end offset 0 in 0 ms (kafka.log.Log) 
[2017-05-22 15:41:59,312] INFO Completed load of log __consumer_offsets-49 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,316] INFO Completed load of log matt-0 with 1 log segments and log end offset 13 in 2 ms (kafka.log.Log) 
[2017-05-22 15:41:59,319] INFO Completed load of log __consumer_offsets-14 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,322] INFO Completed load of log __consumer_offsets-16 with 1 log segments and log end offset 6 in 2 ms (kafka.log.Log) 
[2017-05-22 15:41:59,324] INFO Completed load of log __consumer_offsets-31 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,327] INFO Completed load of log __consumer_offsets-29 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,329] INFO Completed load of log __consumer_offsets-10 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,333] INFO Completed load of log __consumer_offsets-7 with 1 log segments and log end offset 19 in 2 ms (kafka.log.Log) 
[2017-05-22 15:41:59,337] INFO Completed load of log __consumer_offsets-47 with 1 log segments and log end offset 288 in 3 ms (kafka.log.Log) 
[2017-05-22 15:41:59,340] INFO Completed load of log __consumer_offsets-36 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,343] INFO Completed load of log __consumer_offsets-28 with 1 log segments and log end offset 0 in 0 ms (kafka.log.Log) 
[2017-05-22 15:41:59,345] INFO Completed load of log __consumer_offsets-27 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,348] INFO Completed load of log __consumer_offsets-9 with 1 log segments and log end offset 268 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,350] INFO Completed load of log __consumer_offsets-37 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,353] INFO Completed load of log __consumer_offsets-6 with 1 log segments and log end offset 3 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,357] INFO Completed load of log __consumer_offsets-0 with 1 log segments and log end offset 129 in 3 ms (kafka.log.Log) 
[2017-05-22 15:41:59,359] INFO Completed load of log __consumer_offsets-42 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,362] INFO Completed load of log __consumer_offsets-33 with 1 log segments and log end offset 0 in 0 ms (kafka.log.Log) 
[2017-05-22 15:41:59,364] INFO Completed load of log __consumer_offsets-13 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,366] INFO Completed load of log __consumer_offsets-3 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,369] INFO Completed load of log __consumer_offsets-11 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,371] INFO Completed load of log __consumer_offsets-45 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,374] INFO Completed load of log __consumer_offsets-44 with 1 log segments and log end offset 38 in 2 ms (kafka.log.Log) 
[2017-05-22 15:41:59,376] INFO Completed load of log __consumer_offsets-43 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,379] INFO Completed load of log __consumer_offsets-18 with 1 log segments and log end offset 24 in 2 ms (kafka.log.Log) 
[2017-05-22 15:41:59,382] INFO Completed load of log __consumer_offsets-38 with 1 log segments and log end offset 11 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,384] INFO Completed load of log __consumer_offsets-17 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,387] INFO Completed load of log test-0 with 1 log segments and log end offset 6 in 2 ms (kafka.log.Log) 
[2017-05-22 15:41:59,388] INFO Completed load of log __consumer_offsets-30 with 1 log segments and log end offset 0 in 0 ms (kafka.log.Log) 
[2017-05-22 15:41:59,390] INFO Completed load of log remote_matt-0 with 1 log segments and log end offset 0 in 1 ms (kafka.log.Log) 
[2017-05-22 15:41:59,392] INFO Logs loading complete in 186 ms. (kafka.log.LogManager) 
[2017-05-22 15:41:59,442] INFO Starting log cleanup with a period of 300000 ms. (kafka.log.LogManager) 
[2017-05-22 15:41:59,443] INFO Starting log flusher with a default period of 9223372036854775807 ms. (kafka.log.LogManager) 
[2017-05-22 15:41:59,477] FATAL [Kafka Server 0], Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer) 
kafka.common.KafkaException: Socket server failed to bind to <internal_ip>:9092: Cannot assign requested address. 
    at kafka.network.Acceptor.openServerSocket(SocketServer.scala:330) 
    at kafka.network.Acceptor.<init>(SocketServer.scala:255) 
    at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala:98) 
    at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala:90) 
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) 
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) 
    at kafka.network.SocketServer.startup(SocketServer.scala:90) 
    at kafka.server.KafkaServer.startup(KafkaServer.scala:215) 
    at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:39) 
    at kafka.Kafka$.main(Kafka.scala:67) 
    at kafka.Kafka.main(Kafka.scala) 
Caused by: java.net.BindException: Cannot assign requested address 
    at sun.nio.ch.Net.bind0(Native Method) 
    at sun.nio.ch.Net.bind(Net.java:433) 
    at sun.nio.ch.Net.bind(Net.java:425) 
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) 
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) 
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67) 
    at kafka.network.Acceptor.openServerSocket(SocketServer.scala:326) 
    ... 10 more 
[2017-05-22 15:41:59,480] INFO [Kafka Server 0], shutting down (kafka.server.KafkaServer) 
[2017-05-22 15:41:59,482] INFO [Socket Server on Broker 0], Shutting down (kafka.network.SocketServer) 
[2017-05-22 15:41:59,486] INFO [Socket Server on Broker 0], Shutdown completed (kafka.network.SocketServer) 
[2017-05-22 15:41:59,489] INFO Shutting down. (kafka.log.LogManager) 
[2017-05-22 15:41:59,520] INFO Shutdown complete. (kafka.log.LogManager) 
[2017-05-22 15:41:59,521] INFO Terminate ZkClient event thread. (org.I0Itec.zkclient.ZkEventThread) 
[2017-05-22 15:41:59,525] INFO Session: 0x15c30cd33890000 closed (org.apache.zookeeper.ZooKeeper) 
[2017-05-22 15:41:59,526] INFO EventThread shut down for session: 0x15c30cd33890000 (org.apache.zookeeper.ClientCnxn) 
[2017-05-22 15:41:59,527] INFO [Kafka Server 0], shut down completed (kafka.server.KafkaServer) 
[2017-05-22 15:41:59,528] FATAL Fatal error during KafkaServerStartable startup. Prepare to shutdown (kafka.server.KafkaServerStartable) 
kafka.common.KafkaException: Socket server failed to bind to <internal_ip>:9092: Cannot assign requested address. 
    at kafka.network.Acceptor.openServerSocket(SocketServer.scala:330) 
    at kafka.network.Acceptor.<init>(SocketServer.scala:255) 
    at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala:98) 
    at kafka.network.SocketServer$$anonfun$startup$1.apply(SocketServer.scala:90) 
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59) 
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48) 
    at kafka.network.SocketServer.startup(SocketServer.scala:90) 
    at kafka.server.KafkaServer.startup(KafkaServer.scala:215) 
    at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:39) 
    at kafka.Kafka$.main(Kafka.scala:67) 
    at kafka.Kafka.main(Kafka.scala) 
Caused by: java.net.BindException: Cannot assign requested address 
    at sun.nio.ch.Net.bind0(Native Method) 
    at sun.nio.ch.Net.bind(Net.java:433) 
    at sun.nio.ch.Net.bind(Net.java:425) 
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223) 
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) 
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:67) 
    at kafka.network.Acceptor.openServerSocket(SocketServer.scala:326) 
    ... 10 more 
[2017-05-22 15:41:59,528] INFO [Kafka Server 0], shutting down (kafka.server.KafkaServer) 

EDIT#2他のノードに移動した飼い犬を巻き上げ、すべてをクリアした。私はまだ、動物園とKafkaサービスが同じインスタンス上で実行できない理由についてはまだ分かりません。

答えて

0

listenersおよびadvertised.listenersの設定が正しいようです。また、ポート9092(カフカブローカー用)を公開しましたか?私はここに掲載前の同様の問題に私の解決策を基づかい

+0

をうん、それは私が考えたものだが、私は、コンソールをチェックし、ポートがすべてのIPのために開いています。私はいくつかのログ出力で私のポストを更新しました。 – duanemat

0

Why I cannot connect to Kafka from outside?

カフカよくある質問は言う:

ブローカが起動すると、それはそのIP /ポートを登録しますZK。 登録されたIPがプロデューサ設定の metadata.broker.listにリストされているものと一致していることを確認する必要があります。デフォルトでは、 の登録済みIPは、InetAddress.getLocalHost.getHostAddressによって指定されます。 通常、これはホストの実際のIPを返します。ただし、(EC2などの) の場合、返されたIPは内部のものであり、 を外部から接続することはできません。これを解決するには、 server.propertiesの "hostname"プロパティを設定して、 ホストIPをZKに明示的に設定する必要があります。まれに、バインディングホスト/ポートがクライアント接続用のホスト/ポートと異なる である場合、 advertised.host.nameとadvertised.portをクライアント接続用に設定できます。

server.propertiesファイルで明示的にホストを設定するには、(私が参照している質問のコメントの1つに示されているように)変数host.nameを変更する必要があります。あなたのログに

私が見ることができます:

advertised.host.name = null 

host.name = 

[2017-05-22 15:41:58,971] INFO Client environment:host.name=<internal_ip>.ec2.internal (org.apache.zookeeper.ZooKeeper) 

私は、これはあなたを助けることができると思います。

+0

これらの変更は役に立たないようですが、私は最終的に飼い猫を別のサーバーに移動させました。それが問題を解決するように見えました。私は、カフカサーバーがオープンポートに接続できないようにポートを正しく構成しなかったという問題があると仮定します。それでも、localhostで問題ないと思われるので、同じサーバー上に共存できないのは変です。 – duanemat

0

私は同じ問題を持っていたし、それは zookeeper.connect = [パブリック-IP]の設定によって修正されました:2181

関連する問題