Kafka-eagle Linux下安装与使用
kafka-eagle监控系统是一款用来监控Kafka集群的工具,支持管理多个Kafka集群、管理Kafka主题(包含查看、删除、创建等)、消费者组合消费者实例监控、消息阻塞告警、Kafka集群健康状态查看等。
1. 官网下载
www.kafka-eagle.org/articles/do…
2. kafka-eagle安装与配置
-
- 解压
tar -zxvf kafka-eagle-xxx-bin.tar.gz
-
- 配置系统变量
拥有root权限
- 配置系统变量
vi /etc/profile
export KE_HOME=/data/soft/new/kafka-eagle
export PATH=$PATH:$KE_HOME/bin
没有root权限,配置用户变量
配置jdk
install jdk
export JAVA_HOME=/usr/local/jdk8 (jdk安装路径)
exportPATH=$PATH:$JAVA_HOME/bin
这里需要配置之后,启动没发现,查看启动日志 /apps/svr/kafka-eagle-bin-2.0.6/kafka-eagle-web-2.0.6/logs/ke.out ,发现报错/usr/local/jdk8/bin/java 权限不足。
授权
配置conf/system-config.properties
配置kafka-eagle system file
# Multi zookeeper&kafka cluster list -- The client connection address of the Zookeeper cluster is set here
#这里可以配置kafka集群
kafka.eagle.zk.cluster.alias=cluster1,cluster2
cluster1.zk.list=tdn1:2181,tdn2:2181,tdn3:2181
cluster2.zk.list=xdn1:2181,xdn2:2181,xdn3:2181
# Add zookeeper acl
cluster1.zk.acl.enable=false
cluster1.zk.acl.schema=digest
cluster1.zk.acl.username=test
cluster1.zk.acl.password=test123
# Kafka broker nodes online list
cluster1.kafka.eagle.broker.size=10
cluster2.kafka.eagle.broker.size=20
# Zkcli limit -- Zookeeper cluster allows the number of clients to connect to
kafka.zk.limit.size=25
# Kafka Eagle webui port -- WebConsole port access address
kafka.eagle.webui.port=8048
# Kafka offset storage -- Offset stored in a Kafka cluster, if stored in the zookeeper, you can not use this option
##0.9之后,offset保存在kafka中,在之前的版本是存在zk中
cluster1.kafka.eagle.offset.storage=kafka
cluster2.kafka.eagle.offset.storage=kafka
# Whether the Kafka performance monitoring diagram is enabled
kafka.eagle.metrics.charts=false
# Kafka Eagle keeps data for 30 days by default
kafka.eagle.metrics.retain=30
# If offset is out of range occurs, enable this property -- Only suitable for kafka sql
kafka.eagle.sql.fix.error=false
kafka.eagle.sql.topic.records.max=5000
# Delete kafka topic token -- Set to delete the topic token, so that administrators can have the right to delete
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="admin" password="admin-secret";
# If not set, the value can be empty
cluster1.kafka.eagle.sasl.client.id=
# Add kafka cluster cgroups
cluster1.kafka.eagle.sasl.cgroup.enable=false
cluster1.kafka.eagle.sasl.cgroup.topics=kafka_ads01,kafka_ads02
cluster2.kafka.eagle.sasl.enable=true
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="admin" password="admin-secret";
cluster2.kafka.eagle.sasl.client.id=
cluster2.kafka.eagle.sasl.cgroup.enable=false
cluster2.kafka.eagle.sasl.cgroup.topics=kafka_ads03,kafka_ads04
# Default use sqlite to store data
#kafka.eagle.driver=org.sqlite.JDBC
# It is important to note that the '/hadoop/kafka-eagle/db' path must be exist.
kafka.eagle.url=jdbc:sqlite:/hadoop/kafka-eagle/db/ke.db
kafka.eagle.username=root
kafka.eagle.password=smartloli
# (Optional) set mysql address 这里推荐Mysql, 脚本在下面提供
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=smartloli
执行Mysql
create database ke;
SET NAMES utf8;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for `ke_p_role`
-- ----------------------------
DROP TABLE IF EXISTS `ke_p_role`;
CREATE TABLE `ke_p_role` (
`id` tinyint(4) NOT NULL AUTO_INCREMENT,
`name` varchar(64) CHARACTER SET utf8 NOT NULL COMMENT 'role name',
`seq` tinyint(4) NOT NULL COMMENT 'rank',
`description` varchar(128) CHARACTER SET utf8 NOT NULL COMMENT 'role describe',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `ke_p_role`
-- ----------------------------
BEGIN;
INSERT INTO `ke_p_role` VALUES ('1', 'Administrator', '1', 'Have all permissions'), ('2', 'Devs', '2', 'Own add or delete'), ('3', 'Tourist', '3', 'Only viewer');
COMMIT;
-- ----------------------------
-- Table structure for `ke_resources`
-- ----------------------------
DROP TABLE IF EXISTS `ke_resources`;
CREATE TABLE `ke_resources` (
`resource_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT 'resource name',
`url` varchar(255) NOT NULL,
`parent_id` int(11) NOT NULL,
PRIMARY KEY (`resource_id`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `ke_resources`
-- ----------------------------
BEGIN;
INSERT INTO `ke_resources` VALUES ('1', 'System', '/system', '-1'), ('2', 'User', '/system/user', '1'), ('3', 'Role', '/system/role', '1'), ('4', 'Resource', '/system/resource', '1'), ('5', 'Notice', '/system/notice', '1'), ('6', 'Topic', '/topic', '-1'), ('7', 'Message', '/topic/message', '6'), ('8', 'Create', '/topic/create', '6'), ('9', 'Alarm', '/alarm', '-1'), ('10', 'Add', '/alarm/add', '9'), ('11', 'Modify', '/alarm/modify', '9'), ('12', 'Cluster', '/cluster', '-1'), ('13', 'ZkCli', '/cluster/zkcli', '12'), ('14', 'UserDelete', '/system/user/delete', '1'), ('15', 'UserModify', '/system/user/modify', '1'), ('16', 'Mock', '/topic/mock', '6');
COMMIT;
-- ----------------------------
-- Table structure for `ke_role_resource`
-- ----------------------------
DROP TABLE IF EXISTS `ke_role_resource`;
CREATE TABLE `ke_role_resource` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`role_id` int(11) NOT NULL,
`resource_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `ke_role_resource`
-- ----------------------------
BEGIN;
INSERT INTO `ke_role_resource` VALUES ('1', '1', '1'), ('2', '1', '2'), ('3', '1', '3'), ('4', '1', '4'), ('5', '1', '5'), ('6', '1', '7'), ('7', '1', '8'), ('8', '1', '10'), ('9', '1', '11'), ('10', '1', '13'), ('11', '2', '7'), ('12', '2', '8'), ('13', '2', '13'), ('14', '2', '10'), ('15', '2', '11'), ('16', '1', '14'), ('17', '1', '15'), ('18', '1', '16');
COMMIT;
-- ----------------------------
-- Table structure for `ke_trend`
-- ----------------------------
DROP TABLE IF EXISTS `ke_trend`;
CREATE TABLE `ke_trend` (
`cluster` varchar(64) NOT NULL,
`key` varchar(64) NOT NULL,
`value` varchar(64) NOT NULL,
`hour` varchar(2) NOT NULL,
`tm` varchar(16) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for `ke_user_role`
-- ----------------------------
DROP TABLE IF EXISTS `ke_user_role`;
CREATE TABLE `ke_user_role` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`role_id` tinyint(4) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `ke_user_role`
-- ----------------------------
BEGIN;
INSERT INTO `ke_user_role` VALUES ('1', '1', '1');
COMMIT;
-- ----------------------------
-- Table structure for `ke_users`
-- ----------------------------
DROP TABLE IF EXISTS `ke_users`;
CREATE TABLE `ke_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`rtxno` int(11) NOT NULL,
`username` varchar(64) NOT NULL,
`password` varchar(128) NOT NULL,
`email` varchar(64) NOT NULL,
`realname` varchar(128) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Records of `ke_users`
-- ----------------------------
BEGIN;
INSERT INTO `ke_users` VALUES ('1', '1000', 'admin', '123456', 'admin@email.com', 'Administrator');
COMMIT;
SET FOREIGN_KEY_CHECKS = 1;
./ke.sh start 启动
./ke.sh restart 重新启动
./ke.sh stop 结束
启动
cd ${KE_HOME}/bin
./ke.sh start
启动之后,默认用户密码: admin 123456