How can my Spring Boot application access the cluster securely if it is located on a separate server outside of the VPN and how can I configure it in the Spring boot configuration (application.yml/application.properties)?
I also want the application to connect to the cluster i an way so that if i have e.g. 2 Master eligible nodes and one fails, the connection remains intact.
@Bean
public RestHighLevelClient esClient() throws Exception {
ElasticsearchRestClientFactoryBean factory = new ElasticsearchRestClientFactoryBean();
factory.setEsNodes(new String{globalProperties.getHost()});
Properties props = new Properties();
// props.setProperty("xpack.security.user", "elastic:changeme");
factory.setProperties(props);
// End: If you are running with x-pack
My repositories are extending the ElasticsearchRepository class. This works like a charm as long as my application is located on a server which runs an elasticsearch node.
But ideally, what I want to achieve is locating my application on a separated server and somehow accessing my elasticsearch cluster (running in my mesh vpn) in a safe manner.
next, your application placed on server-app, for example.
in your configuration you should set all servers.
you or your administrators should write rules in firewall(iptables) that allow connect from server-app to your servers where working elasticsearch.
or you should use x-pack with security opportunity with enabling tls.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.