topic常规操作命令

[root@master122 home]# /usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_1
Topic MsgHead_1_1 is marked for deletion.
Note: This will have no impact if delete.topic.enable is not set to true.
You have new mail in /var/spool/mail/root
[root@master122 home]# 



[root@master122 home]# /usr/hdp/current/kafka-broker/bin/kafka-topics.sh --zookeeper localhost:2181 --list
MessageBody
MsgHead_1_1
MsgHead_1_10
MsgHead_1_2
MsgHead_1_3
MsgHead_1_3_internal
MsgHead_1_4
MsgHead_1_5
MsgHead_1_5_internal
MsgHead_1_6
MsgHead_1_7
MsgHead_1_8
MsgHead_1_9
MsgHead_1_9_internal
MsgHead_2_1
MsgHead_2_2
MsgHead_2_3
MsgHead_2_4
MsgHead_3_1
MsgHead_3_2
MsgHead_3_3
MsgHead_3_4
NetCapPacket
NetReassemble
NetTopology
You have new mail in /var/spool/mail/root







/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MessageBody
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_1
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_10
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_2
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_3
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_3_internal
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_4
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_5
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_5_internal
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_6
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_7
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_8
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_9
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_1_9_internal
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_2_1
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_2_2
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_2_3
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_2_4
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_3_1
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_3_2
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_3_3
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic MsgHead_3_4
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic NetCapPacket
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic NetReassemble
/usr/hdp/current/kafka-broker/bin/kafka-topics.sh --delete --zookeeper localhost:2181 --topic NetTopology
















mysql> drop database bpm-db;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-db' at line 1
mysql> drop database "bpm-db";
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"bpm-db"' at line 1
mysql> drop database `bpm-db`;
Query OK, 216 rows affected (18.60 sec)

mysql> drop database `topology-db`;
Query OK, 93 rows affected (8.04 sec)

mysql> 






root - > calvin



[root@master122 home]# /usr/hdp/current/zookeeper-client/bin/zkCli.sh 
Connecting to localhost:2181
2018-06-26 16:09:34,566 - INFO  [main:Environment@100] - Client environment:zookeeper.version=3.4.6-1245--1, built on 08/26/2016 00:47 GMT
2018-06-26 16:09:34,571 - INFO  [main:Environment@100] - Client environment:host.name=master122
2018-06-26 16:09:34,571 - INFO  [main:Environment@100] - Client environment:java.version=1.8.0_121
2018-06-26 16:09:34,576 - INFO  [main:Environment@100] - Client environment:java.vendor=Oracle Corporation
2018-06-26 16:09:34,576 - INFO  [main:Environment@100] - Client environment:java.home=/usr/java/jdk1.8.0_121/jre
2018-06-26 16:09:34,576 - INFO  [main:Environment@100] - Client environment:java.class.path=/usr/hdp/current/zookeeper-client/bin/../build/classes:/usr/hdp/current/zookeeper-client/bin/../build/lib/*.jar:/usr/hdp/current/zookeeper-client/bin/../lib/xercesMinimal-1.9.6.2.jar:/usr/hdp/current/zookeeper-client/bin/../lib/wagon-provider-api-2.4.jar:/usr/hdp/current/zookeeper-client/bin/../lib/wagon-http-shared4-2.4.jar:/usr/hdp/current/zookeeper-client/bin/../lib/wagon-http-shared-1.0-beta-6.jar:/usr/hdp/current/zookeeper-client/bin/../lib/wagon-http-lightweight-1.0-beta-6.jar:/usr/hdp/current/zookeeper-client/bin/../lib/wagon-http-2.4.jar:/usr/hdp/current/zookeeper-client/bin/../lib/wagon-file-1.0-beta-6.jar:/usr/hdp/current/zookeeper-client/bin/../lib/slf4j-log4j12-1.6.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/slf4j-api-1.6.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/plexus-utils-3.0.8.jar:/usr/hdp/current/zookeeper-client/bin/../lib/plexus-interpolation-1.11.jar:/usr/hdp/current/zookeeper-client/bin/../lib/plexus-container-default-1.0-alpha-9-stable-1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/netty-3.7.0.Final.jar:/usr/hdp/current/zookeeper-client/bin/../lib/nekohtml-1.9.6.2.jar:/usr/hdp/current/zookeeper-client/bin/../lib/maven-settings-2.2.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/maven-repository-metadata-2.2.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/maven-project-2.2.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/maven-profile-2.2.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/maven-plugin-registry-2.2.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/maven-model-2.2.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/maven-error-diagnostics-2.2.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/maven-artifact-manager-2.2.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/maven-artifact-2.2.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/maven-ant-tasks-2.1.3.jar:/usr/hdp/current/zookeeper-client/bin/../lib/log4j-1.2.16.jar:/usr/hdp/current/zookeeper-client/bin/../lib/jsoup-1.7.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/jline-0.9.94.jar:/usr/hdp/current/zookeeper-client/bin/../lib/commons-logging-1.1.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/commons-io-2.2.jar:/usr/hdp/current/zookeeper-client/bin/../lib/commons-codec-1.6.jar:/usr/hdp/current/zookeeper-client/bin/../lib/classworlds-1.1-alpha-2.jar:/usr/hdp/current/zookeeper-client/bin/../lib/backport-util-concurrent-3.1.jar:/usr/hdp/current/zookeeper-client/bin/../lib/ant-launcher-1.8.0.jar:/usr/hdp/current/zookeeper-client/bin/../lib/ant-1.8.0.jar:/usr/hdp/current/zookeeper-client/bin/../zookeeper-3.4.6.2.5.0.0-1245.jar:/usr/hdp/current/zookeeper-client/bin/../src/java/lib/*.jar:/usr/hdp/current/zookeeper-client/bin/../conf:.:/usr/java/jdk/jre/lib/dt.jar:/usr/java/jdk/lib/tools.jar:/usr/share/zookeeper/*
2018-06-26 16:09:34,577 - INFO  [main:Environment@100] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2018-06-26 16:09:34,577 - INFO  [main:Environment@100] - Client environment:java.io.tmpdir=/tmp
2018-06-26 16:09:34,577 - INFO  [main:Environment@100] - Client environment:java.compiler=<NA>
2018-06-26 16:09:34,577 - INFO  [main:Environment@100] - Client environment:os.name=Linux
2018-06-26 16:09:34,578 - INFO  [main:Environment@100] - Client environment:os.arch=amd64
2018-06-26 16:09:34,578 - INFO  [main:Environment@100] - Client environment:os.version=2.6.32-431.el6.x86_64
2018-06-26 16:09:34,578 - INFO  [main:Environment@100] - Client environment:user.name=root
2018-06-26 16:09:34,579 - INFO  [main:Environment@100] - Client environment:user.home=/root
2018-06-26 16:09:34,579 - INFO  [main:Environment@100] - Client environment:user.dir=/home
2018-06-26 16:09:34,582 - INFO  [main:ZooKeeper@438] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@619a5dff
Welcome to ZooKeeper!
2018-06-26 16:09:34,648 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1019] - Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
JLine support is enabled
2018-06-26 16:09:34,797 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@864] - Socket connection established to localhost/0:0:0:0:0:0:0:1:2181, initiating session
2018-06-26 16:09:34,827 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1279] - Session establishment complete on server localhost/0:0:0:0:0:0:0:1:2181, sessionid = 0x164369e04de0039, negotiated timeout = 30000

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
[zk: localhost:2181(CONNECTED) 4] ls /brokers/topics/test-topic
Node does not exist: /brokers/topics/test-topic
[zk: localhost:2181(CONNECTED) 5] ls /config/topics/test-topic
Node does not exist: /config/topics/test-topic
[zk: localhost:2181(CONNECTED) 6] ls /admin/delete_topics/test-topic
Node does not exist: /admin/delete_topics/test-topic

 

 

/usr/hdp/current/kafka-broker/bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic NetCapPacket
/usr/hdp/current/kafka-broker/bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic NetCapPacket


--查看topic列表
bin/kafka-topics.sh --zookeeper localhost:2181 --list

--创建topic
bin/kafka-topics.sh --zookeeper localhost:2181 --create --configureTopic
bin/kafka-topics.sh --zookeeper localhost:2181 --create --dataTopic

--查看topic数据
bin/kafka-console-consumer.sh  --zookeeper localhost:2181  --topic configureTopic
bin/kafka-console-consumer.sh  --zookeeper localhost:2181  --topic dataTopic

--查看topic数据
/usr/hdp/current/kafka-broker/bin/kafka-console-consumer.sh --zookeeper localhost:2181 --topic MsgHead_1_1

 

posted @ 2018-08-29 18:33  ArcerZhang  阅读(583)  评论(0编辑  收藏  举报