<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Problem of Creating Topics in Kafka with Kerberos in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140933#M103540</link>
    <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11149/dbains.html" nodeid="11149"&gt;@dbains&lt;/A&gt;, &lt;A rel="user" href="https://community.cloudera.com/users/188/mthiele.html" nodeid="188"&gt;@mthiele&lt;/A&gt;, &lt;A rel="user" href="https://community.cloudera.com/users/3675/dkozlowski.html" nodeid="3675"&gt;@Daniel Kozlowski&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Thank you. It works when created as kafka user.&lt;/P&gt;&lt;P&gt;To summarize all the steps -- from Ambari configs, to creating topic, granting permission and testing on kafka console producer/consumer scripts, I created this article &lt;A href="https://community.hortonworks.com/articles/79923/step-by-step-recipe-for-securing-kafka-with-kerber.html"&gt;Step by Step Recipe for Securing Kafka with Kerberos&lt;/A&gt;. Hope it saves others' time &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 26 Jan 2017 18:23:50 GMT</pubDate>
    <dc:creator>yjiang</dc:creator>
    <dc:date>2017-01-26T18:23:50Z</dc:date>
    <item>
      <title>Problem of Creating Topics in Kafka with Kerberos</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140924#M103531</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;After enabled Kerberos using Ambari, I got problem creating topics in Kafka using the kafka-topics.sh script. The topic was created, but its status is wrong without leader. It seems the topic is created with PLAINTEXT, while there is only PLAINTEXTSASL broker in the cluster after enabled Kerberos. The only configuration change I made is to chagne broker listener from 'PLAINTEXT://localhost:6667' to 'PLAINTEXTSASL://localhost:6667'. As posted in &lt;A href="https://community.hortonworks.com/questions/78843/problems-with-kafka-scripts-after-enabled-kerberos.html"&gt;this question&lt;/A&gt;, I also changed the kafka-topics.sh to make it work with Kerberos. I am using HDP2.5.3.&lt;/P&gt;&lt;PRE&gt;$ ./kafka-topics.sh --zookeeper ip-10-0-0-149.ap-northeast-1.compute.internal --create --partitions 1 --replication-factor 1 --topic mytopic
Created topic "mytopic".

$ ./kafka-topics.sh --zookeeper ip-10-0-0-149.ap-northeast-1.compute.internal --describe --topic mytopic
Topic:mytopic	PartitionCount:1	ReplicationFactor:1	Configs:
	Topic: mytopic	Partition: 0	Leader: none	Replicas: 1001	Isr:

&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Jan 2017 19:49:39 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140924#M103531</guid>
      <dc:creator>yjiang</dc:creator>
      <dc:date>2017-01-22T19:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of Creating Topics in Kafka with Kerberos</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140925#M103532</link>
      <description>&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/274/yjiang.html"&gt;yjiang&lt;/A&gt; Could you please tell, as which user did you create the topic? Also could you please provide your server.properties file?&lt;/P&gt;</description>
      <pubDate>Sun, 22 Jan 2017 19:55:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140925#M103532</guid>
      <dc:creator>dbains</dc:creator>
      <dc:date>2017-01-22T19:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of Creating Topics in Kafka with Kerberos</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140926#M103533</link>
      <description>&lt;P&gt;When you use a script, command, or API to create a topic, an entry is created under ZooKeeper. The only user with access to ZooKeeper is the service account running Kafka (by default, &lt;CODE&gt;kafka&lt;/CODE&gt;). Therefore, the first step toward creating a Kafka topic on a secure cluster is to run &lt;CODE&gt;kinit&lt;/CODE&gt;, specifying the Kafka service keytab. The second step is to create the topic.&lt;/P&gt;&lt;OL&gt;
&lt;LI&gt;Run &lt;CODE&gt;kinit&lt;/CODE&gt;, specifying the Kafka service keytab. For example:&lt;P&gt;&lt;CODE&gt;kinit -k -t /etc/security/keytabs/kafka.service.keytab kafka/c6401.ambari.apache.org@EXAMPLE.COM&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;Next, create the topic. Run the &lt;CODE&gt;kafka-topics.sh&lt;/CODE&gt; command-line tool with the following options:&lt;P&gt;&lt;CODE&gt;/bin/kafka-topics.sh --zookeeper &amp;lt;hostname&amp;gt;:&amp;lt;port&amp;gt; --create --topic &amp;lt;topic-name&amp;gt; --partitions &amp;lt;number-of-partitions&amp;gt; --replication-factor &amp;lt;number-of-replicating-servers&amp;gt;&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;For example: &lt;/P&gt;&lt;PRE&gt;/bin/kafka-topics.sh --zookeeper c6401.ambari.apache.org:2181 --create --topic test_topic --partitions 2 --replication-factor 2

Created topic "test_topic".&lt;/PRE&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Mon, 23 Jan 2017 10:24:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140926#M103533</guid>
      <dc:creator>mthiele1</dc:creator>
      <dc:date>2017-01-23T10:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of Creating Topics in Kafka with Kerberos</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140927#M103534</link>
      <description>&lt;P&gt;I created the topic using a normal user (not the 'kafka' service user). Do I need to use 'kafka' user to create the topic?&lt;/P&gt;&lt;P&gt;Below is my server.properties.&lt;/P&gt;&lt;PRE&gt;advertised.listeners=PLAINTEXTSASL://ip-10-0-0-149.ap-northeast-1.compute.internal:6667
authorizer.class.name=org.apache.ranger.authorization.kafka.authorizer.RangerKafkaAuthorizer
auto.create.topics.enable=true
auto.leader.rebalance.enable=true
compression.type=producer
controlled.shutdown.enable=true
controlled.shutdown.max.retries=3
controlled.shutdown.retry.backoff.ms=5000
controller.message.queue.size=10
controller.socket.timeout.ms=30000
default.replication.factor=1
delete.topic.enable=false
external.kafka.metrics.exclude.prefix=kafka.network.RequestMetrics,kafka.server.DelayedOperationPurgatory,kafka.server.BrokerTopicMetrics.BytesRejectedPerSec
external.kafka.metrics.include.prefix=kafka.network.RequestMetrics.ResponseQueueTimeMs.request.OffsetCommit.98percentile,kafka.network.RequestMetrics.ResponseQueueTimeMs.request.Offsets.95percentile,kafka.network.RequestMetrics.ResponseSendTimeMs.request.Fetch.95percentile,kafka.network.RequestMetrics.RequestsPerSec.request
fetch.purgatory.purge.interval.requests=10000
kafka.ganglia.metrics.group=kafka
kafka.ganglia.metrics.host=localhost
kafka.ganglia.metrics.port=8671
kafka.ganglia.metrics.reporter.enabled=true
kafka.metrics.reporters=org.apache.hadoop.metrics2.sink.kafka.KafkaTimelineMetricsReporter
kafka.timeline.metrics.host=ip-10-0-0-229.ap-northeast-1.compute.internal
kafka.timeline.metrics.maxRowCacheSize=10000
kafka.timeline.metrics.port=6188
kafka.timeline.metrics.protocol=http
kafka.timeline.metrics.reporter.enabled=true
kafka.timeline.metrics.reporter.sendInterval=5900
kafka.timeline.metrics.truststore.password=bigdata
kafka.timeline.metrics.truststore.path=/etc/security/clientKeys/all.jks
kafka.timeline.metrics.truststore.type=jks
leader.imbalance.check.interval.seconds=300
leader.imbalance.per.broker.percentage=10
listeners=PLAINTEXTSASL://ip-10-0-0-149.ap-northeast-1.compute.internal:6667
log.cleanup.interval.mins=10
log.dirs=/kafka-logs
log.index.interval.bytes=4096
log.index.size.max.bytes=10485760
log.retention.bytes=-1
log.retention.hours=168
log.roll.hours=168
log.segment.bytes=1073741824
message.max.bytes=1000000
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=86400000
offsets.topic.compression.codec=0
offsets.topic.num.partitions=50
offsets.topic.replication.factor=3
offsets.topic.segment.bytes=104857600
port=6667
principal.to.local.class=kafka.security.auth.KerberosPrincipalToLocal
producer.purgatory.purge.interval.requests=10000
queued.max.requests=500
replica.fetch.max.bytes=1048576
replica.fetch.min.bytes=1
replica.fetch.wait.max.ms=500
replica.high.watermark.checkpoint.interval.ms=5000
replica.lag.max.messages=4000
replica.lag.time.max.ms=10000
replica.socket.receive.buffer.bytes=65536
replica.socket.timeout.ms=30000
security.inter.broker.protocol=PLAINTEXTSASL
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
socket.send.buffer.bytes=102400
super.users=User:kafka
zookeeper.connect=ip-10-0-0-149.ap-northeast-1.compute.internal:2181
zookeeper.connection.timeout.ms=25000
zookeeper.session.timeout.ms=30000
zookeeper.set.acl=true
zookeeper.sync.time.ms=2000
&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Jan 2017 10:43:32 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140927#M103534</guid>
      <dc:creator>yjiang</dc:creator>
      <dc:date>2017-01-23T10:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of Creating Topics in Kafka with Kerberos</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140928#M103535</link>
      <description>&lt;P&gt;I created the topic using a normal user (not the 'kafka' service user). Do I need to use 'kafka' user to create the topic? &lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 10:44:57 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140928#M103535</guid>
      <dc:creator>yjiang</dc:creator>
      <dc:date>2017-01-23T10:44:57Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of Creating Topics in Kafka with Kerberos</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140929#M103536</link>
      <description>&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/274/yjiang.html"&gt;yjiang&lt;/A&gt;&lt;/P&gt;&lt;P&gt;To answer your question - &lt;/P&gt;&lt;P&gt;---------------&lt;/P&gt;&lt;P&gt;When you use a script, command, or API to create a topic, an entry is created under ZooKeeper. The only user with access to ZooKeeper is the service account running Kafka (by default, &lt;CODE&gt;kafka&lt;/CODE&gt;). Therefore, the first step toward creating a Kafka topic on a secure cluster is to run&lt;CODE&gt;kinit&lt;/CODE&gt;, specifying the Kafka service keytab. The second step is to create the topic.&lt;/P&gt;&lt;P&gt;----------------&lt;/P&gt;&lt;P&gt;See more in here: &lt;A href="http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.3/bk_secure-kafka-ambari/content/ch_secure-kafka-create-topics.html" target="_blank"&gt;http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.3/bk_secure-kafka-ambari/content/ch_secure-kafka-create-topics.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2017 16:47:02 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140929#M103536</guid>
      <dc:creator>dkozlowski</dc:creator>
      <dc:date>2017-01-23T16:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of Creating Topics in Kafka with Kerberos</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140930#M103537</link>
      <description>&lt;P&gt;@&lt;A href="https://community.hortonworks.com/users/274/yjiang.html"&gt;yjiang&lt;/A&gt; Yes, please try creating the topic as kafka user because when we use kafka-topics.sh to create a test topic, what this script does is to create a node in zookeeper path - /broker/topics/test &lt;/P&gt;&lt;P&gt;then brokers thread gets notified that a new node is created and broker then creates actual data for topic test that is the metadata and physical data. 

But notice that Brokers are kafka/host@REALM, so if a user other than kafka creates a topic it gets permission for example world:anyone:r 
sasl:xyz:crdwa &lt;/P&gt;&lt;P&gt;So the new node that is created in zookeeper path will have these permissions. Now when the broker gets alerted and tries to create metadata and physical data for this new topic, it wont be able to because broker principal is kafka but topic's is xyz &lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2017 02:21:17 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140930#M103537</guid>
      <dc:creator>dbains</dc:creator>
      <dc:date>2017-01-24T02:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of Creating Topics in Kafka with Kerberos</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140931#M103538</link>
      <description>&lt;P&gt;yes as the kafka  user&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2017 04:57:52 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140931#M103538</guid>
      <dc:creator>mthiele1</dc:creator>
      <dc:date>2017-01-25T04:57:52Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of Creating Topics in Kafka with Kerberos</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140932#M103539</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/274/yjiang.html" nodeid="274"&gt;@yjiang&lt;/A&gt; did it work, when created as kafka user?&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 16:42:04 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140932#M103539</guid>
      <dc:creator>dbains</dc:creator>
      <dc:date>2017-01-26T16:42:04Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of Creating Topics in Kafka with Kerberos</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140933#M103540</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://community.cloudera.com/users/11149/dbains.html" nodeid="11149"&gt;@dbains&lt;/A&gt;, &lt;A rel="user" href="https://community.cloudera.com/users/188/mthiele.html" nodeid="188"&gt;@mthiele&lt;/A&gt;, &lt;A rel="user" href="https://community.cloudera.com/users/3675/dkozlowski.html" nodeid="3675"&gt;@Daniel Kozlowski&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;Thank you. It works when created as kafka user.&lt;/P&gt;&lt;P&gt;To summarize all the steps -- from Ambari configs, to creating topic, granting permission and testing on kafka console producer/consumer scripts, I created this article &lt;A href="https://community.hortonworks.com/articles/79923/step-by-step-recipe-for-securing-kafka-with-kerber.html"&gt;Step by Step Recipe for Securing Kafka with Kerberos&lt;/A&gt;. Hope it saves others' time &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Jan 2017 18:23:50 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140933#M103540</guid>
      <dc:creator>yjiang</dc:creator>
      <dc:date>2017-01-26T18:23:50Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of Creating Topics in Kafka with Kerberos</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140934#M103541</link>
      <description>&lt;P&gt;@yjiang &lt;/P&gt;&lt;P&gt;If you try to create a topic as a non kafka user, it creates a topic but with no Leader and ISR. This is a known issue. According to me, the reason behind this could be the zookeeper acl's. Once topic is created in zookeeper, its acl's will not allow kafka to read details about it. &lt;/P&gt;&lt;P&gt;If you want to create a topic as a non kafka user you need to workaround by following below steps :&lt;/P&gt;&lt;P&gt;If you are not using Ranger :&lt;/P&gt;&lt;P&gt;1. Make sure "auto.create.topic.enable
= true"&lt;/P&gt;&lt;P&gt;2. Give acl's for the user from which you want to create a topic, for ex :&lt;/P&gt;&lt;P&gt;# bin/kafka-acls.sh --authorizer kafka.security.auth.SimpleAclAuthorizer --authorizer-properties zookeeper.connect=localhost:2181 --add --allow-principal User:Bob --producer --topic Test-topic&lt;/P&gt;&lt;P&gt;3. Do a kinit as a user from which you want to create topic.&lt;/P&gt;&lt;P&gt;4. Now try to produce messages to topic as that user :&lt;/P&gt;&lt;P&gt; #
./kafka-console-producer.sh --broker-list &amp;lt;hostname-broker&amp;gt;:6667 --topic Test-topic --security-protocol PLAINTEXTSASL&lt;/P&gt;&lt;P&gt;If you are using Ranger :&lt;/P&gt;&lt;P&gt;Instead of point 2 in above steps you will need to add a policy for the topic in ranger. Allow permissions for that user to produce, create, consumer.  Restart kafka service. Then follow step 3 and 4 as mentioned above.&lt;/P&gt;&lt;P&gt;Hope this helps !!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2017 00:59:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Problem-of-Creating-Topics-in-Kafka-with-Kerberos/m-p/140934#M103541</guid>
      <dc:creator>amankumbare</dc:creator>
      <dc:date>2017-03-08T00:59:16Z</dc:date>
    </item>
  </channel>
</rss>

