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

消息投递(从集群内)

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

前提条件

操作步骤

listeners.tls authentification.type authorization.type
留空 tls simple
  1. 使用 root 用户进入 Kafka 所在 Pod。

    $ kubectl -n {命名空间名称} exec -ti {Pod 名称} bash
  2. 切换到相关目录。

    $ cd /home/kafka/
  3. 运行客户端。

    说明:创建 KafkaTopic 实例时若未设置 Topic Name,下述 Topic 名称 即 KafkaTopic 实例名称。

    • 生产消息
    $ /opt/kafka/bin/kafka-console-producer.sh --bootstrap-server {Kafka 实例名称}-kafka-bootstrap:9093 --topic {Topic 名称} --producer.config ./client-ssl.properties
    OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
    >hello1
    >hello2
    >hello3
    >