Kafka生产和消费
  OGG2zAst6hx8 2023年11月26日 28 0

生产,私有topic:

[root@gbxhf bin]# export PATH=$PATH:/data/kafka_2.12-2.8.2/bin;cd /data/kafka_2.12-2.8.2/bin
[root@gbxhf bin]# kafka-console-producer.sh --bootstrap-server 192.168.1.200:8423,192.168.1.201:8423   --topic "RDSP-IPCM-NOTICE" --producer.config /home/srd/config/client.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 [2023-11-23 14:49:25,242] WARN The configuration 'group.id' was supplied but isn't a known config. (org.apache.kafka.clients.producer.ProducerConfig)

>

[{"filePath": "data/ipcm", "fileType": "ipcm", "fileName": "20231120003000.20231120003712.373", "noticeTime

": "2023-11-20 00:37:12", "fileendTime": "2023-11-20 00:37:12", "filesize": "1692358", "unitid": "2023040698823913472", "coltime": "2023-11-20 00:30:00", "remark": "", "uuid": "1009616", ", "colitem": ["10001"], "retcode": "0", "failreason": "", "traceid": "08c4c95c-cd01-4322-a7ab-14db8dff4b2a"}]

>

消费,私有topic:

kafka-console-consumer.sh --bootstrap-server 192.168.1.200:8423,192.168.1.201:8423 --topic RDSP-IPCM-NOTICE --consumer.config /home/srd/config/client.properties

相较于私有topic,公有topic的参数更简单,不要带配置文件的路径参数

公有topic生产:

[root@gbxhf bin]# kafka-console-producer.sh --bootstrap-server 192.168.1.200:8422,192.168.1.201:8422   --topic "IPnldd-IPCM-NOTICE" 

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 [2023-11-23 14:49:25,242] WARN The configuration 'group.id' was supplied but isn't a known config. (org.apache.kafka.clients.producer.ProducerConfig)

>

[{"filePath": "data/ipcm", "fileType": "ipcm", "fileName": "20231120003000.20231120003712.373", "noticeTime

": "2023-11-20 00:37:12", "fileendTime": "2023-11-20 00:37:12", "filesize": "1692358", "unitid": "2023040698823913472", "coltime": "2023-11-20 00:30:00", "remark": "", "uuid": "1009616", ", "colitem": ["10001"], "retcode": "0", "failreason": "", "traceid": "08c4c95c-cd01-4322-a7ab-14db8dff4b2a"}]

>

公有topic消费:

[root@gbxhf bin]# kafka-console-consumer.sh --bootstrap-server 192.168.1.200:8422,192.168.1.201:8422   --topic "IPnldd-IPCM-NOTICE"


【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月26日 0

暂无评论

推荐阅读
  KRsXEGSB49bk   2023年11月24日   37   0   0 Server客户端加载
  eHipUjOuzYYH   2023年12月06日   32   0   0 sedbootstrapIPV6
  OGG2zAst6hx8   2023年11月26日   29   0   0 bootstrapServerkafka
  zNxK8cIqmu7p   2023年11月19日   31   0   0 ServerAPIPod
  it2nV7RK7uw1   2023年11月28日   75   0   0 DockerServerIP