Search in sources :

Example 1 with ElasticSearchStorageInstaller

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);
}
Also used : ElasticSearchStorageInstaller(org.apache.skywalking.apm.collector.storage.es.base.define.ElasticSearchStorageInstaller) ModuleRegisterService(org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService) ModuleListenerService(org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService) ClientException(org.apache.skywalking.apm.collector.client.ClientException) StorageException(org.apache.skywalking.apm.collector.storage.StorageException) ICollectorConfig(org.apache.skywalking.apm.collector.configuration.service.ICollectorConfig)

Aggregations

ClientException (org.apache.skywalking.apm.collector.client.ClientException)1 ModuleListenerService (org.apache.skywalking.apm.collector.cluster.service.ModuleListenerService)1 ModuleRegisterService (org.apache.skywalking.apm.collector.cluster.service.ModuleRegisterService)1 ICollectorConfig (org.apache.skywalking.apm.collector.configuration.service.ICollectorConfig)1 StorageException (org.apache.skywalking.apm.collector.storage.StorageException)1 ElasticSearchStorageInstaller (org.apache.skywalking.apm.collector.storage.es.base.define.ElasticSearchStorageInstaller)1