当前位置:   article > 正文

kafka集群&kafka-eagle安装_安装kafka-edge

安装kafka-edge

目录

kafka安装

解压安装包

修改配置文件

启动集群

kafka-eagle安装

解压安装包

修改配置文件

程序启动与停止

访问页面

问题解决


kafka安装

前提条件:kafka依赖zookeeper,在安装kafka之前应安装并启动好zookeeper

zookeeper 1台:10.X.X.105

kafka 3台: 10.X.X.106/10.X.X.107/10.X.X.108

解压安装包

tar -zxvf  kafka_2.11-1.1.0.tgz

修改解压后的包名

mv kafka_2.11-1.1.0  kafka

修改配置文件

修改kafka配置文件,其中标黄部分为必须按需修改项

  • 在10.X.X.106服务器上面

vim config/server.properties

#broker.id属性在kafka集群中必须要是唯一

broker.id=0

delete.topic.enable=true

#kafka部署的机器ip和提供服务的端口号

listeners=PLAINTEXT://10.X.X.106:9092

num.network.threads=3

num.io.threads=8

socket.send.buffer.bytes=102400

socket.receive.buffer.bytes=102400

socket.request.max.bytes=104857600

# 数据存储目录(根据实际情况修改,可自己创建)

log.dirs=/opt/soft/kafka/logs

#topic 分区数量

num.partitions=1

num.recovery.threads.per.data.dir=1

log.retention.hours=72

log.segment.bytes=1073741824

log.retention.check.interval.ms=300000

#kafka连接zookeeper的地址,要把多个kafka实例组成集群,对应连接的zookeeper必须相同

zookeeper.connect=10.X.X.105:2181

zookeeper.connection.timeout.ms=6000

  • 在10.X.X.107服务器上面

vim config/server.properties

#broker.id属性在kafka集群中必须要是唯一

broker.id=1

delete.topic.enable=true

#kafka部署的机器ip和提供服务的端口号

listeners=PLAINTEXT://10.X.X.107:9092

num.network.threads=3

num.io.threads=8

socket.send.buffer.bytes=102400

socket.receive.buffer.bytes=102400

socket.request.max.bytes=104857600

# 数据存储目录(根据实际情况修改,可自己创建)

log.dirs=/opt/soft/kafka/logs

#topic 分区数量

num.partitions=1

num.recovery.threads.per.data.dir=1

log.retention.hours=72

log.segment.bytes=1073741824

log.retention.check.interval.ms=300000

#kafka连接zookeeper的地址,要把多个kafka实例组成集群,对应连接的zookeeper必须相同

zookeeper.connect=10.X.X.105:2181

zookeeper.connection.timeout.ms=6000

  • 在10.X.X.108服务器上面

vim config/server.properties

#broker.id属性在kafka集群中必须要是唯一

broker.id=2

delete.topic.enable=true

#kafka部署的机器ip和提供服务的端口号

listeners=PLAINTEXT://10.X.X.108:9092

num.network.threads=3

num.io.threads=8

socket.send.buffer.bytes=102400

socket.receive.buffer.bytes=102400

socket.request.max.bytes=104857600

# 数据存储目录(根据实际情况修改,可自己创建)

log.dirs=/opt/soft/kafka/logs

#topic 分区数量

num.partitions=1

num.recovery.threads.per.data.dir=1

log.retention.hours=72

log.segment.bytes=1073741824

log.retention.check.interval.ms=300000

#kafka连接zookeeper的地址,要把多个kafka实例组成集群,对应连接的zookeeper必须相同

zookeeper.connect=10.X.X.105:2181

zookeeper.connection.timeout.ms=6000

注:#kafka部署的机器ip和提供服务的端口号

listeners=PLAINTEXT://10.X.X.108:9092

也可以写成

host.name=10.X.X.108

port=9092

启动集群

分别在106/107/108三台机器上启动kafka

./bin/kafka-server-start.sh -daemon ./config/server.properties

使用jps检查进程是否存在,如图进程存在

验证集群

./bin/kafka-topics.sh --create --zookeeper l0.X.X.105:2181 --replication-factor 1 --partitions 5 --topic my-topic

#创建一个my-topic 的 topic 、副本为1、分区数为5

创建完成后在各个服务器的logs目录下可以看到创建的my-topic

kafka-eagle安装

前提:已安装jdk、mysql

解压安装包

tar -zxvf  kafka-eagle-bin-2.0.6.tar.gz

cd  kafka-eagle-bin-2.0.6

tar -zxvf  kafka-eagle-web-2.0.6-bin.tar.gz

修改配置文件

vim conf/system-config.properties

######################################

# multi zookeeper & kafka cluster list

######################################

kafka.eagle.zk.cluster.alias=cluster1

cluster1.zk.list=10.X.X.105:2181

######################################

# broker size online list

######################################

cluster1.kafka.eagle.broker.size=20

######################################

# zk client thread limit

######################################

kafka.zk.limit.size=32

######################################

# kafka eagle webui port

######################################

kafka.eagle.webui.port=8048

######################################

# kafka offset storage

######################################

cluster1.kafka.eagle.offset.storage=kafka

#cluster2.kafka.eagle.offset.storage=zk

######################################

# kafka jmx uri

######################################

cluster1.kafka.eagle.jmx.uri=service:jmx:rmi:///jndi/rmi://%s/jmxrmi

######################################

# 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

kafka.eagle.sql.topic.preview.records.max=10

######################################

# delete kafka topic token

######################################

kafka.eagle.topic.token=keadmin

######################################

# kafka mysql jdbc driver address

######################################

kafka.eagle.driver=com.mysql.cj.jdbc.Driver

#数据库IP:port/库名

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

注:如果想要监控集群各个服务器的CPU和内存使用情况在kafka安装目录下修改bin/kafka-server-start.sh文件

在最上面一行添加一行参数

if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
    export KAFKA_HEAP_OPTS="-Xmx4G -Xms4G"
    export JMX_PORT="9999"
fi

重启kafka即可

程序启动与停止

kafka-eagle-bin-2.0.6/kafka-eagle-web-2.0.6/bin目录下

执行./ke.sh start启动程序,如图启动成功

 执行./ke.sh stop 停止程序

访问页面

浏览器访问: http://10.X.X.105:8048

默认用户名密码:admin/123456

问题解决

1.启动时如果报数据库表结构不存在,有两种解决办法

  • 更换高版本安装
  • 手动创建数据库表结构,表结构如下:
  1. SET NAMES utf8mb4;
  2. SET FOREIGN_KEY_CHECKS = 0;
  3. -- ----------------------------
  4. -- Table structure for ke_alarm_clusters
  5. -- ----------------------------
  6. DROP TABLE IF EXISTS `ke_alarm_clusters`;
  7. CREATE TABLE `ke_alarm_clusters` (
  8. `id` bigint NOT NULL AUTO_INCREMENT,
  9. `type` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  10. `cluster` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  11. `server` text CHARACTER SET utf8mb4 NULL,
  12. `alarm_group` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  13. `alarm_times` int NULL DEFAULT NULL,
  14. `alarm_max_times` int NULL DEFAULT NULL,
  15. `alarm_level` varchar(4) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  16. `is_normal` varchar(2) CHARACTER SET utf8mb4 NULL DEFAULT 'Y',
  17. `is_enable` varchar(2) CHARACTER SET utf8mb4 NULL DEFAULT 'Y',
  18. `created` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  19. `modify` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  20. PRIMARY KEY (`id`) USING BTREE
  21. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  22. -- ----------------------------
  23. -- Records of ke_alarm_clusters
  24. -- ----------------------------
  25. -- ----------------------------
  26. -- Table structure for ke_alarm_config
  27. -- ----------------------------
  28. DROP TABLE IF EXISTS `ke_alarm_config`;
  29. CREATE TABLE `ke_alarm_config` (
  30. `cluster` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
  31. `alarm_group` varchar(128) CHARACTER SET utf8mb4 NOT NULL,
  32. `alarm_type` varchar(16) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  33. `alarm_url` text CHARACTER SET utf8mb4 NULL,
  34. `http_method` varchar(16) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  35. `alarm_address` text CHARACTER SET utf8mb4 NULL,
  36. `created` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  37. `modify` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  38. PRIMARY KEY (`cluster`, `alarm_group`) USING BTREE
  39. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  40. -- ----------------------------
  41. -- Records of ke_alarm_config
  42. -- ----------------------------
  43. -- ----------------------------
  44. -- Table structure for ke_alarm_consumer
  45. -- ----------------------------
  46. DROP TABLE IF EXISTS `ke_alarm_consumer`;
  47. CREATE TABLE `ke_alarm_consumer` (
  48. `id` bigint NOT NULL AUTO_INCREMENT,
  49. `cluster` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  50. `group` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  51. `topic` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  52. `lag` bigint NULL DEFAULT NULL,
  53. `alarm_group` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  54. `alarm_times` int NULL DEFAULT NULL,
  55. `alarm_max_times` int NULL DEFAULT NULL,
  56. `alarm_level` varchar(4) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  57. `is_normal` varchar(2) CHARACTER SET utf8mb4 NULL DEFAULT 'Y',
  58. `is_enable` varchar(2) CHARACTER SET utf8mb4 NULL DEFAULT 'Y',
  59. `created` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  60. `modify` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  61. PRIMARY KEY (`id`) USING BTREE
  62. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  63. -- ----------------------------
  64. -- Records of ke_alarm_consumer
  65. -- ----------------------------
  66. -- ----------------------------
  67. -- Table structure for ke_alarm_crontab
  68. -- ----------------------------
  69. DROP TABLE IF EXISTS `ke_alarm_crontab`;
  70. CREATE TABLE `ke_alarm_crontab` (
  71. `id` bigint NOT NULL,
  72. `type` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
  73. `crontab` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  74. `is_enable` varchar(2) CHARACTER SET utf8mb4 NULL DEFAULT 'Y',
  75. `created` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  76. `modify` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  77. PRIMARY KEY (`id`, `type`) USING BTREE
  78. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  79. -- ----------------------------
  80. -- Records of ke_alarm_crontab
  81. -- ----------------------------
  82. -- ----------------------------
  83. -- Table structure for ke_connect_config
  84. -- ----------------------------
  85. DROP TABLE IF EXISTS `ke_connect_config`;
  86. CREATE TABLE `ke_connect_config` (
  87. `id` bigint NOT NULL AUTO_INCREMENT,
  88. `cluster` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  89. `connect_uri` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  90. `version` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  91. `alive` varchar(16) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  92. `created` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  93. `modify` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  94. PRIMARY KEY (`id`) USING BTREE
  95. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  96. -- ----------------------------
  97. -- Records of ke_connect_config
  98. -- ----------------------------
  99. -- ----------------------------
  100. -- Table structure for ke_consumer_bscreen
  101. -- ----------------------------
  102. DROP TABLE IF EXISTS `ke_consumer_bscreen`;
  103. CREATE TABLE `ke_consumer_bscreen` (
  104. `cluster` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  105. `group` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  106. `topic` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  107. `logsize` bigint NULL DEFAULT NULL,
  108. `difflogsize` bigint NULL DEFAULT NULL,
  109. `offsets` bigint NULL DEFAULT NULL,
  110. `diffoffsets` bigint NULL DEFAULT NULL,
  111. `lag` bigint NULL DEFAULT NULL,
  112. `timespan` bigint NULL DEFAULT NULL,
  113. `tm` varchar(16) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  114. INDEX `idx_timespan`(`timespan`) USING BTREE,
  115. INDEX `idx_tm_cluster_diffoffsets`(`tm`, `cluster`, `diffoffsets`) USING BTREE
  116. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  117. -- ----------------------------
  118. -- Records of ke_consumer_bscreen
  119. -- ----------------------------
  120. -- ----------------------------
  121. -- Table structure for ke_consumer_group
  122. -- ----------------------------
  123. DROP TABLE IF EXISTS `ke_consumer_group`;
  124. CREATE TABLE `ke_consumer_group` (
  125. `cluster` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
  126. `group` varchar(128) CHARACTER SET utf8mb4 NOT NULL,
  127. `topic` varchar(128) CHARACTER SET utf8mb4 NOT NULL,
  128. `status` int NULL DEFAULT NULL,
  129. PRIMARY KEY (`cluster`, `group`, `topic`) USING BTREE
  130. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  131. -- ----------------------------
  132. -- Records of ke_consumer_group
  133. -- ----------------------------
  134. -- ----------------------------
  135. -- Table structure for ke_consumer_group_summary
  136. -- ----------------------------
  137. DROP TABLE IF EXISTS `ke_consumer_group_summary`;
  138. CREATE TABLE `ke_consumer_group_summary` (
  139. `cluster` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
  140. `group` varchar(128) CHARACTER SET utf8mb4 NOT NULL,
  141. `topic_number` varchar(128) CHARACTER SET utf8mb4 NOT NULL,
  142. `coordinator` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  143. `active_topic` int NULL DEFAULT NULL,
  144. `active_thread_total` int NULL DEFAULT NULL,
  145. PRIMARY KEY (`cluster`, `group`) USING BTREE
  146. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  147. -- ----------------------------
  148. -- Records of ke_consumer_group_summary
  149. -- ----------------------------
  150. -- ----------------------------
  151. -- Table structure for ke_logsize
  152. -- ----------------------------
  153. DROP TABLE IF EXISTS `ke_logsize`;
  154. CREATE TABLE `ke_logsize` (
  155. `cluster` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  156. `topic` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  157. `logsize` bigint NULL DEFAULT NULL,
  158. `diffval` bigint NULL DEFAULT NULL,
  159. `timespan` bigint NULL DEFAULT NULL,
  160. `tm` varchar(16) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  161. INDEX `idx_timespan`(`timespan`) USING BTREE,
  162. INDEX `idx_tm_topic`(`tm`, `topic`) USING BTREE,
  163. INDEX `idx_tm_cluster_diffval`(`tm`, `cluster`, `diffval`) USING BTREE
  164. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  165. -- ----------------------------
  166. -- Records of ke_logsize
  167. -- ----------------------------
  168. -- ----------------------------
  169. -- Table structure for ke_metrics
  170. -- ----------------------------
  171. DROP TABLE IF EXISTS `ke_metrics`;
  172. CREATE TABLE `ke_metrics` (
  173. `cluster` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  174. `broker` text CHARACTER SET utf8mb4 NULL,
  175. `type` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  176. `key` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  177. `value` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  178. `timespan` bigint NULL DEFAULT NULL,
  179. `tm` varchar(16) CHARACTER SET utf8mb4 NULL DEFAULT NULL
  180. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  181. -- ----------------------------
  182. -- Records of ke_metrics
  183. -- ----------------------------
  184. -- ----------------------------
  185. -- Table structure for ke_metrics_offline
  186. -- ----------------------------
  187. DROP TABLE IF EXISTS `ke_metrics_offline`;
  188. CREATE TABLE `ke_metrics_offline` (
  189. `cluster` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
  190. `key` varchar(128) CHARACTER SET utf8mb4 NOT NULL,
  191. `one` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  192. `mean` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  193. `five` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  194. `fifteen` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  195. PRIMARY KEY (`cluster`, `key`) USING BTREE
  196. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  197. -- ----------------------------
  198. -- Records of ke_metrics_offline
  199. -- ----------------------------
  200. -- ----------------------------
  201. -- Table structure for ke_p_role
  202. -- ----------------------------
  203. DROP TABLE IF EXISTS `ke_p_role`;
  204. CREATE TABLE `ke_p_role` (
  205. `id` bigint NOT NULL AUTO_INCREMENT,
  206. `name` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'role name',
  207. `seq` tinyint NOT NULL COMMENT 'rank',
  208. `description` varchar(128) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'role describe',
  209. PRIMARY KEY (`id`) USING BTREE
  210. ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  211. -- ----------------------------
  212. -- Records of ke_p_role
  213. -- ----------------------------
  214. INSERT INTO `ke_p_role` VALUES (1, 'Administrator', 1, 'Have all permissions');
  215. INSERT INTO `ke_p_role` VALUES (2, 'Devs', 2, 'Own add or delete');
  216. INSERT INTO `ke_p_role` VALUES (3, 'Tourist', 3, 'Only viewer');
  217. -- ----------------------------
  218. -- Table structure for ke_resources
  219. -- ----------------------------
  220. DROP TABLE IF EXISTS `ke_resources`;
  221. CREATE TABLE `ke_resources` (
  222. `resource_id` bigint NOT NULL AUTO_INCREMENT,
  223. `name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'resource name',
  224. `url` varchar(255) CHARACTER SET utf8mb4 NOT NULL,
  225. `parent_id` int NOT NULL,
  226. PRIMARY KEY (`resource_id`) USING BTREE
  227. ) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  228. -- ----------------------------
  229. -- Records of ke_resources
  230. -- ----------------------------
  231. INSERT INTO `ke_resources` VALUES (1, 'System', '/system', -1);
  232. INSERT INTO `ke_resources` VALUES (2, 'User', '/system/user', 1);
  233. INSERT INTO `ke_resources` VALUES (3, 'Role', '/system/role', 1);
  234. INSERT INTO `ke_resources` VALUES (4, 'Resource', '/system/resource', 1);
  235. INSERT INTO `ke_resources` VALUES (5, 'Notice', '/system/notice', 1);
  236. INSERT INTO `ke_resources` VALUES (6, 'Topic', '/topic', -1);
  237. INSERT INTO `ke_resources` VALUES (7, 'Message', '/topic/message', 6);
  238. INSERT INTO `ke_resources` VALUES (8, 'Create', '/topic/create', 6);
  239. INSERT INTO `ke_resources` VALUES (9, 'Alarm', '/alarm', -1);
  240. INSERT INTO `ke_resources` VALUES (10, 'Add', '/alarm/add', 9);
  241. INSERT INTO `ke_resources` VALUES (11, 'Modify', '/alarm/modify', 9);
  242. INSERT INTO `ke_resources` VALUES (12, 'Cluster', '/cluster', -1);
  243. INSERT INTO `ke_resources` VALUES (13, 'ZkCli', '/cluster/zkcli', 12);
  244. INSERT INTO `ke_resources` VALUES (14, 'UserDelete', '/system/user/delete', 1);
  245. INSERT INTO `ke_resources` VALUES (15, 'UserModify', '/system/user/modify', 1);
  246. INSERT INTO `ke_resources` VALUES (16, 'Mock', '/topic/mock', 6);
  247. INSERT INTO `ke_resources` VALUES (18, 'Create', '/alarm/create', 9);
  248. INSERT INTO `ke_resources` VALUES (19, 'History', '/alarm/history', 9);
  249. INSERT INTO `ke_resources` VALUES (20, 'Manager', '/topic/manager', 6);
  250. INSERT INTO `ke_resources` VALUES (21, 'PasswdReset', '/system/user/reset', 1);
  251. INSERT INTO `ke_resources` VALUES (22, 'Config', '/alarm/config', 9);
  252. INSERT INTO `ke_resources` VALUES (23, 'List', '/alarm/list', 9);
  253. INSERT INTO `ke_resources` VALUES (24, 'Hub', '/topic/hub', 6);
  254. -- ----------------------------
  255. -- Table structure for ke_role_resource
  256. -- ----------------------------
  257. DROP TABLE IF EXISTS `ke_role_resource`;
  258. CREATE TABLE `ke_role_resource` (
  259. `id` bigint NOT NULL AUTO_INCREMENT,
  260. `role_id` int NOT NULL,
  261. `resource_id` int NOT NULL,
  262. PRIMARY KEY (`id`) USING BTREE
  263. ) ENGINE = InnoDB AUTO_INCREMENT = 26 CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  264. -- ----------------------------
  265. -- Records of ke_role_resource
  266. -- ----------------------------
  267. INSERT INTO `ke_role_resource` VALUES (1, 1, 1);
  268. INSERT INTO `ke_role_resource` VALUES (2, 1, 2);
  269. INSERT INTO `ke_role_resource` VALUES (3, 1, 3);
  270. INSERT INTO `ke_role_resource` VALUES (4, 1, 4);
  271. INSERT INTO `ke_role_resource` VALUES (5, 1, 5);
  272. INSERT INTO `ke_role_resource` VALUES (6, 1, 7);
  273. INSERT INTO `ke_role_resource` VALUES (7, 1, 8);
  274. INSERT INTO `ke_role_resource` VALUES (8, 1, 10);
  275. INSERT INTO `ke_role_resource` VALUES (9, 1, 11);
  276. INSERT INTO `ke_role_resource` VALUES (10, 1, 13);
  277. INSERT INTO `ke_role_resource` VALUES (11, 2, 7);
  278. INSERT INTO `ke_role_resource` VALUES (12, 2, 8);
  279. INSERT INTO `ke_role_resource` VALUES (13, 2, 13);
  280. INSERT INTO `ke_role_resource` VALUES (14, 2, 10);
  281. INSERT INTO `ke_role_resource` VALUES (15, 2, 11);
  282. INSERT INTO `ke_role_resource` VALUES (16, 1, 14);
  283. INSERT INTO `ke_role_resource` VALUES (17, 1, 15);
  284. INSERT INTO `ke_role_resource` VALUES (18, 1, 16);
  285. INSERT INTO `ke_role_resource` VALUES (19, 1, 18);
  286. INSERT INTO `ke_role_resource` VALUES (20, 1, 19);
  287. INSERT INTO `ke_role_resource` VALUES (21, 1, 20);
  288. INSERT INTO `ke_role_resource` VALUES (22, 1, 21);
  289. INSERT INTO `ke_role_resource` VALUES (23, 1, 22);
  290. INSERT INTO `ke_role_resource` VALUES (24, 1, 23);
  291. INSERT INTO `ke_role_resource` VALUES (25, 1, 24);
  292. -- ----------------------------
  293. -- Table structure for ke_sql_history
  294. -- ----------------------------
  295. DROP TABLE IF EXISTS `ke_sql_history`;
  296. CREATE TABLE `ke_sql_history` (
  297. `id` bigint NOT NULL AUTO_INCREMENT,
  298. `cluster` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  299. `username` varchar(64) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  300. `host` varchar(128) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  301. `ksql` text CHARACTER SET utf8mb4 NULL,
  302. `status` varchar(16) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  303. `spend_time` bigint NULL DEFAULT NULL,
  304. `created` varchar(32) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  305. `tm` varchar(16) CHARACTER SET utf8mb4 NULL DEFAULT NULL,
  306. PRIMARY KEY (`id`) USING BTREE
  307. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  308. -- ----------------------------
  309. -- Records of ke_sql_history
  310. -- ----------------------------
  311. -- ----------------------------
  312. -- Table structure for ke_topic_rank
  313. -- ----------------------------
  314. DROP TABLE IF EXISTS `ke_topic_rank`;
  315. CREATE TABLE `ke_topic_rank` (
  316. `cluster` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
  317. `topic` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
  318. `tkey` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
  319. `tvalue` bigint NULL DEFAULT NULL,
  320. PRIMARY KEY (`cluster`, `topic`, `tkey`) USING BTREE
  321. ) ENGINE = InnoDB CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  322. -- ----------------------------
  323. -- Records of ke_topic_rank
  324. -- ----------------------------
  325. -- ----------------------------
  326. -- Table structure for ke_user_role
  327. -- ----------------------------
  328. DROP TABLE IF EXISTS `ke_user_role`;
  329. CREATE TABLE `ke_user_role` (
  330. `id` bigint NOT NULL AUTO_INCREMENT,
  331. `user_id` int NOT NULL,
  332. `role_id` tinyint NOT NULL,
  333. PRIMARY KEY (`id`) USING BTREE
  334. ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  335. -- ----------------------------
  336. -- Records of ke_user_role
  337. -- ----------------------------
  338. INSERT INTO `ke_user_role` VALUES (1, 1, 1);
  339. -- ----------------------------
  340. -- Table structure for ke_users
  341. -- ----------------------------
  342. DROP TABLE IF EXISTS `ke_users`;
  343. CREATE TABLE `ke_users` (
  344. `id` bigint NOT NULL AUTO_INCREMENT,
  345. `rtxno` int NOT NULL,
  346. `username` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
  347. `password` varchar(128) CHARACTER SET utf8mb4 NOT NULL,
  348. `email` varchar(64) CHARACTER SET utf8mb4 NOT NULL,
  349. `realname` varchar(128) CHARACTER SET utf8mb4 NOT NULL,
  350. PRIMARY KEY (`id`) USING BTREE
  351. ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 ROW_FORMAT = Dynamic;
  352. -- ----------------------------
  353. -- Records of ke_users
  354. -- ----------------------------
  355. INSERT INTO `ke_users` VALUES (1, 1000, 'admin', '123456', 'admin@email.com', 'Administrator');
  356. SET FOREIGN_KEY_CHECKS = 1;

2.注意防火墙是否关闭,端口号是否开放

3.若果遇到类似下面的问题,可以先尝试把集群的所有kafka重新启动

其它

创建topic

./bin/kafka-topics.sh --create --zookeeper 10.X.X.105:2181 --replication-factor 1 --partitions 5 --topic my

手动删除topic

  1. 查看kafka下的topic:./bin/kafka-topics.sh --zookeeper 【zoserver】 --list
  2.         ./bin/kafka-topics.sh --zookeeper 10.X.X.105:2181 --list
  3. 删除(做标记):./bin/kafka-topics.sh --delete --zookeeper 【zoserver】 --topic 【topic name】
  4.         ./bin/kafka-topics.sh --delete --zookeeper 10.X.X.105:2181 --topic  my
  5. 进入kafka的zookeeper客户端:./bin/zookeeper-shell.sh 10.X.X.105:2181
  6. 进入kafka的zookeeper后查看kafka下topic:ls /brokers/topics
  7. 真删除:rmr /brokers/topics 【topic name】
  8.      rmr /brokers/topics my
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号