首页 / 平台管理 / 应用商店管理 / Operators / 使用 Operator / Kafka / 消息投递(从集群外)

消息投递(从集群外)

从集群外使用生产者、消费者与 kafka 进行消息投递。

前提条件

  1. 确保 KafkaUser 实例的认证及授权方式与 Kafka 实例一致。
    
  2. 确保已完成 加密配置

消息投递(TLS 认证)

external.tls authentification.type authorization.type
true tls simple

说明

发送消息

{文件路径}/kafka-console-producer.sh --bootstrap-server {集群节点 IP}:{主机端口} --topic {Topic 名称} --producer.config {文件路径}/client-ssl.properties
>hello1
>hello2
>hello3
>

读取消息

{文件路径}/kafka-console-consumer.sh --bootstrap-server {集群节点 IP}:{主机端口} --topic {Topic 名称} --consumer.config {文件路径}/client-ssl.properties --from-beginning --group my-group
hello1
hello2
hello3

消息投递(scram-sha-512 认证)

external.tls authentification.type authorization.type
true scram-sha-512 simple

说明

发送消息

{文件路径}/kafka-console-producer.sh --bootstrap-server {集群节点 IP}:{主机端口} --topic {Topic 名称} --producer.config {文件路径}/client.properties
>hello1
>hello2
>hello3
>

读取消息

$ {文件路径}/kafka-console-consumer.sh --bootstrap-server {集群节点 IP}:{主机端口} --topic {Topic 名称} --consumer.config {文件路径}/client.properties --from-beginning --group my-group
hello1
hello2
hello3