Zookeeper版本:3.4.14(需提前安装)
Kafka版本:2.12-2.3.1
docker安装
docker-compose.yml
三台节点docker-compose.yml分别如下
10.69.8.12:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| version: '3.4' services: kafka: image: wurstmeister/kafka:2.12-2.3.1 container_name: kafka restart: always privileged: true network_mode: host environment: KAFKA_BROKER_ID: 1 KAFKA_ADVERTISED_HOST_NAME: 10.69.8.12 KAFKA_ADVERTISED_PORT: 9092 KAFKA_ZOOKEEPER_CONNECT: 10.69.8.12:2181,10.69.8.13:2181,10.69.8.14:2181 TZ: Asia/Shanghai volumes: - /var/run/docker.sock:/var/run/docker.sock - ./logs:/kafka
|
10.69.8.13:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| version: '3.4' services: kafka: image: wurstmeister/kafka:2.12-2.3.1 container_name: kafka restart: always privileged: true network_mode: host environment: KAFKA_BROKER_ID: 2 KAFKA_ADVERTISED_HOST_NAME: 10.69.8.13 KAFKA_ADVERTISED_PORT: 9092 KAFKA_ZOOKEEPER_CONNECT: 10.69.8.12:2181,10.69.8.13:2181,10.69.8.14:2181 TZ: Asia/Shanghai volumes: - /var/run/docker.sock:/var/run/docker.sock - ./logs:/kafka
|
10.69.8.14:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| version: '3.4' services: kafka: image: wurstmeister/kafka:2.12-2.3.1 container_name: kafka restart: always privileged: true network_mode: host environment: KAFKA_BROKER_ID: 3 KAFKA_ADVERTISED_HOST_NAME: 10.69.8.14 KAFKA_ADVERTISED_PORT: 9092 KAFKA_ZOOKEEPER_CONNECT: 10.69.8.12:2181,10.69.8.13:2181,10.69.8.14:2181 TZ: Asia/Shanghai volumes: - /var/run/docker.sock:/var/run/docker.sock - ./logs:/kafka
|
然后分别启动即可
可视化界面
这里选择eagle
,官网地址:https://www.kafka-eagle.org/
1 2 3
| wget https://codeload.github.com/smartloli/kafka-eagle-bin/tar.gz/v2.0.2 tar -zxvf kafka-eagle-bin-2.0.2.tar.gz cd /opt/kafka-eagle-web-2.0.2
|
修改配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
| # # multi zookeeper & kafka cluster list # kafka.eagle.zk.cluster.alias=cluster1 cluster1.zk.list=10.86.52.74:2181,10.86.52.77:2181,10.86.122.208:2181 #cluster2.zk.list=xdn10:2181,xdn11:2181,xdn12:2181
# # zookeeper enable acl # cluster1.zk.acl.enable=false cluster1.zk.acl.schema=digest cluster1.zk.acl.username=test cluster1.zk.acl.password=test123
# # broker size online list # cluster1.kafka.eagle.broker.size=20
# # zk client thread limit # kafka.zk.limit.size=25
# # kafka eagle webui port # kafka.eagle.webui.port=8048
# # kafka jmx acl and ssl authenticate # cluster1.kafka.eagle.jmx.acl=false cluster1.kafka.eagle.jmx.user=keadmin cluster1.kafka.eagle.jmx.password=keadmin123 cluster1.kafka.eagle.jmx.ssl=false cluster1.kafka.eagle.jmx.truststore.location=/Users/dengjie/workspace/ssl/certificates/kafka.truststore cluster1.kafka.eagle.jmx.truststore.password=ke123456
# # kafka offset storage # cluster1.kafka.eagle.offset.storage=kafka cluster2.kafka.eagle.offset.storage=zk
# # kafka metrics, 15 days by default # kafka.eagle.metrics.charts=true kafka.eagle.metrics.retain=15
# # kafka sql topic records max # kafka.eagle.sql.topic.records.max=5000
# # delete kafka topic token # kafka.eagle.topic.token=keadmin
# # kafka sasl authenticate # cluster1.kafka.eagle.sasl.enable=false cluster1.kafka.eagle.sasl.protocol=SASL_PLAINTEXT cluster1.kafka.eagle.sasl.mechanism=SCRAM-SHA-256 cluster1.kafka.eagle.sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username="kafka" password="kafka-eagle"; cluster1.kafka.eagle.sasl.client.id= cluster1.kafka.eagle.blacklist.topics= cluster1.kafka.eagle.sasl.cgroup.enable=false cluster1.kafka.eagle.sasl.cgroup.topics= cluster2.kafka.eagle.sasl.enable=false cluster2.kafka.eagle.sasl.protocol=SASL_PLAINTEXT cluster2.kafka.eagle.sasl.mechanism=PLAIN cluster2.kafka.eagle.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required username="kafka" password="kafka-eagle"; cluster2.kafka.eagle.sasl.client.id= cluster2.kafka.eagle.blacklist.topics= cluster2.kafka.eagle.sasl.cgroup.enable=false cluster2.kafka.eagle.sasl.cgroup.topics=
# # kafka ssl authenticate # cluster3.kafka.eagle.ssl.enable=false cluster3.kafka.eagle.ssl.protocol=SSL cluster3.kafka.eagle.ssl.truststore.location= cluster3.kafka.eagle.ssl.truststore.password= cluster3.kafka.eagle.ssl.keystore.location= cluster3.kafka.eagle.ssl.keystore.password= cluster3.kafka.eagle.ssl.key.password= cluster3.kafka.eagle.blacklist.topics= cluster3.kafka.eagle.ssl.cgroup.enable=false cluster3.kafka.eagle.ssl.cgroup.topics=
# # kafka sqlite jdbc driver address # kafka.eagle.driver=org.sqlite.JDBC kafka.eagle.url=jdbc:sqlite:/opt/kafka-eagle-web-2.0.2/db/ke.db kafka.eagle.username=root kafka.eagle.password=www.kafka-eagle.org
# # kafka mysql jdbc driver address # #kafka.eagle.driver=com.mysql.jdbc.Driver #kafka.eagle.url=jdbc:mysql://127.0.0.1:3306/ke?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull #kafka.eagle.username=root #kafka.eagle.password=123456
|
新增环境变量
1 2 3 4
| # vim /etc/profile export KE_HOME=/opt/kafka-eagle-web-2.0.2 PATH=$PATH:$KE_HOME/bin source /etc/profile
|
启动
http://10.86.52.77:8048/,默认账号admin,密码123456