cloud
This commit is contained in:
parent
aa8af0bfd4
commit
b6b5a0f42e
16
pom.xml
16
pom.xml
@ -38,6 +38,11 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.elasticsearch.client</groupId>
|
||||||
|
<artifactId>x-pack-transport</artifactId>
|
||||||
|
<version>6.4.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@ -116,6 +121,17 @@
|
|||||||
<enabled>false</enabled>
|
<enabled>false</enabled>
|
||||||
</snapshots>
|
</snapshots>
|
||||||
</repository>
|
</repository>
|
||||||
|
<!-- add the elastic repo -->
|
||||||
|
<repository>
|
||||||
|
<id>elastic</id>
|
||||||
|
<url>https://artifacts.elastic.co/maven</url>
|
||||||
|
<releases>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</releases>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>false</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<pluginRepositories>
|
<pluginRepositories>
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
package com.manalejandro.arjion;
|
package com.manalejandro.arjion;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.net.InetSocketAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
import org.elasticsearch.client.Client;
|
import org.elasticsearch.client.Client;
|
||||||
import org.elasticsearch.client.transport.TransportClient;
|
import org.elasticsearch.client.transport.TransportClient;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.transport.TransportAddress;
|
import org.elasticsearch.common.transport.TransportAddress;
|
||||||
import org.elasticsearch.transport.client.PreBuiltTransportClient;
|
import org.elasticsearch.transport.client.PreBuiltTransportClient;
|
||||||
|
import org.elasticsearch.xpack.client.PreBuiltXPackTransportClient;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@ -37,14 +41,35 @@ public class ESConfig {
|
|||||||
|
|
||||||
private TransportClient client;
|
private TransportClient client;
|
||||||
|
|
||||||
@Bean
|
String clusterId = "2be3ffc1fd284a8788906e5022d0cb18"; // Your cluster ID here
|
||||||
public Client client() throws Exception {
|
String region = "eu-central-1"; // Your region here
|
||||||
|
boolean enableSsl = true;
|
||||||
|
|
||||||
Settings esSettings = Settings.builder().put("cluster.name", EsClusterName).put("node.name", EsNodeName)
|
@Bean
|
||||||
|
public Client client() {
|
||||||
|
Settings settings = Settings.builder()
|
||||||
|
.put("client.transport.nodes_sampler_interval", "5s")
|
||||||
|
.put("client.transport.sniff", false)
|
||||||
|
.put("transport.tcp.compress", true)
|
||||||
|
.put("cluster.name", EsClusterName)
|
||||||
|
.put("xpack.security.transport.ssl.enabled", enableSsl)
|
||||||
|
.put("request.headers.X-Found-Cluster", clusterId)
|
||||||
|
.put("xpack.security.user", "elastic:ypRPLpSMYrEQ5Pm5HL6zePWD")
|
||||||
|
.put("xpack.security.transport.ssl.verification_mode", "full")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
client = new PreBuiltTransportClient(esSettings);
|
String hostname = clusterId + "." + region + ".aws.cloud.es.io";
|
||||||
return client.addTransportAddress(new TransportAddress(InetAddress.getByName(EsHost), EsPort));
|
// Instantiate a TransportClient and add the cluster to the list of addresses to connect to.
|
||||||
|
// Only port 9343 (SSL-encrypted) is currently supported.
|
||||||
|
TransportClient client = null;
|
||||||
|
try {
|
||||||
|
client = new PreBuiltXPackTransportClient(settings)
|
||||||
|
.addTransportAddress(new TransportAddress(InetAddress.getByName(hostname), 9343));
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
server.servlet.context-path=/arjion
|
server.servlet.context-path=/arjion
|
||||||
server.port=8080
|
server.port=3117
|
||||||
elasticsearch.clustername=elasticsearch
|
elasticsearch.clustername=2be3ffc1fd284a8788906e5022d0cb18
|
||||||
elasticsearch.host=localhost
|
elasticsearch.host=2be3ffc1fd284a8788906e5022d0cb18.eu-central-1.aws.cloud.es.io
|
||||||
elasticsearch.port=9300
|
elasticsearch.port=9343
|
||||||
elasticsearch.nodename=arjion
|
elasticsearch.nodename=arjion
|
||||||
arjion.indexName=documentos
|
arjion.indexName=documentos
|
||||||
arjion.documentType=documento
|
arjion.documentType=documento
|
||||||
arjion.uploadpath=/upload/
|
arjion.uploadpath=/home/ale/upload/
|
||||||
arjion.tesseractpath=/usr/bin
|
arjion.tesseractpath=/usr/bin
|
||||||
arjion.tesseractdatapath=/usr/share/tesseract-ocr
|
arjion.tesseractdatapath=/usr/share/tesseract-ocr
|
||||||
spring.main.allow-bean-definition-overriding=true
|
spring.main.allow-bean-definition-overriding=true
|
||||||
|
Loading…
Reference in New Issue
Block a user