change the config of index creat to index initialize model

This commit is contained in:
pengys5 2017-04-12 23:21:52 +08:00
parent 962f41758c
commit 1d1d8d9738
3 changed files with 43 additions and 8 deletions

View File

@ -5,10 +5,6 @@ package com.a.eye.skywalking.collector.worker.config;
*/
public class EsConfig {
public static final String Create_Overwrite = "overwrite";
public static final String Create_Ignore = "ignore";
public static final String Create_Off = "off";
public static class Es {
public static class Cluster {
public static String name = "";
@ -20,7 +16,10 @@ public class EsConfig {
}
public static class Index {
public static String create = "";
public static class Initialize {
public static String model = "";
}
public static class Shards {
public static String number = "";
@ -31,4 +30,8 @@ public class EsConfig {
}
}
}
public enum IndexInitModel {
auto, forced, manual
}
}

View File

@ -17,12 +17,12 @@ public enum IndexCreator {
private Logger logger = LogManager.getFormatterLogger(IndexCreator.class);
public void create() {
if (!EsConfig.Create_Off.equals(EsConfig.Es.Index.create)) {
if (!EsConfig.IndexInitModel.manual.name().equals(EsConfig.Es.Index.Initialize.model)) {
Set<AbstractIndex> indexSet = loadIndex();
for (AbstractIndex index : indexSet) {
boolean isExists = index.isExists();
if (isExists) {
if (EsConfig.Create_Overwrite.equals(EsConfig.Es.Index.create)) {
if (EsConfig.IndexInitModel.forced.name().equals(EsConfig.Es.Index.Initialize.model)) {
index.deleteIndex();
index.createIndex();
}

View File

@ -1,20 +1,52 @@
# The remote server should connect to, hostname can be either hostname or IP address.
# Suggestion: set the real ip address.
cluster.current.hostname=127.0.0.1
cluster.current.port=11800
# The roles of this member. List of strings, e.g. roles = A, B
# In the future, the roles are part of the membership information and can be used by
# routers or other services to distribute work to certain member types,
# e.g. front-end and back-end nodes.
# In this version, all members has same roles, each of them will listen others status,
# because of network trouble or member jvm crash or every reason led to not reachable,
# the routers will stop to sending the message to the untouchable member.
cluster.current.roles=WorkersListener
# Initial contact points of the cluster, e.g. seed_nodes = 127.0.0.1:11800, 127.0.0.1:11801.
# The nodes to join automatically at startup.
# When setting akka configuration, it will be change.
# like: ["akka.tcp://system@127.0.0.1:11800", "akka.tcp://system@127.0.0.1:11801"].
# This is akka configuration, see: http://doc.akka.io/docs/akka/2.4/general/configuration.html
cluster.seed_nodes=127.0.0.1:11800
# elasticsearch configuration, config/elasticsearch.yml, see cluster.name
es.cluster.name=CollectorDBCluster
es.cluster.nodes=127.0.0.1:9300
es.cluster.transport.sniffer=true
# The elasticsearch nodes of cluster, comma separated, e.g. nodes=ip:port, ip:port
es.cluster.nodes=127.0.0.1:9300
# Automatic create elasticsearch index
# Options: auto, forced, manual
# auto: just create new index when index not created.
# forced: delete the index then create
es.index.initialize.model=auto
es.index.shards.number=2
es.index.replicas.number=0
# You can configure a host either as a host name or IP address to identify a specific network
# interface on which to listen.
# Be used for web ui get the view data or agent post the trace segment.
http.hostname=127.0.0.1
# The TCP/IP port on which the connector listens for connections.
http.port=12800
# The contextPath is a URL prefix that identifies which context a HTTP request is destined for.
http.contextPath=/
# The analysis worker max cache size, when worker data size reach the size,
# then worker will send all cached data to the next worker and clear the cache.
cache.analysis.size=1024
# The persistence worker max cache size, same of "cache.analysis.size" ability.
cache.persistence.size=1024
WorkerNum.Node.NodeCompAgg.Value=10