mirror of
https://github.com/alibaba/DataX.git
synced 2025-05-02 06:50:35 +08:00
ES集群写入
This commit is contained in:
parent
f01836a080
commit
3e8a5fcc2e
@ -53,6 +53,8 @@ public class ElasticSearchClient {
|
|||||||
public ElasticSearchClient(Configuration conf) {
|
public ElasticSearchClient(Configuration conf) {
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
String endpoint = Key.getEndpoint(conf);
|
String endpoint = Key.getEndpoint(conf);
|
||||||
|
//es是支持集群写入的
|
||||||
|
String[] endpoints = endpoint.split(",");
|
||||||
String user = Key.getUsername(conf);
|
String user = Key.getUsername(conf);
|
||||||
String passwd = Key.getPassword(conf);
|
String passwd = Key.getPassword(conf);
|
||||||
boolean multiThread = Key.isMultiThread(conf);
|
boolean multiThread = Key.isMultiThread(conf);
|
||||||
@ -63,7 +65,7 @@ public class ElasticSearchClient {
|
|||||||
int totalConnection = this.conf.getInt("maxTotalConnection", 200);
|
int totalConnection = this.conf.getInt("maxTotalConnection", 200);
|
||||||
JestClientFactory factory = new JestClientFactory();
|
JestClientFactory factory = new JestClientFactory();
|
||||||
Builder httpClientConfig = new HttpClientConfig
|
Builder httpClientConfig = new HttpClientConfig
|
||||||
.Builder(endpoint)
|
.Builder(Arrays.asList(endpoints))
|
||||||
// .setPreemptiveAuth(new HttpHost(endpoint))
|
// .setPreemptiveAuth(new HttpHost(endpoint))
|
||||||
.multiThreaded(multiThread)
|
.multiThreaded(multiThread)
|
||||||
.connTimeout(readTimeout)
|
.connTimeout(readTimeout)
|
||||||
|
Loading…
Reference in New Issue
Block a user