From 80b94ac227a43952f4733651b9abd1d8ad4f7c8c Mon Sep 17 00:00:00 2001 From: Young Hu Date: Sat, 29 Dec 2018 17:53:48 +0800 Subject: [PATCH 1/3] 6.x beta version --- .gitignore | 1 + apm-dist/bin/oapServiceInit.bat | 37 +++++++ apm-dist/bin/oapServiceInit.sh | 50 +++++++++ apm-dist/pom.xml | 4 +- apm-dist/src/main/assembly/alarm-settings.yml | 29 ++++- apm-dist/src/main/assembly/application.yml | 103 ++++++++++-------- .../src/main/assembly/component-libraries.yml | 11 ++ apm-dist/src/main/assembly/log4j2.xml | 4 +- apm-webapp/pom.xml | 6 +- pom.xml | 8 +- storage-elasticsearch5x-plugin/pom.xml | 41 ++++++- .../StorageModuleElasticsearchConfig.java | 2 + .../StorageModuleElasticsearchProvider.java | 7 +- .../base/HistoryDeleteEsDAO.java | 3 +- .../cache/ServiceInventoryCacheEsDAO.java | 2 +- .../client/ElasticSearchClient5x.java | 18 +-- .../query/AlarmQueryEsDAO.java | 5 +- .../query/MetadataQueryEsDAO.java | 15 +-- .../query/MetricQueryEsDAO.java | 1 + .../query/TraceQueryEsDAO.java | 8 +- 20 files changed, 265 insertions(+), 90 deletions(-) create mode 100644 apm-dist/bin/oapServiceInit.bat create mode 100644 apm-dist/bin/oapServiceInit.sh diff --git a/.gitignore b/.gitignore index 1194036..b14b34d 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ target # git *.orig *.log +dist diff --git a/apm-dist/bin/oapServiceInit.bat b/apm-dist/bin/oapServiceInit.bat new file mode 100644 index 0000000..69e453e --- /dev/null +++ b/apm-dist/bin/oapServiceInit.bat @@ -0,0 +1,37 @@ +@REM +@REM Licensed to the Apache Software Foundation (ASF) under one or more +@REM contributor license agreements. See the NOTICE file distributed with +@REM this work for additional information regarding copyright ownership. +@REM The ASF licenses this file to You under the Apache License, Version 2.0 +@REM (the "License"); you may not use this file except in compliance with +@REM the License. You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. + +@echo off + +setlocal +set OAP_PROCESS_TITLE=Skywalking-Collector +set OAP_HOME=%~dp0%.. +set OAP_OPTS="-Xms256M -Xmx512M -Doap.logDir=%OAP_HOME%\logs" + +set CLASSPATH=%OAP_HOME%\config;.; +set CLASSPATH=%OAP_HOME%\oap-libs\*;%CLASSPATH% + +if defined JAVA_HOME ( + set _EXECJAVA="%JAVA_HOME%\bin\java" +) + +if not defined JAVA_HOME ( + echo "JAVA_HOME not set." + set _EXECJAVA=java +) + +start "%OAP_PROCESS_TITLE%" %_EXECJAVA% "%OAP_OPTS%" -cp "%CLASSPATH%" -Dmode=init org.apache.skywalking.oap.server.starter.OAPServerStartUp +endlocal diff --git a/apm-dist/bin/oapServiceInit.sh b/apm-dist/bin/oapServiceInit.sh new file mode 100644 index 0000000..816c287 --- /dev/null +++ b/apm-dist/bin/oapServiceInit.sh @@ -0,0 +1,50 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +#!/usr/bin/env sh + +PRG="$0" +PRGDIR=`dirname "$PRG"` +[ -z "$OAP_HOME" ] && OAP_HOME=`cd "$PRGDIR/.." >/dev/null; pwd` + +OAP_LOG_DIR="${OAP_HOME}/logs" +JAVA_OPTS=" -Xms256M -Xmx512M" + +if [ ! -d "${OAP_HOME}/logs" ]; then + mkdir -p "${OAP_LOG_DIR}" +fi + +_RUNJAVA=${JAVA_HOME}/bin/java +[ -z "$JAVA_HOME" ] && _RUNJAVA=java + +CLASSPATH="$OAP_HOME/config:$CLASSPATH" +for i in "$OAP_HOME"/oap-libs/*.jar +do + CLASSPATH="$i:$CLASSPATH" +done + +OAP_OPTIONS=" -Doap.logDir=${OAP_LOG_DIR}" + +eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} ${OAP_OPTIONS} -classpath $CLASSPATH -Dmode=init org.apache.skywalking.oap.server.starter.OAPServerStartUp \ + 2>${OAP_LOG_DIR}/oap.log 1> /dev/null &" + +if [ $? -eq 0 ]; then + sleep 1 + echo "SkyWalking OAP started successfully!" +else + echo "SkyWalking OAP started failure!" + exit 1 +fi diff --git a/apm-dist/pom.xml b/apm-dist/pom.xml index 93aeffa..2902d39 100644 --- a/apm-dist/pom.xml +++ b/apm-dist/pom.xml @@ -5,7 +5,7 @@ apm org.apache.skywalking - 6.0.0-alpha + 6.0.0-beta 4.0.0 @@ -55,4 +55,4 @@ - \ No newline at end of file + diff --git a/apm-dist/src/main/assembly/alarm-settings.yml b/apm-dist/src/main/assembly/alarm-settings.yml index 5b839fb..eab4407 100644 --- a/apm-dist/src/main/assembly/alarm-settings.yml +++ b/apm-dist/src/main/assembly/alarm-settings.yml @@ -24,28 +24,47 @@ rules: period: 10 count: 3 silence-period: 5 - message: Response time of service {name} is more than 2000ms. + message: Response time of service {name} is more than 1000ms in last 3 minutes. service_sla_rule: # Indicator value need to be long, double or int indicator-name: service_sla op: "<" - threshold: 80 + threshold: 8000 # The length of time to evaluate the metric period: 10 # How many times after the metric match the condition, will trigger alarm count: 2 # How many times of checks, the alarm keeps silence after alarm triggered, default as same as period. silence-period: 3 - message: Successful rate of service {name} is lower than 80% + message: Successful rate of service {name} is lower than 80% in last 2 minutes. service_p90_sla_rule: # Indicator value need to be long, double or int - indicator-name: service_sla + indicator-name: service_p90 op: ">" threshold: 1000 period: 10 count: 3 silence-period: 5 - message: 90% response time of service {name} is lower than 80% + message: 90% response time of service {name} is lower than 1000ms in last 3 minutes + service_instance_resp_time_rule: + indicator-name: service_instance_resp_time + op: ">" + threshold: 1000 + period: 10 + count: 2 + silence-period: 5 + message: Response time of service instance {name} is more than 1000ms in last 2 minutes. +# Active endpoint related metric alarm will cost more memory than service and service instance metric alarm. +# Because the number of endpoint is much more than service and instance. +# +# endpoint_avg_rule: +# indicator-name: endpoint_avg +# op: ">" +# threshold: 1000 +# period: 10 +# count: 2 +# silence-period: 5 +# message: Response time of endpoint {name} is more than 1000ms in last 2 minutes. webhooks: # - http://127.0.0.1/notify/ diff --git a/apm-dist/src/main/assembly/application.yml b/apm-dist/src/main/assembly/application.yml index 3ce7992..f08f0d6 100644 --- a/apm-dist/src/main/assembly/application.yml +++ b/apm-dist/src/main/assembly/application.yml @@ -16,68 +16,85 @@ cluster: standalone: + # Please check your ZooKeeper is 3.5+, However, it is also compatible with ZooKeeper 3.4.x. Replace the ZooKeeper 3.5+ + # library the oap-libs folder with your ZooKeeper 3.4.x library. # zookeeper: -# hostPort: localhost:2181 -# # Retry Policy -# baseSleepTimeMs: 1000 # initial amount of time to wait between retries -# maxRetries: 3 # max number of times to retry +# nameSpace: ${SW_NAMESPACE:""} +# hostPort: ${SW_CLUSTER_ZK_HOST_PORT:localhost:2181} +# #Retry Policy +# baseSleepTimeMs: ${SW_CLUSTER_ZK_SLEEP_TIME:1000} # initial amount of time to wait between retries +# maxRetries: ${SW_CLUSTER_ZK_MAX_RETRIES:3} # max number of times to retry # kubernetes: -# watchTimeoutSeconds: 60 -# namespace: default -# labelSelector: app=collector,release=skywalking -# uidEnvName: SKYWALKING_COLLECTOR_UID +# watchTimeoutSeconds: ${SW_CLUSTER_K8S_WATCH_TIMEOUT:60} +# namespace: ${SW_CLUSTER_K8S_NAMESPACE:default} +# labelSelector: ${SW_CLUSTER_K8S_LABEL:app=collector,release=skywalking} +# uidEnvName: ${SW_CLUSTER_K8S_UID:SKYWALKING_COLLECTOR_UID} +# consul: +# serviceName: ${SW_SERVICE_NAME:"SkyWalking_OAP_Cluster"} +# Consul cluster nodes, example: 10.0.0.1:8500,10.0.0.2:8500,10.0.0.3:8500 +# hostPort: ${SW_CLUSTER_CONSUL_HOST_PORT:localhost:8500} core: default: - restHost: 0.0.0.0 - restPort: 12800 - restContextPath: / - gRPCHost: 0.0.0.0 - gRPCPort: 11800 + restHost: ${SW_CORE_REST_HOST:0.0.0.0} + restPort: ${SW_CORE_REST_PORT:12800} + restContextPath: ${SW_CORE_REST_CONTEXT_PATH:/} + gRPCHost: ${SW_CORE_GRPC_HOST:0.0.0.0} + gRPCPort: ${SW_CORE_GRPC_PORT:11800} downsampling: - Hour - Day - Month # Set a timeout on metric data. After the timeout has expired, the metric data will automatically be deleted. - recordDataTTL: 90 # Unit is minute - minuteMetricsDataTTL: 90 # Unit is minute - hourMetricsDataTTL: 36 # Unit is hour - dayMetricsDataTTL: 45 # Unit is day - monthMetricsDataTTL: 18 # Unit is month + recordDataTTL: ${SW_CORE_RECORD_DATA_TTL:90} # Unit is minute + minuteMetricsDataTTL: ${SW_CORE_MINUTE_METRIC_DATA_TTL:90} # Unit is minute + hourMetricsDataTTL: ${SW_CORE_HOUR_METRIC_DATA_TTL:36} # Unit is hour + dayMetricsDataTTL: ${SW_CORE_DAY_METRIC_DATA_TTL:45} # Unit is day + monthMetricsDataTTL: ${SW_CORE_MONTH_METRIC_DATA_TTL:18} # Unit is month storage: - # h2: - # driver: org.h2.jdbcx.JdbcDataSource - # url: jdbc:h2:mem:skywalking-oap-db - # user: sa +# h2: +# driver: ${SW_STORAGE_H2_DRIVER:org.h2.jdbcx.JdbcDataSource} +# url: ${SW_STORAGE_H2_URL:jdbc:h2:mem:skywalking-oap-db} +# user: ${SW_STORAGE_H2_USER:sa} elasticsearch-5x: - clusterName: OAPStorageCluster - clusterNodes: localhost:9300 - indexShardsNumber: 2 - indexReplicasNumber: 0 + clusterName: ${SW_STORAGE_ES_CLUSTER_NAME:elasticsearch} + #nameSpace: ${SW_NAMESPACE:""} + clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:localhost:9300} + username: ${SW_STORAGE_ES_USER_NAME:""} + password: ${SW_STORAGE_ES_PASSWORD:""} + indexShardsNumber: ${SW_STORAGE_ES_INDEX_SHARDS_NUMBER:2} + indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:0} # Batch process setting, refer to https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.5/java-docs-bulk-processor.html - bulkActions: 2000 # Execute the bulk every 2000 requests - bulkSize: 20 # flush the bulk every 20mb - flushInterval: 10 # flush the bulk every 10 seconds whatever the number of requests - concurrentRequests: 2 # the number of concurrent requests + bulkActions: ${SW_STORAGE_ES_BULK_ACTIONS:2000} # Execute the bulk every 2000 requests + bulkSize: ${SW_STORAGE_ES_BULK_SIZE:20} # flush the bulk every 20mb + flushInterval: ${SW_STORAGE_ES_FLUSH_INTERVAL:10} # flush the bulk every 10 seconds whatever the number of requests + concurrentRequests: ${SW_STORAGE_ES_CONCURRENT_REQUESTS:2} # the number of concurrent requests +# mysql: receiver-register: default: receiver-trace: default: - bufferPath: ../trace-buffer/ # Path to trace buffer files, suggest to use absolute path - bufferOffsetMaxFileSize: 100 # Unit is MB - bufferDataMaxFileSize: 500 # Unit is MB - bufferFileCleanWhenRestart: false + bufferPath: ${SW_RECEIVER_BUFFER_PATH:../trace-buffer/} # Path to trace buffer files, suggest to use absolute path + bufferOffsetMaxFileSize: ${SW_RECEIVER_BUFFER_OFFSET_MAX_FILE_SIZE:100} # Unit is MB + bufferDataMaxFileSize: ${SW_RECEIVER_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB + bufferFileCleanWhenRestart: ${SW_RECEIVER_BUFFER_FILE_CLEAN_WHEN_RESTART:false} + sampleRate: ${SW_TRACE_SAMPLE_RATE:10000} # The sample rate precision is 1/10000. 10000 means 100% sample in default. receiver-jvm: default: -service-mesh: - default: - bufferPath: ../mesh-buffer/ # Path to mesh telemetry data buffer files, suggest to use absolute path - bufferOffsetMaxFileSize: 100 # Unit is MB - bufferDataMaxFileSize: 500 # Unit is MB - bufferFileCleanWhenRestart: false -istio-telemetry: - default: +#service-mesh: +# default: +# bufferPath: ${SW_SERVICE_MESH_BUFFER_PATH:../mesh-buffer/} # Path to trace buffer files, suggest to use absolute path +# bufferOffsetMaxFileSize: ${SW_SERVICE_MESH_OFFSET_MAX_FILE_SIZE:100} # Unit is MB +# bufferDataMaxFileSize: ${SW_SERVICE_MESH_BUFFER_DATA_MAX_FILE_SIZE:500} # Unit is MB +# bufferFileCleanWhenRestart: ${SW_SERVICE_MESH_BUFFER_FILE_CLEAN_WHEN_RESTART:false} +#istio-telemetry: +# default: +#receiver_zipkin: +# default: +# host: ${SW_RECEIVER_ZIPKIN_HOST:0.0.0.0} +# port: ${SW_RECEIVER_ZIPKIN_PORT:9411} +# contextPath: ${SW_RECEIVER_ZIPKIN_CONTEXT_PATH:/} query: graphql: - path: /graphql + path: ${SW_QUERY_GRAPHQL_PATH:/graphql} alarm: default: diff --git a/apm-dist/src/main/assembly/component-libraries.yml b/apm-dist/src/main/assembly/component-libraries.yml index 0878d4d..caa6bfb 100644 --- a/apm-dist/src/main/assembly/component-libraries.yml +++ b/apm-dist/src/main/assembly/component-libraries.yml @@ -177,6 +177,15 @@ http: rpc: id: 50 languages: Java,C#,Node.js +RabbitMQ: + id: 51 + languages: Java +rabbitmq-producer: + id: 52 + languages: Java +rabbitmq-consumer: + id: 53 + languages: Java # .NET/.NET Core components # [3000, 4000) for C#/.NET only @@ -252,6 +261,8 @@ Component-Server-Mappings: kafka-consumer: Kafka activemq-producer: ActiveMQ activemq-consumer: ActiveMQ + rabbitmq-producer: RabbitMQ + rabbitmq-consumer: RabbitMQ postgresql-jdbc-driver: PostgreSQL Xmemcached: Memcached Spymemcached: Memcached diff --git a/apm-dist/src/main/assembly/log4j2.xml b/apm-dist/src/main/assembly/log4j2.xml index 939fc04..42119cf 100644 --- a/apm-dist/src/main/assembly/log4j2.xml +++ b/apm-dist/src/main/assembly/log4j2.xml @@ -23,9 +23,9 @@ + filePattern="${log-path}/skywalking-oap-server-%d{yyyy-MM-dd}-%i.log" > - %d - %c -%-4r [%t] %-5p %x - %m%n + %d - %c - %L [%t] %-5p %x - %m%n diff --git a/apm-webapp/pom.xml b/apm-webapp/pom.xml index 23b0503..33d5a25 100644 --- a/apm-webapp/pom.xml +++ b/apm-webapp/pom.xml @@ -5,7 +5,7 @@ apm org.apache.skywalking - 6.0.0-alpha + 6.0.0-beta 4.0.0 @@ -18,7 +18,7 @@ 1.6 ${project.parent.basedir}/skywalking-ui - 6.0.0-alpha + 6.0.0-beta @@ -61,4 +61,4 @@ - \ No newline at end of file + diff --git a/pom.xml b/pom.xml index 8ca1d69..f39eba9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.apache.skywalking apm - 6.0.0-alpha + 6.0.0-beta apm-webapp storage-elasticsearch5x-plugin @@ -49,9 +49,9 @@ UTF-8 1.8 - 6.0.0-beta-SNAPSHOT + 6.0.0-beta 1.18.0 - 5.5.2 + 5.4.0 3.8.0 @@ -133,4 +133,4 @@ - \ No newline at end of file + diff --git a/storage-elasticsearch5x-plugin/pom.xml b/storage-elasticsearch5x-plugin/pom.xml index 0c1e985..4eb2d6e 100644 --- a/storage-elasticsearch5x-plugin/pom.xml +++ b/storage-elasticsearch5x-plugin/pom.xml @@ -5,7 +5,7 @@ apm org.apache.skywalking - 6.0.0-alpha + 6.0.0-beta 4.0.0 @@ -25,6 +25,22 @@ org.elasticsearch.client elasticsearch-rest-high-level-client + + jackson-annotations + com.fasterxml.jackson.core + + + jackson-core + com.fasterxml.jackson.core + + + jackson-databind + com.fasterxml.jackson.core + + + jackson-datatype-jdk8 + com.fasterxml.jackson.datatype + @@ -33,6 +49,27 @@ ${lombok.version} provided + + + jackson-annotations + com.fasterxml.jackson.core + ${jackson.verison} + + + jackson-core + com.fasterxml.jackson.core + ${jackson.verison} + + + jackson-databind + com.fasterxml.jackson.core + ${jackson.verison} + + + jackson-datatype-jdk8 + com.fasterxml.jackson.datatype + ${jackson.verison} + @@ -58,4 +95,4 @@ - \ No newline at end of file + diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchConfig.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchConfig.java index 20858af..06253c5 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchConfig.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchConfig.java @@ -29,6 +29,8 @@ public class StorageModuleElasticsearchConfig extends ModuleConfig { @Setter @Getter private String clusterName; @Setter @Getter private String nameSpace; @Setter @Getter private String clusterNodes; + @Setter @Getter private String username; + @Setter @Getter private String password; private int indexShardsNumber; private int indexReplicasNumber; private boolean highPerformanceMode; diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchProvider.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchProvider.java index 2e222e5..32563c6 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchProvider.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchProvider.java @@ -21,7 +21,6 @@ import org.apache.skywalking.oap.server.core.storage.*; import org.apache.skywalking.oap.server.core.storage.cache.*; import org.apache.skywalking.oap.server.core.storage.query.*; -import org.apache.skywalking.oap.server.library.client.NameSpace; import org.apache.skywalking.oap.server.library.module.*; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch5x.base.*; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch5x.cache.*; @@ -38,13 +37,11 @@ public class StorageModuleElasticsearchProvider extends ModuleProvider { private static final Logger logger = LoggerFactory.getLogger(StorageModuleElasticsearchProvider.class); private final StorageModuleElasticsearchConfig config; - private final NameSpace nameSpace; private ElasticSearchClient5x elasticSearchClient; public StorageModuleElasticsearchProvider() { super(); this.config = new StorageModuleElasticsearchConfig(); - this.nameSpace = new NameSpace(); } @Override @@ -64,7 +61,8 @@ public ModuleConfig createConfigBeanIfAbsent() { @Override public void prepare() throws ServiceNotProvidedException { - elasticSearchClient = new ElasticSearchClient5x(config.getClusterName(), config.getClusterNodes(), nameSpace); + elasticSearchClient = new ElasticSearchClient5x(config.getClusterName(), config.getClusterNodes(), config.getNameSpace(), + config.getUsername(), config.getPassword()); this.registerServiceImplementation(IBatchDAO.class, new BatchProcessEsDAO(elasticSearchClient, config.getBulkActions(), config.getBulkSize(), config.getFlushInterval(), config.getConcurrentRequests())); this.registerServiceImplementation(StorageDAO.class, new StorageEsDAO(elasticSearchClient)); @@ -87,7 +85,6 @@ public void prepare() throws ServiceNotProvidedException { @Override public void start() throws ModuleStartException { try { - nameSpace.setNameSpace(config.getNameSpace()); elasticSearchClient.connect(); StorageEsInstaller installer = new StorageEsInstaller(getManager(), config.getIndexShardsNumber(), config.getIndexReplicasNumber()); diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/base/HistoryDeleteEsDAO.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/base/HistoryDeleteEsDAO.java index 8f15aa5..f364e35 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/base/HistoryDeleteEsDAO.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/base/HistoryDeleteEsDAO.java @@ -19,7 +19,6 @@ package org.apache.skywalking.oap.server.storage.plugin.elasticsearch5x.base; import java.io.IOException; -import org.apache.skywalking.oap.server.core.analysis.indicator.Indicator; import org.apache.skywalking.oap.server.core.storage.IHistoryDeleteDAO; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch5x.client.ElasticSearchClient5x; import org.slf4j.*; @@ -37,7 +36,7 @@ public HistoryDeleteEsDAO(ElasticSearchClient5x client) { @Override public void deleteHistory(String modelName, String timeBucketColumnName, Long timeBucketBefore) throws IOException { - int statusCode = getClient().delete(modelName, Indicator.TIME_BUCKET, timeBucketBefore); + int statusCode = getClient().delete(modelName, timeBucketColumnName, timeBucketBefore); if (logger.isDebugEnabled()) { logger.debug("Delete history from {} index, status code {}", modelName, statusCode); } diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/cache/ServiceInventoryCacheEsDAO.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/cache/ServiceInventoryCacheEsDAO.java index 1268348..e016e25 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/cache/ServiceInventoryCacheEsDAO.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/cache/ServiceInventoryCacheEsDAO.java @@ -96,7 +96,7 @@ private int get(String id) { BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); boolQuery.must().add(QueryBuilders.termQuery(ServiceInventory.IS_ADDRESS, BooleanUtils.TRUE)); - boolQuery.must().add(QueryBuilders.rangeQuery(ServiceInventory.MAPPING_LAST_UPDATE_TIME).gte(System.currentTimeMillis() - 10000)); + boolQuery.must().add(QueryBuilders.rangeQuery(ServiceInventory.MAPPING_LAST_UPDATE_TIME).gte(System.currentTimeMillis() - 30 * 60 * 1000)); searchSourceBuilder.query(boolQuery); searchSourceBuilder.size(50); diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java index d8b2a5b..7910e19 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java @@ -23,17 +23,18 @@ import java.util.*; import org.apache.http.HttpHost; import org.apache.skywalking.oap.server.library.client.*; -import org.apache.skywalking.oap.server.library.util.StringUtils; import org.elasticsearch.action.admin.indices.create.*; import org.elasticsearch.action.admin.indices.delete.*; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; import org.elasticsearch.action.bulk.*; +import org.elasticsearch.action.bulk.byscroll.BulkByScrollResponse; import org.elasticsearch.action.get.*; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.search.*; import org.elasticsearch.action.support.WriteRequest; import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.client.transport.TransportClient; +import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.unit.*; @@ -54,13 +55,18 @@ public class ElasticSearchClient5x implements Client { private static final String TYPE = "type"; private final String clusterName; private final String clusterNodes; - private final NameSpace namespace; + private final String namespace; + private final String username; + private final String password; private TransportClient client; - public ElasticSearchClient5x(String clusterName, String clusterNodes, NameSpace namespace) { + public ElasticSearchClient5x(String clusterName, String clusterNodes, String namespace, String username, + String password) { this.clusterName = clusterName; this.clusterNodes = clusterNodes; this.namespace = namespace; + this.username = username; + this.password = password; } @Override public void connect() { @@ -152,12 +158,10 @@ public void forceInsert(String indexName, String id, XContentBuilder source) thr } public void forceUpdate(String indexName, String id, XContentBuilder source, long version) throws IOException { - indexName = formatIndexName(indexName); client.prepareUpdate(indexName, TYPE, id).setDoc(source).setVersion(version).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get(); } public void forceUpdate(String indexName, String id, XContentBuilder source) throws IOException { - indexName = formatIndexName(indexName); client.prepareUpdate(indexName, TYPE, id).setDoc(source).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE).get(); } @@ -185,8 +189,8 @@ public int delete(String indexName, String timeBucketColumnName, long endTimeBuc } private String formatIndexName(String indexName) { - if (Objects.nonNull(namespace) && StringUtils.isNotEmpty(namespace.getNameSpace())) { - return namespace.getNameSpace() + "_" + indexName; + if (!Strings.isNullOrEmpty(namespace)) { + return namespace + "_" + indexName; } return indexName; } diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/AlarmQueryEsDAO.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/AlarmQueryEsDAO.java index 830eeaf..3dc7e74 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/AlarmQueryEsDAO.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/AlarmQueryEsDAO.java @@ -18,13 +18,13 @@ package org.apache.skywalking.oap.server.storage.plugin.elasticsearch5x.query; +import com.google.common.base.Strings; import java.io.IOException; import java.util.Objects; import org.apache.skywalking.oap.server.core.alarm.AlarmRecord; import org.apache.skywalking.oap.server.core.query.entity.*; import org.apache.skywalking.oap.server.core.source.Scope; import org.apache.skywalking.oap.server.core.storage.query.IAlarmQueryDAO; -import org.apache.skywalking.oap.server.library.util.StringUtils; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch5x.base.*; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch5x.client.ElasticSearchClient5x; import org.elasticsearch.action.search.SearchResponse; @@ -41,6 +41,7 @@ public AlarmQueryEsDAO(ElasticSearchClient5x client) { super(client); } + @Override public Alarms getAlarm(final Scope scope, final String keyword, final int limit, final int from, final long startTB, final long endTB) throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); @@ -52,7 +53,7 @@ public Alarms getAlarm(final Scope scope, final String keyword, final int limit, boolQueryBuilder.must().add(QueryBuilders.termQuery(AlarmRecord.SCOPE, scope.ordinal())); } - if (StringUtils.isNotEmpty(keyword)) { + if (!Strings.isNullOrEmpty(keyword)) { String matchCName = MatchCNameBuilder.INSTANCE.build(AlarmRecord.ALARM_MESSAGE); boolQueryBuilder.must().add(QueryBuilders.matchQuery(matchCName, keyword)); } diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/MetadataQueryEsDAO.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/MetadataQueryEsDAO.java index 77a2a58..2216851 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/MetadataQueryEsDAO.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/MetadataQueryEsDAO.java @@ -18,6 +18,7 @@ package org.apache.skywalking.oap.server.storage.plugin.elasticsearch5x.query; +import com.google.common.base.Strings; import java.io.IOException; import java.util.*; import org.apache.skywalking.oap.server.core.query.entity.*; @@ -74,11 +75,7 @@ public MetadataQueryEsDAO(ElasticSearchClient5x client) { @Override public int numOfConjectural(long startTimestamp, long endTimestamp, int srcLayer) throws IOException { SearchSourceBuilder sourceBuilder = SearchSourceBuilder.searchSource(); - BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); - boolQueryBuilder.must().add(timeRangeQueryBuild(startTimestamp, endTimestamp)); - boolQueryBuilder.must().add(QueryBuilders.termQuery(NetworkAddressInventory.SRC_LAYER, srcLayer)); - - sourceBuilder.query(boolQueryBuilder); + sourceBuilder.query(QueryBuilders.termQuery(NetworkAddressInventory.SRC_LAYER, srcLayer)); sourceBuilder.size(0); SearchResponse response = getClient().search(NetworkAddressInventory.MODEL_NAME, sourceBuilder); @@ -111,7 +108,7 @@ public List getAllServices(long startTimestamp, long endTimestamp) thro boolQueryBuilder.must().add(timeRangeQueryBuild(startTimestamp, endTimestamp)); boolQueryBuilder.must().add(QueryBuilders.termQuery(ServiceInventory.IS_ADDRESS, BooleanUtils.FALSE)); - if (StringUtils.isNotEmpty(keyword)) { + if (!Strings.isNullOrEmpty(keyword)) { String matchCName = MatchCNameBuilder.INSTANCE.build(ServiceInventory.NAME); boolQueryBuilder.must().add(QueryBuilders.matchQuery(matchCName, keyword)); } @@ -143,7 +140,7 @@ public Service searchService(String serviceCode) throws IOException { BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery(); boolQueryBuilder.must().add(QueryBuilders.termQuery(EndpointInventory.SERVICE_ID, serviceId)); - if (StringUtils.isNotEmpty(keyword)) { + if (!Strings.isNullOrEmpty(keyword)) { String matchCName = MatchCNameBuilder.INSTANCE.build(EndpointInventory.NAME); boolQueryBuilder.must().add(QueryBuilders.matchQuery(matchCName, keyword)); } @@ -193,11 +190,11 @@ public Service searchService(String serviceCode) throws IOException { serviceInstance.setLanguage(LanguageTrans.INSTANCE.value(languageId)); String osName = (String)sourceAsMap.get(ServiceInstanceInventory.OS_NAME); - if (StringUtils.isNotEmpty(osName)) { + if (!Strings.isNullOrEmpty(osName)) { serviceInstance.getAttributes().add(new Attribute(ServiceInstanceInventory.OS_NAME, osName)); } String hostName = (String)sourceAsMap.get(ServiceInstanceInventory.HOST_NAME); - if (StringUtils.isNotEmpty(hostName)) { + if (!Strings.isNullOrEmpty(hostName)) { serviceInstance.getAttributes().add(new Attribute(ServiceInstanceInventory.HOST_NAME, hostName)); } serviceInstance.getAttributes().add(new Attribute(ServiceInstanceInventory.PROCESS_NO, String.valueOf(((Number)sourceAsMap.get(ServiceInstanceInventory.PROCESS_NO)).intValue()))); diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/MetricQueryEsDAO.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/MetricQueryEsDAO.java index 712951b..02b10f9 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/MetricQueryEsDAO.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/MetricQueryEsDAO.java @@ -44,6 +44,7 @@ public MetricQueryEsDAO(ElasticSearchClient5x client) { super(client); } + @Override public IntValues getValues(String indName, Step step, long startTB, long endTB, Where where, String valueCName, Function function) throws IOException { String indexName = DownSamplingModelNameBuilder.build(step, indName); diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/TraceQueryEsDAO.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/TraceQueryEsDAO.java index 81972bb..57c7e32 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/TraceQueryEsDAO.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/query/TraceQueryEsDAO.java @@ -18,6 +18,7 @@ package org.apache.skywalking.oap.server.storage.plugin.elasticsearch5x.query; +import com.google.common.base.Strings; import java.io.IOException; import java.util.*; import org.apache.skywalking.oap.server.core.analysis.manual.segment.SegmentRecord; @@ -65,7 +66,7 @@ public TraceBrief queryBasicTraces(long startSecondTB, long endSecondTB, long mi } boolQueryBuilder.must().add(rangeQueryBuilder); } - if (StringUtils.isNotEmpty(endpointName)) { + if (!Strings.isNullOrEmpty(endpointName)) { mustQueryList.add(QueryBuilders.matchPhraseQuery(SegmentRecord.ENDPOINT_NAME, endpointName)); } if (serviceId != 0) { @@ -74,7 +75,7 @@ public TraceBrief queryBasicTraces(long startSecondTB, long endSecondTB, long mi if (endpointId != 0) { boolQueryBuilder.must().add(QueryBuilders.termQuery(SegmentRecord.ENDPOINT_ID, endpointId)); } - if (StringUtils.isNotEmpty(traceId)) { + if (!Strings.isNullOrEmpty(traceId)) { boolQueryBuilder.must().add(QueryBuilders.termQuery(SegmentRecord.TRACE_ID, traceId)); } switch (traceState) { @@ -135,9 +136,10 @@ public TraceBrief queryBasicTraces(long startSecondTB, long endSecondTB, long mi segmentRecord.setLatency(((Number)searchHit.getSourceAsMap().get(SegmentRecord.LATENCY)).intValue()); segmentRecord.setIsError(((Number)searchHit.getSourceAsMap().get(SegmentRecord.IS_ERROR)).intValue()); String dataBinaryBase64 = (String)searchHit.getSourceAsMap().get(SegmentRecord.DATA_BINARY); - if (StringUtils.isNotEmpty(dataBinaryBase64)) { + if (!Strings.isNullOrEmpty(dataBinaryBase64)) { segmentRecord.setDataBinary(Base64.getDecoder().decode(dataBinaryBase64)); } + segmentRecord.setVersion(((Number)searchHit.getSourceAsMap().get(SegmentRecord.VERSION)).intValue()); segmentRecords.add(segmentRecord); } return segmentRecords; From 94442165e6c27f244a316cc77140d50493b2bbdb Mon Sep 17 00:00:00 2001 From: Young Hu Date: Sat, 29 Dec 2018 17:54:29 +0800 Subject: [PATCH 2/3] beta --- storage-elasticsearch5x-plugin/pom.xml | 4 ++++ .../elasticsearch5x/client/ElasticSearchClient5x.java | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/storage-elasticsearch5x-plugin/pom.xml b/storage-elasticsearch5x-plugin/pom.xml index 4eb2d6e..71ac17f 100644 --- a/storage-elasticsearch5x-plugin/pom.xml +++ b/storage-elasticsearch5x-plugin/pom.xml @@ -12,6 +12,10 @@ storage-elasticsearch5x-plugin jar + + 2.9.5 + + org.elasticsearch.client diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java index 7910e19..2efca9b 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java @@ -36,6 +36,7 @@ import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.unit.*; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -72,10 +73,12 @@ public ElasticSearchClient5x(String clusterName, String clusterNodes, String nam @Override public void connect() { List pairsList = parseClusterNodes(clusterNodes); - Settings settings = Settings.builder() - .put("cluster.name", clusterName).build(); + Builder builder = Settings.builder().put("cluster.name", clusterName); + if (!username.isEmpty()) { + builder.put("xpack.security.user", username + ":" + password); + } - client = new PreBuiltTransportClient(settings); + client = new PreBuiltTransportClient(builder.build()); pairsList.forEach(pairs -> { try { From a284603af0a85a542bfc666ebf028c05a913e059 Mon Sep 17 00:00:00 2001 From: Young Hu Date: Sat, 29 Dec 2018 17:59:06 +0800 Subject: [PATCH 3/3] remove auth --- apm-dist/src/main/assembly/application.yml | 2 -- .../StorageModuleElasticsearchConfig.java | 2 -- .../StorageModuleElasticsearchProvider.java | 3 +-- .../client/ElasticSearchClient5x.java | 15 +++------------ 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/apm-dist/src/main/assembly/application.yml b/apm-dist/src/main/assembly/application.yml index f08f0d6..b5381d2 100644 --- a/apm-dist/src/main/assembly/application.yml +++ b/apm-dist/src/main/assembly/application.yml @@ -59,8 +59,6 @@ storage: clusterName: ${SW_STORAGE_ES_CLUSTER_NAME:elasticsearch} #nameSpace: ${SW_NAMESPACE:""} clusterNodes: ${SW_STORAGE_ES_CLUSTER_NODES:localhost:9300} - username: ${SW_STORAGE_ES_USER_NAME:""} - password: ${SW_STORAGE_ES_PASSWORD:""} indexShardsNumber: ${SW_STORAGE_ES_INDEX_SHARDS_NUMBER:2} indexReplicasNumber: ${SW_STORAGE_ES_INDEX_REPLICAS_NUMBER:0} # Batch process setting, refer to https://www.elastic.co/guide/en/elasticsearch/client/java-api/5.5/java-docs-bulk-processor.html diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchConfig.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchConfig.java index 06253c5..20858af 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchConfig.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchConfig.java @@ -29,8 +29,6 @@ public class StorageModuleElasticsearchConfig extends ModuleConfig { @Setter @Getter private String clusterName; @Setter @Getter private String nameSpace; @Setter @Getter private String clusterNodes; - @Setter @Getter private String username; - @Setter @Getter private String password; private int indexShardsNumber; private int indexReplicasNumber; private boolean highPerformanceMode; diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchProvider.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchProvider.java index 32563c6..cb27b47 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchProvider.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/StorageModuleElasticsearchProvider.java @@ -61,8 +61,7 @@ public ModuleConfig createConfigBeanIfAbsent() { @Override public void prepare() throws ServiceNotProvidedException { - elasticSearchClient = new ElasticSearchClient5x(config.getClusterName(), config.getClusterNodes(), config.getNameSpace(), - config.getUsername(), config.getPassword()); + elasticSearchClient = new ElasticSearchClient5x(config.getClusterName(), config.getClusterNodes(), config.getNameSpace()); this.registerServiceImplementation(IBatchDAO.class, new BatchProcessEsDAO(elasticSearchClient, config.getBulkActions(), config.getBulkSize(), config.getFlushInterval(), config.getConcurrentRequests())); this.registerServiceImplementation(StorageDAO.class, new StorageEsDAO(elasticSearchClient)); diff --git a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java index 2efca9b..b716c26 100644 --- a/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java +++ b/storage-elasticsearch5x-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch5x/client/ElasticSearchClient5x.java @@ -36,7 +36,6 @@ import org.elasticsearch.client.transport.TransportClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.settings.Settings.Builder; import org.elasticsearch.common.transport.InetSocketTransportAddress; import org.elasticsearch.common.unit.*; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -57,28 +56,20 @@ public class ElasticSearchClient5x implements Client { private final String clusterName; private final String clusterNodes; private final String namespace; - private final String username; - private final String password; private TransportClient client; - public ElasticSearchClient5x(String clusterName, String clusterNodes, String namespace, String username, - String password) { + public ElasticSearchClient5x(String clusterName, String clusterNodes, String namespace) { this.clusterName = clusterName; this.clusterNodes = clusterNodes; this.namespace = namespace; - this.username = username; - this.password = password; } @Override public void connect() { List pairsList = parseClusterNodes(clusterNodes); - Builder builder = Settings.builder().put("cluster.name", clusterName); - if (!username.isEmpty()) { - builder.put("xpack.security.user", username + ":" + password); - } + Settings settings = Settings.builder().put("cluster.name", clusterName).build(); - client = new PreBuiltTransportClient(builder.build()); + client = new PreBuiltTransportClient(settings); pairsList.forEach(pairs -> { try {