From 5bceed71059290e5c39362ab2490e8f769c10fe5 Mon Sep 17 00:00:00 2001 From: zengqiao Date: Thu, 15 Dec 2022 14:44:18 +0800 Subject: [PATCH] =?UTF-8?q?[Optimize]=E7=BC=A9=E5=B0=8FES=E7=B4=A2?= =?UTF-8?q?=E5=BC=95=E9=BB=98=E8=AE=A4shard=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- km-dist/init/sql/ddl-ks-km.sql | 2 +- km-dist/init/template/template.sh | 99 ++++++++++++++++++++++++++++--- 2 files changed, 93 insertions(+), 8 deletions(-) diff --git a/km-dist/init/sql/ddl-ks-km.sql b/km-dist/init/sql/ddl-ks-km.sql index 8da89aab..30b51c20 100644 --- a/km-dist/init/sql/ddl-ks-km.sql +++ b/km-dist/init/sql/ddl-ks-km.sql @@ -440,9 +440,9 @@ CREATE TABLE `ks_kc_worker` ( `url` varchar(1024) NOT NULL DEFAULT '' COMMENT 'URL信息', `leader_url` varchar(1024) NOT NULL DEFAULT '' COMMENT 'leaderURL信息', `leader` int(16) NOT NULL DEFAULT '0' COMMENT '状态: 1是leader,0不是leader', + `worker_id` varchar(128) NOT NULL COMMENT 'worker地址', `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间', - `worker_id` varchar(128) NOT NULL COMMENT 'worker地址', PRIMARY KEY (`id`), UNIQUE KEY `uniq_cluster_id_member_id` (`connect_cluster_id`,`member_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='worker信息表'; diff --git a/km-dist/init/template/template.sh b/km-dist/init/template/template.sh index 86fcfb66..baae166b 100644 --- a/km-dist/init/template/template.sh +++ b/km-dist/init/template/template.sh @@ -13,7 +13,7 @@ curl -s --connect-timeout 10 -o /dev/null -X POST -H 'cache-control: no-cache' - ], "settings" : { "index" : { - "number_of_shards" : "10" + "number_of_shards" : "2" } }, "mappings" : { @@ -115,7 +115,7 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl ], "settings" : { "index" : { - "number_of_shards" : "10" + "number_of_shards" : "2" } }, "mappings" : { @@ -302,7 +302,7 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl ], "settings" : { "index" : { - "number_of_shards" : "10" + "number_of_shards" : "2" } }, "mappings" : { @@ -377,7 +377,7 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl ], "settings" : { "index" : { - "number_of_shards" : "10" + "number_of_shards" : "2" } }, "mappings" : { @@ -443,7 +443,7 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl ], "settings" : { "index" : { - "number_of_shards" : "10" + "number_of_shards" : "2" } }, "mappings" : { @@ -509,7 +509,7 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl ], "settings" : { "index" : { - "number_of_shards" : "10" + "number_of_shards" : "2" } }, "mappings" : { @@ -626,7 +626,92 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl ], "settings" : { "index" : { - "number_of_shards" : "10" + "number_of_shards" : "2" + } + }, + "mappings" : { + "properties" : { + "routingValue" : { + "type" : "text", + "fields" : { + "keyword" : { + "ignore_above" : 256, + "type" : "keyword" + } + } + }, + "clusterPhyId" : { + "type" : "long" + }, + "metrics" : { + "properties" : { + "AvgRequestLatency" : { + "type" : "double" + }, + "MinRequestLatency" : { + "type" : "double" + }, + "MaxRequestLatency" : { + "type" : "double" + }, + "OutstandingRequests" : { + "type" : "double" + }, + "NodeCount" : { + "type" : "double" + }, + "WatchCount" : { + "type" : "double" + }, + "NumAliveConnections" : { + "type" : "double" + }, + "PacketsReceived" : { + "type" : "double" + }, + "PacketsSent" : { + "type" : "double" + }, + "EphemeralsCount" : { + "type" : "double" + }, + "ApproximateDataSize" : { + "type" : "double" + }, + "OpenFileDescriptorCount" : { + "type" : "double" + }, + "MaxFileDescriptorCount" : { + "type" : "double" + } + } + }, + "key" : { + "type" : "text", + "fields" : { + "keyword" : { + "ignore_above" : 256, + "type" : "keyword" + } + } + }, + "timestamp" : { + "format" : "yyyy-MM-dd HH:mm:ss Z||yyyy-MM-dd HH:mm:ss||yyyy-MM-dd HH:mm:ss.SSS Z||yyyy-MM-dd HH:mm:ss.SSS||yyyy-MM-dd HH:mm:ss,SSS||yyyy/MM/dd HH:mm:ss||yyyy-MM-dd HH:mm:ss,SSS Z||yyyy/MM/dd HH:mm:ss,SSS Z||epoch_millis", + "type" : "date" + } + } + }, + "aliases" : { } + }' + +curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: application/json' http://${SERVER_ES_ADDRESS}/_template/ks_kafka_zookeeper_metric -d '{ + "order" : 10, + "index_patterns" : [ + "ks_kafka_zookeeper_metric*" + ], + "settings" : { + "index" : { + "number_of_shards" : "2" } }, "mappings" : {