Skip to content

[Improve] ElasticSearch service address configuration supports the following two formats #280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import javax.net.ssl.SSLContext;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
Expand All @@ -68,10 +69,13 @@ private EsRestClient(RestClient restClient) {

public static EsRestClient createInstance(Config pluginConfig) {
try {
List<String> hosts =
JsonUtils.toList(
pluginConfig.getString(ElasticSearchOptionRule.HOSTS.key()),
String.class);
List<String> hosts;
String hostsConfig = pluginConfig.getString(ElasticSearchOptionRule.HOSTS.key());
try {
hosts = JsonUtils.toList(hostsConfig, String.class);
} catch (RuntimeException e) {
hosts = Collections.singletonList(hostsConfig);
}
Optional<String> username = Optional.empty();
Optional<String> password = Optional.empty();
if (pluginConfig.hasPath(ElasticSearchOptionRule.USERNAME.key())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ SqlServer-CDC {

Elasticsearch {
hosts = "Hosts"
hosts_description = "The HTTP port information in ElasticSearch is of type List, such as [\"127.0.0.1:9200\", \"127.0.0.2:9200\"]"
hosts_description = "The configuration of the ElasticSearch service address supports the following two formats:\n 1. Single-node mode: A single string, such as \"127.0.0.1:9200\". \n 2. Cluster mode: A JSON array string, such as [\"127.0.0.1:9200\", \"127.0.0.2:9200\"]."
username = "Username"
password = "Password"
tls_verify_certificate = "Enable TLS Verify Certificate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ SqlServer-CDC {

Elasticsearch {
hosts = "访问地址"
hosts_description = "ElasticSearch中HTTP端口信息,类型为List,如:[\"127.0.0.1:9200\",\"127.0.0.2:9200\"]"
hosts_description = "ElasticSearch服务地址配置,支持以下两种格式:\n 1. 单节点模式:单个字符串,如 \"127.0.0.1:9200\" \n 2. 集群模式:JSON数组字符串,如 [\"127.0.0.1:9200\",\"127.0.0.2:9200\"]"
username = "用户名"
password = "密码"
tls_verify_certificate = "为HTTPS端点启用证书验证"
Expand Down