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博客