1. 程式人生 > >centos7 kafka安裝並安裝web介面監控工具

centos7 kafka安裝並安裝web介面監控工具

kafka自帶zookeeper,所以不需要下載zookeeper

1、下載

wget http://mirrors.shu.edu.cn/apache/kafka/2.0.0/kafka_2.12-2.0.0.tgz

2、安裝

tar -zxvf kafka_2.12-2.0.0.tgz

[[email protected] opt]# tar -zxvf kafka_2.12-2.0.0.tgz
[[email protected] opt]# cd kafka_2.12-2.0.0/
[[email protected] kafka_2.12-2.0.0]# ll
total 56
drwxr-xr-x. 3 root root  4096 Jul 24 22:20 bin
drwxr-xr-x. 2 root root  4096 Oct  8 17:01 config
drwxr-xr-x. 2 root root  4096 Oct  8 16:51 libs
-rw-r--r--. 1 root root 28824 Jul 24 22:17 LICENSE
drwxr-xr-x. 2 root root  4096 Oct  9 16:03 logs
-rw-r--r--. 1 root root   336 Jul 24 22:17 NOTICE
drwxr-xr-x. 2 root root    43 Jul 24 22:20 site-docs

3、配置

修改server.properties

vim config/server.properties

zookeeper.connect=localhost:2181

4、啟動

[[email protected] kafka_2.12-2.0.0]# cd bin
[[email protected] bin]# ll
total 132
-rwxr-xr-x. 1 root root 1421 Jul 24 22:17 connect-distributed.sh
-rwxr-xr-x. 1 root root 1418 Jul 24 22:17 connect-standalone.sh
-rwxr-xr-x. 1 root root  861 Jul 24 22:17 kafka-acls.sh
-rwxr-xr-x. 1 root root  873 Jul 24 22:17 kafka-broker-api-versions.sh
-rwxr-xr-x. 1 root root  864 Jul 24 22:17 kafka-configs.sh
-rwxr-xr-x. 1 root root  945 Jul 24 22:17 kafka-console-consumer.sh
-rwxr-xr-x. 1 root root  944 Jul 24 22:17 kafka-console-producer.sh
-rwxr-xr-x. 1 root root  871 Jul 24 22:17 kafka-consumer-groups.sh
-rwxr-xr-x. 1 root root  948 Jul 24 22:17 kafka-consumer-perf-test.sh
-rwxr-xr-x. 1 root root  871 Jul 24 22:17 kafka-delegation-tokens.sh
-rwxr-xr-x. 1 root root  869 Jul 24 22:17 kafka-delete-records.sh
-rwxr-xr-x. 1 root root  866 Jul 24 22:17 kafka-dump-log.sh
-rwxr-xr-x. 1 root root  863 Jul 24 22:17 kafka-log-dirs.sh
-rwxr-xr-x. 1 root root  862 Jul 24 22:17 kafka-mirror-maker.sh
-rwxr-xr-x. 1 root root  886 Jul 24 22:17 kafka-preferred-replica-election.sh
-rwxr-xr-x. 1 root root  959 Jul 24 22:17 kafka-producer-perf-test.sh
-rwxr-xr-x. 1 root root  874 Jul 24 22:17 kafka-reassign-partitions.sh
-rwxr-xr-x. 1 root root  874 Jul 24 22:17 kafka-replica-verification.sh
-rwxr-xr-x. 1 root root 9290 Jul 24 22:17 kafka-run-class.sh
-rwxr-xr-x. 1 root root 1376 Jul 24 22:17 kafka-server-start.sh
-rwxr-xr-x. 1 root root  997 Jul 24 22:17 kafka-server-stop.sh
-rwxr-xr-x. 1 root root  945 Jul 24 22:17 kafka-streams-application-reset.sh
-rwxr-xr-x. 1 root root  863 Jul 24 22:17 kafka-topics.sh
-rwxr-xr-x. 1 root root  958 Jul 24 22:17 kafka-verifiable-consumer.sh
-rwxr-xr-x. 1 root root  958 Jul 24 22:17 kafka-verifiable-producer.sh
-rwxr-xr-x. 1 root root 1722 Jul 24 22:17 trogdor.sh
drwxr-xr-x. 2 root root 4096 Jul 24 22:17 windows
-rwxr-xr-x. 1 root root  867 Jul 24 22:17 zookeeper-security-migration.sh
-rwxr-xr-x. 1 root root 1393 Jul 24 22:17 zookeeper-server-start.sh
-rwxr-xr-x. 1 root root 1001 Jul 24 22:17 zookeeper-server-stop.sh
-rwxr-xr-x. 1 root root  968 Jul 24 22:17 zookeeper-shell.sh

先啟動zk

[[email protected] bin]# ./zookeeper-server-start.sh -daemon ../config/zookeeper.properties

再啟動kafka

[[email protected] bin]# ./kafka-server-start.sh -daemon ../config/server.properties

檢視啟動情況

[[email protected] bin]# netstat -tunlp|egrep "(2181|9092)"
tcp6       0      0 :::9092                 :::*                    LISTEN      15122/java          
tcp6       0      0 :::2181                 :::*                    LISTEN      14705/java

其中9092 是kafka埠,2181是zookeeper埠

kafka預設是沒有web介面的,給kafka新增web介面