Skip to content

Commit 5bceed7

Browse files
author
zengqiao
committed
[Optimize]缩小ES索引默认shard数
1 parent 44a2fe0 commit 5bceed7

File tree

2 files changed

+93
-8
lines changed

2 files changed

+93
-8
lines changed

km-dist/init/sql/ddl-ks-km.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,9 @@ CREATE TABLE `ks_kc_worker` (
440440
`url` varchar(1024) NOT NULL DEFAULT '' COMMENT 'URL信息',
441441
`leader_url` varchar(1024) NOT NULL DEFAULT '' COMMENT 'leaderURL信息',
442442
`leader` int(16) NOT NULL DEFAULT '0' COMMENT '状态: 1是leader,0不是leader',
443+
`worker_id` varchar(128) NOT NULL COMMENT 'worker地址',
443444
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
444445
`update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
445-
`worker_id` varchar(128) NOT NULL COMMENT 'worker地址',
446446
PRIMARY KEY (`id`),
447447
UNIQUE KEY `uniq_cluster_id_member_id` (`connect_cluster_id`,`member_id`)
448448
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='worker信息表';

km-dist/init/template/template.sh

Lines changed: 92 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ curl -s --connect-timeout 10 -o /dev/null -X POST -H 'cache-control: no-cache' -
1313
],
1414
"settings" : {
1515
"index" : {
16-
"number_of_shards" : "10"
16+
"number_of_shards" : "2"
1717
}
1818
},
1919
"mappings" : {
@@ -115,7 +115,7 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl
115115
],
116116
"settings" : {
117117
"index" : {
118-
"number_of_shards" : "10"
118+
"number_of_shards" : "2"
119119
}
120120
},
121121
"mappings" : {
@@ -302,7 +302,7 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl
302302
],
303303
"settings" : {
304304
"index" : {
305-
"number_of_shards" : "10"
305+
"number_of_shards" : "2"
306306
}
307307
},
308308
"mappings" : {
@@ -377,7 +377,7 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl
377377
],
378378
"settings" : {
379379
"index" : {
380-
"number_of_shards" : "10"
380+
"number_of_shards" : "2"
381381
}
382382
},
383383
"mappings" : {
@@ -443,7 +443,7 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl
443443
],
444444
"settings" : {
445445
"index" : {
446-
"number_of_shards" : "10"
446+
"number_of_shards" : "2"
447447
}
448448
},
449449
"mappings" : {
@@ -509,7 +509,7 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl
509509
],
510510
"settings" : {
511511
"index" : {
512-
"number_of_shards" : "10"
512+
"number_of_shards" : "2"
513513
}
514514
},
515515
"mappings" : {
@@ -626,7 +626,92 @@ curl -s -o /dev/null -X POST -H 'cache-control: no-cache' -H 'content-type: appl
626626
],
627627
"settings" : {
628628
"index" : {
629-
"number_of_shards" : "10"
629+
"number_of_shards" : "2"
630+
}
631+
},
632+
"mappings" : {
633+
"properties" : {
634+
"routingValue" : {
635+
"type" : "text",
636+
"fields" : {
637+
"keyword" : {
638+
"ignore_above" : 256,
639+
"type" : "keyword"
640+
}
641+
}
642+
},
643+
"clusterPhyId" : {
644+
"type" : "long"
645+
},
646+
"metrics" : {
647+
"properties" : {
648+
"AvgRequestLatency" : {
649+
"type" : "double"
650+
},
651+
"MinRequestLatency" : {
652+
"type" : "double"
653+
},
654+
"MaxRequestLatency" : {
655+
"type" : "double"
656+
},
657+
"OutstandingRequests" : {
658+
"type" : "double"
659+
},
660+
"NodeCount" : {
661+
"type" : "double"
662+
},
663+
"WatchCount" : {
664+
"type" : "double"
665+
},
666+
"NumAliveConnections" : {
667+
"type" : "double"
668+
},
669+
"PacketsReceived" : {
670+
"type" : "double"
671+
},
672+
"PacketsSent" : {
673+
"type" : "double"
674+
},
675+
"EphemeralsCount" : {
676+
"type" : "double"
677+
},
678+
"ApproximateDataSize" : {
679+
"type" : "double"
680+
},
681+
"OpenFileDescriptorCount" : {
682+
"type" : "double"
683+
},
684+
"MaxFileDescriptorCount" : {
685+
"type" : "double"
686+
}
687+
}
688+
},
689+
"key" : {
690+
"type" : "text",
691+
"fields" : {
692+
"keyword" : {
693+
"ignore_above" : 256,
694+
"type" : "keyword"
695+
}
696+
}
697+
},
698+
"timestamp" : {
699+
"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",
700+
"type" : "date"
701+
}
702+
}
703+
},
704+
"aliases" : { }
705+
}'
706+
707+
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 '{
708+
"order" : 10,
709+
"index_patterns" : [
710+
"ks_kafka_zookeeper_metric*"
711+
],
712+
"settings" : {
713+
"index" : {
714+
"number_of_shards" : "2"
630715
}
631716
},
632717
"mappings" : {

0 commit comments

Comments
 (0)