use of org.apache.skywalking.apm.collector.storage.es.base.define.ElasticSearchStorageInstaller in project incubator-skywalking by apache.
the class StorageModuleEsProvider method start.
@Override
public void start(Properties config) throws ServiceNotProvidedException {
Integer indexShardsNumber = (Integer) config.get(INDEX_SHARDS_NUMBER);
Integer indexReplicasNumber = (Integer) config.get(INDEX_REPLICAS_NUMBER);
try {
String namespace = getManager().find(ConfigurationModule.NAME).getService(ICollectorConfig.class).getNamespace();
elasticSearchClient.setNamespace(namespace);
elasticSearchClient.initialize();
ElasticSearchStorageInstaller installer = new ElasticSearchStorageInstaller(indexShardsNumber, indexReplicasNumber);
installer.install(elasticSearchClient);
} catch (ClientException | StorageException e) {
logger.error(e.getMessage(), e);
}
String uuId = UUID.randomUUID().toString();
ModuleRegisterService moduleRegisterService = getManager().find(ClusterModule.NAME).getService(ModuleRegisterService.class);
moduleRegisterService.register(StorageModule.NAME, this.name(), new StorageModuleEsRegistration(uuId, 0));
StorageModuleEsNamingListener namingListener = new StorageModuleEsNamingListener();
ModuleListenerService moduleListenerService = getManager().find(ClusterModule.NAME).getService(ModuleListenerService.class);
moduleListenerService.addListener(namingListener);
Integer beforeDay = (Integer) config.getOrDefault(TIME_TO_LIVE_OF_DATA, 3);
deleteTimer = new DataTTLKeeperTimer(getManager(), namingListener, uuId + 0, beforeDay);
}
Aggregations