前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >How to run kafka in OAUTHBEARER test mode.

How to run kafka in OAUTHBEARER test mode.

原创
作者头像
rabbit_lei
发布2024-06-17 14:46:12
540
发布2024-06-17 14:46:12
  1. config the server.properties to run with SASL OAUTHBEARER test mode
代码语言:txt
复制
listeners=SASL_PLAINTEXT://localhost:9093
advertised.listeners=SASL_PLAINTEXT://localhost:9093
security.inter.broker.protocol=SASL_PLAINTEXT
sasl.mechanism.inter.broker.protocol=OAUTHBEARER
sasl.enabled.mechanisms=OAUTHBEARER

# Specify the JAAS login context name for SASL/OAUTHBEARER
listener.name.sasl_plaintext.oauthbearer.sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required unsecuredLoginStringClaim_sub="alice";

  1. start the zookeeper and kafka server
代码语言:txt
复制
zookeeper-server-start.bat .\config\zookeeper.properties
kafka-server-start.bat .\config\server.properties

  1. next create a file client.properties in the config folder for kafka-topic script to use
代码语言:txt
复制
security.protocol=SASL_PLAINTEXT
sasl.mechanism=OAUTHBEARER
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required unsecuredLoginStringClaim_sub="alice";

  1. ccreate topic 'gaming-events' by kafka-topic script
代码语言:txt
复制
kafka-topics.bat --create --topic gaming-events --bootstrap-server localhost:9093 --command-config .\config\client.properties
kafka-topics.bat --list --bootstrap-server localhost:9093 --command-config .\config\client.properties

  1. next modify consumer.properties/producer.properties the same as client.properties
代码语言:txt
复制
security.protocol=SASL_PLAINTEXT
sasl.mechanism=OAUTHBEARER
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required unsecuredLoginStringClaim_sub="alice";

  1. finally start the consumer and producer communicating through the topic 'gaming-events'
代码语言:txt
复制
kafka-console-consumer.bat --topic gaming-events --from-beginning --bootstrap-server localhost:9093 --consumer.config .\config\consumer.properties
kafka-console-producer.bat --topic gaming-events --bootstrap-server localhost:9093 --producer.config .\config\producer.properties

This is just a test setting of OAUTHBEARER for kafka.

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档