Kafka的一些Linux消费使用命令

 

命令都是到kafka的bin目录底下

如果没有的话 就去官网下载一个包 地址:https://kafka.apache.org/downloads

 

 

消费含有账号密码的kafka   没有账号密码的话 就不需要后面那个配置文件了

./kafka-console-consumer.sh --bootstrap-server ip:端口,ip:端口  --topic topic名称 -consumer.config /data/consumer.properties

consumer.properties : 这个是连接kafka配置 比如账号密码

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
# 
#    http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# see org.apache.kafka.clients.consumer.ConsumerConfig for more details

# list of brokers used for bootstrapping knowledge about the rest of the cluster
# format: host1:port1,host2:port2 ...
#bootstrap.servers=localhost:9092

security.protocol=SASL_PLAINTEXT
sasl.mechanism=PLAIN
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="账号" password="密码";

# consumer group id
group.id=test-consumer-group

# What to do when there is no initial offset in Kafka or if the current
# offset does not exist any more on the server: latest, earliest, none
#auto.offset.reset=

 

命令看消费者消费情况 是否积压

 ./kafka-consumer-groups.sh --bootstrap-server 192.168.1.1 --describe --group 消费者组id

 

posted @ 2024-08-26 10:00  yvioo  阅读(6)  评论(0)    收藏  举报