CentOS7 搭建Kafka(三)工具篇
作爲一名懶人,天然不喜歡敲那些命令,一個是容易出錯,另一個是懶得記,能有個工具就最好了,一查還挺多,咱們用個最主流的Kafka Managergit
Kafka Manager
kafka manager是yahoo爲了維護kafka而開發的一款web管理工具,你能夠利用他來管理集羣、副本及Topic等,且項目在GitHub上開源:<br/> 源碼:[https://github.com/yahoo/kafka-manager]<br/> 安裝包:[https://github.com/yahoo/kafka-manager/releases/]<br/>github
安裝
由於kafka-manager使用的play框架,須要優先配置sbt,不過sbt的默認maven倉庫速度你懂的,「Great wall」就是互聯網界的珠穆朗瑪峯,還好網上有將將配置改成aliyun的maven庫的方法。web
cd ~ mkdir .sbt cd .sbt vi repositories
編輯內容以下:vim
[repositories] local public: http://maven.aliyun.com/nexus/content/groups/public/#這個maven typesafe:http://dl.bintray.com/typesafe/ivy-releases/ , [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly ivy-sbt-plugin:http://dl.bintray.com/sbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext] sonatype-oss-releases sonatype-oss-snapshots
編輯完成後繼續執行命令以下:瀏覽器
curl https://bintray.com/sbt/rpm/rpm |tee /etc/yum.repos.d/bintray-sbt-rpm.repo yum install sbt wget https://github.com/yahoo/kafka-manager/archive/1.3.3.17.tar.gz tar -zxvf 1.3.3.17.tar.gz mkdir /opt/kafka_1.1/manager mv /usr/download/kafka-manager-1.3.3.17/* /opt/kafka_1.1/manager cd /opt/kafka_1.1/manager sbt clean dist #這個時間很長 慢慢等吧 有可能還會失敗 多搞幾回 cd /opt/kafka_1.1/manager/target/universal/ unzip kafka-manager-1.3.3.17.zip mv kafka-manager-1.3.3.17 /opt/kafka_1.1/manager1 cd /opt/kafka_1.1 rm -rf manager mv manager1 manager vim manager/conf/application.conf
修改配置以下:app
kafka-manager.zkhosts="192.168.253.133:2181"
啓動:框架
bin/kafka-manager
默認端口9000,你也能夠經過下面的命令來本身指定端口curl
nohup bin/kafka-manager -Dconfig.file=conf/application.conf -Dhttp.port=9001 &
固然了別忘了修改防火牆配置maven
firewall-cmd --permanent --add-port=9000/tcp systemctl restart firewalld.service
經過瀏覽器訪問後,在add cluster配置集羣tcp