kafka3.8的基本操作

news2024/11/23 15:21:16

Kafka基础理论与常用命令详解(超详细)_kafka常用命令和解释-CSDN博客

[root@k1 bin]# netstat -tunlp|grep 90
tcp6       0      0 :::9092                 :::*                    LISTEN      14512/java          
[root@k1 bin]# ./kafka-topics.sh --list --bootstrap-server 192.168.207.131:9092
topic_jyc01
[root@k1 bin]# ./kafka-topics.sh --list --bootstrap-server 192.168.207.132:9092
topic_jyc01
[root@k1 bin]# ./kafka-topics.sh --list --bootstrap-server 192.168.207.133:9092
topic_jyc01
[root@k1 bin]# ./kafka-topics.sh --create --bootstrap-server 192.168.207.131:9092 --replication-factor 2 --partitions 1 --topic topic_jyc02
WARNING: Due to limitations in metric names, topics with a period ('.') or underscore ('_') could collide. To avoid issues it is best to use either, but not both.
Created topic topic_jyc02.
[root@k1 bin]# ./kafka-topics.sh --list --bootstrap-server 192.168.207.132:9092
topic_jyc01
topic_jyc02
[root@k1 bin]# ./kafka-topics.sh --describe --zookeeper localhost:12181 --topic topic_jyc02
zookeeper is not a recognized option
joptsimple.UnrecognizedOptionException: zookeeper is not a recognized option
        at joptsimple.OptionException.unrecognizedOption(OptionException.java:108)
        at joptsimple.OptionParser.handleLongOptionToken(OptionParser.java:510)
        at joptsimple.OptionParserState$2.handleArgument(OptionParserState.java:56)
        at joptsimple.OptionParser.parse(OptionParser.java:396)
        at org.apache.kafka.tools.TopicCommand$TopicCommandOptions.<init>(TopicCommand.java:828)
        at org.apache.kafka.tools.TopicCommand.execute(TopicCommand.java:98)
        at org.apache.kafka.tools.TopicCommand.mainNoExit(TopicCommand.java:88)
        at org.apache.kafka.tools.TopicCommand.main(TopicCommand.java:83)

[root@k1 bin]# ./kafka-topics.sh --describe --bootstrap-server 192.168.207.131:12181 --topic topic_jyc02
Error while executing topic command : Timed out waiting for a node assignment. Call: listTopics
[2024-09-20 09:31:53,869] ERROR org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment. Call: listTopics
 (org.apache.kafka.tools.TopicCommand)
[root@k1 bin]# ./kafka-topics.sh --describe --bootstrap-server 192.168.207.131:12181 --topic topic_jyc01
^C[root@k1 bin]# find / -name ./zkCli.sh
find: warning: Unix filenames usually don't contain slashes (though pathnames do).  That means that '-name ‘./zkCli.sh’' will probably evaluate to false all the time on this system.  You might find the '-wholename' test more useful, or perhaps '-samefile'.  Alternatively, if you are using GNU grep, you could use 'find ... -print0 | grep -FzZ ‘./zkCli.sh’'.
[root@k1 bin]# find / -name zkCli.sh
/opt/zookeeper/zookeeper-3.9.2/bin/zkCli.sh
[root@k1 bin]# /opt/zookeeper/zookeeper-3.9.2/bin/zkCli.sh -server 192.168.207.131:12181
Connecting to 192.168.207.131:12181
2024-09-20 09:33:40,091 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:zookeeper.version=3.9.2-e454e8c7283100c7caec6dcae2bc82aaecb63023, built on 2024-02-12 20:59 UTC
2024-09-20 09:33:40,095 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:host.name=k1
2024-09-20 09:33:40,095 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.version=1.8.0_412
2024-09-20 09:33:40,096 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.vendor=Red Hat, Inc.
2024-09-20 09:33:40,096 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.412.b08-1.el7_9.x86_64/jre
2024-09-20 09:33:40,096 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.class.path=/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-metrics-providers/zookeeper-prometheus-metrics/target/classes:/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-server/target/classes:/opt/zookeeper/zookeeper-3.9.2/bin/../build/classes:/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-metrics-providers/zookeeper-prometheus-metrics/target/lib/*.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-server/target/lib/*.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../build/lib/*.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/zookeeper-prometheus-metrics-3.9.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/zookeeper-jute-3.9.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/zookeeper-3.9.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/snappy-java-1.1.10.5.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/slf4j-api-1.7.30.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/simpleclient_servlet-0.9.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/simpleclient_hotspot-0.9.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/simpleclient_common-0.9.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/simpleclient-0.9.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-transport-native-unix-common-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-transport-native-epoll-4.1.105.Final-linux-x86_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-transport-classes-epoll-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-transport-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-classes-2.0.61.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final-windows-x86_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final-osx-x86_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final-osx-aarch_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final-linux-x86_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final-linux-aarch_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-resolver-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-handler-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-common-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-codec-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-buffer-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/metrics-core-4.1.12.1.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/logback-core-1.2.13.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/logback-classic-1.2.13.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jline-2.14.6.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-util-ajax-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-util-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-servlet-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-server-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-security-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-io-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-http-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/javax.servlet-api-3.1.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jackson-databind-2.15.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jackson-core-2.15.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jackson-annotations-2.15.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/commons-io-2.11.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/commons-cli-1.5.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/audience-annotations-0.12.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-*.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-server/src/main/resources/lib/*.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../conf:
2024-09-20 09:33:40,096 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2024-09-20 09:33:40,096 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.io.tmpdir=/tmp
2024-09-20 09:33:40,096 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.compiler=<NA>
2024-09-20 09:33:40,097 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.name=Linux
2024-09-20 09:33:40,097 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.arch=amd64
2024-09-20 09:33:40,097 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.version=3.10.0-1160.el7.x86_64
2024-09-20 09:33:40,097 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.name=root
2024-09-20 09:33:40,097 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.home=/root
2024-09-20 09:33:40,097 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.dir=/opt/kafka/kafka_2.13-3.8.0/bin
2024-09-20 09:33:40,097 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.free=105MB
2024-09-20 09:33:40,098 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.max=228MB
2024-09-20 09:33:40,098 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.total=119MB
2024-09-20 09:33:40,102 [myid:] - INFO  [main:o.a.z.ZooKeeper@637] - Initiating client connection, connectString=192.168.207.131:12181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@4678c730
2024-09-20 09:33:40,115 [myid:] - INFO  [main:o.a.z.c.X509Util@88] - Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
2024-09-20 09:33:40,360 [myid:] - INFO  [main:o.a.z.c.X509Util@110] - Default TLS protocol is TLSv1.3, supported TLS protocols are [TLSv1.3, TLSv1.2, TLSv1.1, TLSv1, SSLv3, SSLv2Hello]
2024-09-20 09:33:40,377 [myid:] - INFO  [main:o.a.z.ClientCnxnSocket@233] - jute.maxbuffer value is 1048575 Bytes
2024-09-20 09:33:40,390 [myid:] - INFO  [main:o.a.z.ClientCnxn@1726] - zookeeper.request.timeout value is 0. feature enabled=false
Welcome to ZooKeeper!
2024-09-20 09:33:40,407 [myid:192.168.207.131:12181] - INFO  [main-SendThread(192.168.207.131:12181):o.a.z.ClientCnxn$SendThread@1162] - Opening socket connection to server k1/192.168.207.131:12181.
2024-09-20 09:33:40,407 [myid:192.168.207.131:12181] - INFO  [main-SendThread(192.168.207.131:12181):o.a.z.ClientCnxn$SendThread@1164] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2024-09-20 09:33:40,417 [myid:192.168.207.131:12181] - INFO  [main-SendThread(192.168.207.131:12181):o.a.z.ClientCnxn$SendThread@998] - Socket connection established, initiating session, client: /192.168.207.131:38474, server: k1/192.168.207.131:12181
2024-09-20 09:33:40,458 [myid:192.168.207.131:12181] - INFO  [main-SendThread(192.168.207.131:12181):o.a.z.ClientCnxn$SendThread@1432] - Session establishment complete on server k1/192.168.207.131:12181, session id = 0x1000045e0670010, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null zxid: -1
[zk: 192.168.207.131:12181(CONNECTED) 0] ls /
[admin, brokers, cluster, config, consumers, controller, controller_epoch, feature, isr_change_notification, latest_producer_id_block, log_dir_event_notification, zookeeper]
[zk: 192.168.207.131:12181(CONNECTED) 1] get /bo$<3$<3$<3$<3>
get [-s] [-w] path
[zk: 192.168.207.131:12181(CONNECTED) 2] get /brokers/ids/0
Node does not exist: /brokers/ids/0
[zk: 192.168.207.131:12181(CONNECTED) 3] ls /brokers
[ids, seqid, topics]
[zk: 192.168.207.131:12181(CONNECTED) 4] ls /brokers/ids
[1, 2, 3]
[zk: 192.168.207.131:12181(CONNECTED) 5] l /b /br /br[root@k1 bin]# 
[root@k1 bin]# /opt/zookeeper/zookeeper-3.9.2/bin/zkCli.sh -server 192.168.207.131:12181
Connecting to 192.168.207.131:12181
2024-09-20 09:36:06,891 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:zookeeper.version=3.9.2-e454e8c7283100c7caec6dcae2bc82aaecb63023, built on 2024-02-12 20:59 UTC
2024-09-20 09:36:06,895 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:host.name=k1
2024-09-20 09:36:06,895 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.version=1.8.0_412
2024-09-20 09:36:06,896 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.vendor=Red Hat, Inc.
2024-09-20 09:36:06,896 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.412.b08-1.el7_9.x86_64/jre
2024-09-20 09:36:06,896 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.class.path=/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-metrics-providers/zookeeper-prometheus-metrics/target/classes:/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-server/target/classes:/opt/zookeeper/zookeeper-3.9.2/bin/../build/classes:/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-metrics-providers/zookeeper-prometheus-metrics/target/lib/*.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-server/target/lib/*.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../build/lib/*.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/zookeeper-prometheus-metrics-3.9.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/zookeeper-jute-3.9.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/zookeeper-3.9.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/snappy-java-1.1.10.5.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/slf4j-api-1.7.30.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/simpleclient_servlet-0.9.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/simpleclient_hotspot-0.9.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/simpleclient_common-0.9.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/simpleclient-0.9.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-transport-native-unix-common-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-transport-native-epoll-4.1.105.Final-linux-x86_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-transport-classes-epoll-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-transport-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-classes-2.0.61.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final-windows-x86_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final-osx-x86_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final-osx-aarch_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final-linux-x86_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final-linux-aarch_64.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-tcnative-boringssl-static-2.0.61.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-resolver-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-handler-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-common-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-codec-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/netty-buffer-4.1.105.Final.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/metrics-core-4.1.12.1.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/logback-core-1.2.13.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/logback-classic-1.2.13.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jline-2.14.6.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-util-ajax-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-util-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-servlet-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-server-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-security-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-io-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jetty-http-9.4.53.v20231009.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/javax.servlet-api-3.1.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jackson-databind-2.15.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jackson-core-2.15.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/jackson-annotations-2.15.2.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/commons-io-2.11.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/commons-cli-1.5.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../lib/audience-annotations-0.12.0.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-*.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../zookeeper-server/src/main/resources/lib/*.jar:/opt/zookeeper/zookeeper-3.9.2/bin/../conf:
2024-09-20 09:36:06,896 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2024-09-20 09:36:06,896 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.io.tmpdir=/tmp
2024-09-20 09:36:06,896 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:java.compiler=<NA>
2024-09-20 09:36:06,896 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.name=Linux
2024-09-20 09:36:06,897 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.arch=amd64
2024-09-20 09:36:06,897 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.version=3.10.0-1160.el7.x86_64
2024-09-20 09:36:06,897 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.name=root
2024-09-20 09:36:06,897 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.home=/root
2024-09-20 09:36:06,897 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:user.dir=/opt/kafka/kafka_2.13-3.8.0/bin
2024-09-20 09:36:06,897 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.free=105MB
2024-09-20 09:36:06,898 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.max=228MB
2024-09-20 09:36:06,898 [myid:] - INFO  [main:o.a.z.Environment@98] - Client environment:os.memory.total=119MB
2024-09-20 09:36:06,902 [myid:] - INFO  [main:o.a.z.ZooKeeper@637] - Initiating client connection, connectString=192.168.207.131:12181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@4678c730
2024-09-20 09:36:06,914 [myid:] - INFO  [main:o.a.z.c.X509Util@88] - Setting -D jdk.tls.rejectClientInitiatedRenegotiation=true to disable client-initiated TLS renegotiation
2024-09-20 09:36:07,166 [myid:] - INFO  [main:o.a.z.c.X509Util@110] - Default TLS protocol is TLSv1.3, supported TLS protocols are [TLSv1.3, TLSv1.2, TLSv1.1, TLSv1, SSLv3, SSLv2Hello]
2024-09-20 09:36:07,182 [myid:] - INFO  [main:o.a.z.ClientCnxnSocket@233] - jute.maxbuffer value is 1048575 Bytes
2024-09-20 09:36:07,195 [myid:] - INFO  [main:o.a.z.ClientCnxn@1726] - zookeeper.request.timeout value is 0. feature enabled=false
Welcome to ZooKeeper!
2024-09-20 09:36:07,213 [myid:192.168.207.131:12181] - INFO  [main-SendThread(192.168.207.131:12181):o.a.z.ClientCnxn$SendThread@1162] - Opening socket connection to server k1/192.168.207.131:12181.
2024-09-20 09:36:07,214 [myid:192.168.207.131:12181] - INFO  [main-SendThread(192.168.207.131:12181):o.a.z.ClientCnxn$SendThread@1164] - SASL config status: Will not attempt to authenticate using SASL (unknown error)
2024-09-20 09:36:07,222 [myid:192.168.207.131:12181] - INFO  [main-SendThread(192.168.207.131:12181):o.a.z.ClientCnxn$SendThread@998] - Socket connection established, initiating session, client: /192.168.207.131:39134, server: k1/192.168.207.131:12181
JLine support is enabled
2024-09-20 09:36:07,259 [myid:192.168.207.131:12181] - INFO  [main-SendThread(192.168.207.131:12181):o.a.z.ClientCnxn$SendThread@1432] - Session establishment complete on server k1/192.168.207.131:12181, session id = 0x1000045e0670011, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null zxid: -1
[zk: 192.168.207.131:12181(CONNECTED) 0] ls /
[admin, brokers, cluster, config, consumers, controller, controller_epoch, feature, isr_change_notification, latest_producer_id_block, log_dir_event_notification, zookeeper]
[zk: 192.168.207.131:12181(CONNECTED) 1] ls /brokers/ids/1
[]
[zk: 192.168.207.131:12181(CONNECTED) 2] get /brokes/ids/1
Node does not exist: /brokes/ids/1
[zk: 192.168.207.131:12181(CONNECTED) 3] get /brokers/ids/1
{"features":{},"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT"},"endpoints":["PLAINTEXT://k1:9092"],"jmx_port":9999,"port":9092,"host":"k1","version":5,"timestamp":"1726738262403"}
[zk: 192.168.207.131:12181(CONNECTED) 4] get /brokers/topics/
Path must not end with / character
[zk: 192.168.207.131:12181(CONNECTED) 5] ls /brokers/topics
[topic_jyc01, topic_jyc02]
[zk: 192.168.207.131:12181(CONNECTED) 6] ls /brokers/topics/topic_jyc01
[partitions]
[zk: 192.168.207.131:12181(CONNECTED) 7] ls /brokers/topics/topic_jyc01/partitions
[0, 1]
[zk: 192.168.207.131:12181(CONNECTED) 8] ls /brokers/topics/topic_jyc01/partitions/0
[state]
[zk: 192.168.207.131:12181(CONNECTED) 9] get /brokers/topics/topic_jyc01/partitions/0
null
[zk: 192.168.207.131:12181(CONNECTED) 10] get /brokers/topics/topic_jyc01/partitions/$<3>1
null
[zk: 192.168.207.131:12181(CONNECTED) 11] get /brokers/topics/topic_jyc01/partitions/1
null
[zk: 192.168.207.131:12181(CONNECTED) 12] 

相关参考:

Kafka【第一篇】Kafka集群搭建_kafka 搭建-CSDN博客

http://192.168.207.131:8048/

admin/23456

内存不足问题:

vi kafka-server-start.sh
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
    export KAFKA_HEAP_OPTS="-server -Xms2G -Xmx2G -XX:PermSize=128m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=8 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70"
    export JMX_PORT="9999"
fi

kafka-eagle无法获取kafka cluster info_kafka cluster info 不显示-CSDN博客

[root@k1 bin]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.207.131 k1
192.168.207.132 k2
192.168.207.133 k3
[root@k1 bin]#  

生产者:

[root@k1 bin]# ./kafka-console-producer.sh --broker-list "192.168.207.131:9092,192.168.207.132:9092,192.168.207.133:9092" --topic topic_jyc01
>Hello Kafka!
>你好 kafka!
>test
>

消费者:

[root@k1 bin]# ./kafka-console-consumer.sh --bootstrap-server "192.168.207.131:9092,192.168.207.132:9092,192.168.207.133:9092" --topic topic_jyc01
Hello Kafka!
你好 kafka!
test

一、无key型消息
 默认情况下,所生产的消息是没有 key 的,命令如下:

bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic topicName
1
 执行上述命令后,就会在控制台等待键入消息体,直接输入消息值(value)即可,每行(以换行符分隔)表示一条消息,如下所示。

>Hello Kafka!
>你好 kafka!
1
2
 正常情况,每次回车表示触发“发送”操作,回车后可直接使用“Ctrl + c”退出生产者控制台,再使用 kafka-console-consumer.sh 脚本验证本次的生产情况。

二、有key型消息
 当需要为消息指定 key 时,可使用如下命令:

bin/kafka-console-producer.sh --bootstrap-server localhost:9092 --topic topicName --property parse.key=true
1
 默认消息键与消息值间使用“Tab键”进行分隔,切勿使用转义字符(\t),如下所示:

>Lei Li    Hello Kafka!
>Meimei Han    你好 kafka!
1
2
 键入如上信息表示所生产的消息“Lei Li”为消息键,“Hello Kafka”为消息值。


https://blog.csdn.net/qq_29116427/article/details/105912397

kafka使用kafka-console-consumer.sh和kafka-console-producer.sh生产消费数据样例_kafka-console-consumer显示消息的key-CSDN博客 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2151679.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

MVCC机制解析:提升数据库并发性能的关键

MVCC机制解析&#xff1a;提升数据库并发性能的关键 MVCC&#xff08;Multi-Version Concurrency Control&#xff09; 多版本并发控制 。 MVCC只在事务隔离级别为读已提交(Read Committed)和可重复读(Repeated Read)下生效。 MVCC是做什么用的 MVCC是为了处理 可重复读 和…

数据安全治理

数据安全治理 1.数据安全治理2.终端数据安全加密类权限控制类终端DLP类桌面虚拟化安全桌面 3.网络数据安全4.存储数据安全5.应用数据安全6.其他话题数据脱敏水印与溯源 7.UEBA8.CASB 1.数据安全治理 数据安全治理最为重要的是进行数据安全策略和流程制订。在企业或行业内经常发…

酸枣病虫害智能化防控系统的探索与实践,基于YOLOv5全系列【n/s/m/l/x】参数模型开发构建枣类作物种植场景下酸枣病虫害智能检测识别系统

智慧农业&#xff0c;作为现代农业的高级形态&#xff0c;通过集成物联网、大数据、人工智能等先进技术&#xff0c;实现了农业生产过程的精准化、智能化管理。在酸枣等经济作物的种植过程中&#xff0c;病虫害的及时监测与防控直接关系到作物的产量与质量&#xff0c;进而影响…

Vue报错 ‘vite‘ 不是内部或外部命令,也不是可运行的程序或批处理文件

报错 vue-project0.0.0 dev vite‘vite’ 不是内部或外部命令&#xff0c;也不是可运行的程序 或批处理文件。解决 第1步. 控制台输入 npm install -g create-vite第2步. 控制台输入 npm install -g vite第3步. 运行就ok啦

伊犁linux 创建yum 源过程

首先要创建yum 源这样后期的服务才能大面积部署 在su 用户下创建 清理缓存&#xff0c;一定要配置 这说明yum安装成功

笔记整理—内核!启动!—kernel部分(8)动态编译链接库与BSP文件

linux的C语言程序是用编译的&#xff0c;但是如果要在开发板上运行的话就不能使用默认的ubuntu提供的gcc编译器&#xff0c;而是使用arm-linux版本的一类的编译器。我们可以用file xx去查看一个程序的架构。 &#xff08;arm架构&#xff09; &#xff08;intel的80386架构&…

Linux命令 —— grep/sed

一、grep命令 grep是Linux中最常用的“文本处理工具”之一&#xff0c;grep与sed、awk合称为Linux中的三剑客。 grep的全称为&#xff1a; Global search Regular Expression and Print out the line 所以&#xff0c;从grep的全称中可以了解到&#xff0c;grep是一个可以利用…

运维开发之堡垒机(Fortress Machine for Operation and Development)

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:Linux运维老纪的首页…

十种果冻的做法

菠萝果冻 1.在菠萝的1/5处切开&#xff0c;切去顶做盖子用&#xff0c;用水果刀在四周划一圈使皮和果肉分离 2.注意底部切透了&#xff0c;用水果刀把菠萝肉挖出&#xff0c;菠萝肉切丁用盐水浸泡备用 3.把菠萝丁放入料理机中加入少许纯净水&#xff0c;打成菠萝汁备用 4.打好…

伊犁-linux root 密码忘记咋办

1 root 密码忘记了 或者reboot 重启之后在引导界面 按住 e 进入如下界面 然后按住ctrlx 进入这个界面 root 修改成功

为什么512G的固态硬盘,电脑显示只有476G可用?

硬盘的标称容量与操作系统显示的可用容量存在差异&#xff0c;这是由于硬盘制造商和操作系统在计算容量时采用不同的进制标准所致。硬盘制造商通常使用10进制来标注硬盘容量&#xff0c;即1GB等于1000MB&#xff0c;而操作系统则使用2进制&#xff0c;即1GB等于1024MB。因此&am…

无人机视角电力巡检资产检测与异常判别数据集

无人机视角电力巡检资产检测与异常判别&#xff0c;资产检测关注17类目标&#xff0c;共10000余张无人机图像&#xff0c;json方式标注&#xff0c;类别如下&#xff1a; 1.Spiral Damper - 螺旋阻尼器 2.Stockbridge Damper - 斯托克布里奇阻尼器 3.Glass Insulator - 玻璃绝缘…

双击就可以打开vue项目,而不用npm run dev

右键点击桌面或其他位置&#xff0c;选择“新建” -> “快捷方式”&#xff0c;在“对象的位置”处直接输入“npm run dev”&#xff0c;然后下一步 自定义一个快捷方式名称 完成后&#xff0c;桌面会创建一个快捷方式&#xff0c;右键快捷方式选择属性&#xff0c;可以看…

智慧火灾应急救援航拍检测数据集(无人机视角)

智慧火灾应急救援。 无人机&#xff0c;直升机等航拍视角下火灾应急救援检测数据集&#xff0c;数据分别标注了火&#xff0c;人&#xff0c;车辆这三个要素内容&#xff0c;29810张高清航拍影像&#xff0c;共31GB&#xff0c;适合森林防火&#xff0c;应急救援等方向的学术研…

免费音乐剪辑软件大揭秘:2024 大学生的音乐创作利器

对于音乐爱好者而言&#xff0c;如果你萌生了尝试音乐剪辑的念头&#xff0c;不妨先从探索一些免费工具开始。在此&#xff0c;我愿分享几款我个人体验过的、值得一试的音乐剪辑免费软件&#xff0c;希望能为你的音乐探索之旅增添乐趣与灵感。 1.福晰音频剪辑 链接直达>&g…

Java servlet《网吧机房管理系统浅析》

网吧机房管理系统在网吧运营中起着至关重要的作用。 对于用户而言&#xff0c;该系统提供了便捷的登录方式&#xff0c;通过用户名和密码可准确显示所在网吧机房号&#xff0c;便于快速定位。同时&#xff0c;合理的机房分配功能确保用户获得良好上网体验。遇到问题时&#xff…

Highcharts甘特图基本用法(highcharts-gantt.js)

参考官方文档&#xff1a; https://www.highcharts.com/docs/gantt/getting-started-gantt https://www.highcharts.com/demo/gantt/project-management https://www.hcharts.cn/demo/gantt 链接在下面按需引入 https://code.highcharts.com/gantt/highcharts-gantt.js htt…

【C语言】自定义类型——联合和枚举

目录 一、联合体&#xff08;共用体&#xff09; &#xff08;1&#xff09;联合体类型的声明 &#xff08;2&#xff09;联合体类型的特点 &#xff08;3&#xff09;联合体和结构体的比较 &#xff08;4&#xff09;联合体大小的计算 &#xff08;5&#xff09;联合体的…

STM8L101低功耗的理解

一.通过降低时钟频率来降低功耗&#xff1a; 规格书如图 1.code 从flash启动&#xff0c;主频率是16Mhz时&#xff0c;功耗测量2.51ma左右&#xff0c;对应程序如下&#xff1a; 2.code从flash启动&#xff0c;主频率是2Mhz时&#xff08;上电默认值&#xff09;&#xff0c;功…

Android 如何使用jdk命令给应用/APK重新签名。

写在前面&#xff1a;本篇文章介绍Windows命令行中&#xff0c;如何使用jdk命令给已经签过名的apk重新签名。 使用工具&#xff1a;jarsigner。jarsigner是jdk自带的工具&#xff0c;签名之前确保Windows电脑中已安装jdk。我的环境如下&#xff1a;   后续操作步骤如下&…