kafka3.8的基本操作

embedded/2024/12/22 8:03:29/

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.ppmy.cn/embedded/115230.html

相关文章

Python画笔案例-058 绘制单击画酷炫彩盘

1、绘制单击画酷炫彩盘 通过 python 的turtle 库绘制 单击画酷炫彩盘,如下图: 2、实现代码 绘制单击画酷炫彩盘,以下为实现代码: """单击画酷炫彩盘.py"""from turtle import Turtle # 导入海龟类 from random import randint…

com.kingbase8.util.KSQLException: ERROR: permission denied for table xxx

前言 在信创改造中&#xff0c;数据库替换为国产数据库是不可缺少的一部分。而可替换选项中多数选项无非是人大金仓和达梦数据库二选一。本文将介绍人大金仓在使用过程的问题以及解决办法。 问题 在使用人大金仓数据库后&#xff0c;程序运行报错 com.kingbase8.util.KSQLEx…

【Delphi】Delphi 中的 LiveBindings 使用场景与概念

LiveBindings 是 Delphi 提供的一种数据绑定机制&#xff0c;用于将 UI 控件与数据源&#xff08;如数据库字段、对象属性等&#xff09;进行动态连接。LiveBindings 允许开发人员通过可视化的方式绑定数据&#xff0c;省去了大量的手动编写代码&#xff0c;使 UI 更新和数据同…

基于matlab的通信系统设计及仿真

文章目录 前言资料获取设计介绍功能介绍设计程序具体实现截图参考文献设计获取 前言 &#x1f497;博主介绍&#xff1a;✌全网粉丝10W,CSDN特邀作者、博客专家、CSDN新星计划导师&#xff0c;一名热衷于单片机技术探索与分享的博主、专注于 精通51/STM32/MSP430/AVR等单片机设…

自动化立体仓库与堆垛机单元的技术参数

导语 大家好&#xff0c;我是社长&#xff0c;老K。专注分享智能制造和智能仓储物流等内容。 新书《智能物流系统构成与技术实践》人俱乐部 完整版文件和更多学习资料&#xff0c;请球友到知识星球【智能仓储物流技术研习社】自行下载。 这份文件是一份自动化立体仓库与堆垛机单…

Python 数据类型

目录 Python 数据类型基本数据类型示例代码列表&#xff08;list&#xff09;常见操作 元组&#xff08;tuple&#xff09;常见操作 集合&#xff08;set&#xff09;常见操作 字典&#xff08;dict&#xff09;常见操作 特殊数据类型 NoneType数据类型检查和转换数据类型的高级…

图像处理与分析

描述&#xff1a; 开发一个图像处理工具&#xff0c;能够对图像进行基本的处理和分析操作。该工具应支持对常见格式的图像进行读取、显示、滤波、边缘检测等操作&#xff0c;并能够生成处理结果的统计数据。 要求&#xff1a; 图像读取和显示&#xff1a; 实现图像的读取功能…

汽车电子电气架构从12V提升至48V,带来那些好处? 包括那些改变?

标签&#xff1a; 汽车电子电气架构&#xff1b; 从12V提升至48V&#xff1b; 汽车电子电气架构从12V提升至48V&#xff0c;带来那些好处&#xff1f; 包括那些改变&#xff1f; 将传统汽车的电子电气架构电压从12V提升至48V&#xff0c;既有显著的优势&#xff0c;也需要对车…