I am working with spring boot application. Recently we have updated our application to version spring boot 2.0.3
. It working fine with Elastic Search 6.2.3
version.
We have created the build with our application and tested on the local system with application-prod.yml
with elastic search service version 6.2.3 successfully.
But as we moved to AWS EC2 instance. Ran Elastic search 6.2.3, got errors of the bootstrap check, but the errors are resolved with Elasticsearch 5.x - Bootstrap checks failing Then we are able to access elastic search outside of the instance.
On putting the same configuration of elastic search in application-prod.yml and running spring boot application, it failed to start with error :
Cannot resolve reference to bean 'elasticsearchTemplate' while setting bean property 'elasticsearchOperations'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'elasticsearchTemplate' available
We are able to access any version of the elastic search from EC2 instance.
Tried :
- Ran elastic search version 5.4.0 but it's also not working.
- Without configuring elasticsearch.yml with IP and port (run with default configuration) then also not worked.
- Setting in elasticsearch.yml :
network.host: my ip address
http.port: 9400
transport.tcp.port: 9100
transport.host: 127.0.0.1
Elastic Search 6.2.3 logs on start (started):
[ec2-user@ip-172-31-66-241 bin]$ sh elasticsearch
[2018-09-07T06:33:36,234][INFO ][o.e.n.Node ] [node-esonaws] initializing ...
[2018-09-07T06:33:36,299][INFO ][o.e.e.NodeEnvironment ] [node-esonaws] using [1] data paths, mounts [[/ (/dev/xvda1)]], net usable_space [5.8gb], net total_space [7.7gb], types [ext4]
[2018-09-07T06:33:36,299][INFO ][o.e.e.NodeEnvironment ] [node-esonaws] heap size [1007.3mb], compressed ordinary object pointers [true]
[2018-09-07T06:33:36,300][INFO ][o.e.n.Node ] [node-esonaws] node name [node-esonaws], node ID [s_p8BehORnOHD-zKCtf9vg]
[2018-09-07T06:33:36,300][INFO ][o.e.n.Node ] [node-esonaws] version[6.2.3], pid[10407], build[c59ff00/2018-03-13T10:06:29.741383Z], OS[Linux/4.9.81-35.56.amzn1.x86_64/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_161/25.161-b14]
[2018-09-07T06:33:36,300][INFO ][o.e.n.Node ] [node-esonaws] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.4vPhJaqc, -XX:+HeapDumpOnOutOfMemoryError, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Des.path.home=/home/ec2-user/elasticsearch-6.2.3, -Des.path.conf=/home/ec2-user/elasticsearch-6.2.3/config]
[2018-09-07T06:33:36,944][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [aggs-matrix-stats]
[2018-09-07T06:33:36,944][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [analysis-common]
[2018-09-07T06:33:36,944][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [ingest-common]
[2018-09-07T06:33:36,945][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [lang-expression]
[2018-09-07T06:33:36,945][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [lang-mustache]
[2018-09-07T06:33:36,945][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [lang-painless]
[2018-09-07T06:33:36,946][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [mapper-extras]
[2018-09-07T06:33:36,946][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [parent-join]
[2018-09-07T06:33:36,946][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [percolator]
[2018-09-07T06:33:36,946][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [rank-eval]
[2018-09-07T06:33:36,946][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [reindex]
[2018-09-07T06:33:36,947][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [repository-url]
[2018-09-07T06:33:36,947][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [transport-netty4]
[2018-09-07T06:33:36,947][INFO ][o.e.p.PluginsService ] [node-esonaws] loaded module [tribe]
[2018-09-07T06:33:36,947][INFO ][o.e.p.PluginsService ] [node-esonaws] no plugins loaded
[2018-09-07T06:33:39,393][INFO ][o.e.d.DiscoveryModule ] [node-esonaws] using discovery type [zen]
[2018-09-07T06:33:39,919][INFO ][o.e.n.Node ] [node-esonaws] initialized
[2018-09-07T06:33:39,920][INFO ][o.e.n.Node ] [node-esonaws] starting ...
[2018-09-07T06:33:40,040][INFO ][o.e.t.TransportService ] [node-esonaws] publish_address {172.31.67.241:9300}, bound_addresses {172.31.67.241:9300}
[2018-09-07T06:33:40,056][INFO ][o.e.b.BootstrapChecks ] [node-esonaws] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2018-09-07T06:33:43,110][INFO ][o.e.c.s.MasterService ] [node-esonaws] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {node-esonaws}{s_p8BehORnOHD-zKCtf9vg}{k_9Tu_5OR4WZRJj86X0n8g}{172.31.67.241}{172.31.67.241:9300}
[2018-09-07T06:33:43,128][INFO ][o.e.c.s.ClusterApplierService] [node-esonaws] new_master {node-esonaws}{s_p8BehORnOHD-zKCtf9vg}{k_9Tu_5OR4WZRJj86X0n8g}{172.31.67.241}{172.31.67.241:9300}, reason: apply cluster state (from master [master {node-esonaws}{s_p8BehORnOHD-zKCtf9vg}{k_9Tu_5OR4WZRJj86X0n8g}{172.31.67.241}{172.31.67.241:9300} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
[2018-09-07T06:33:43,151][INFO ][o.e.g.GatewayService ] [node-esonaws] recovered [0] indices into cluster_state
[2018-09-07T06:33:43,163][INFO ][o.e.h.n.Netty4HttpServerTransport] [node-esonaws] publish_address {172.31.67.241:9400}, bound_addresses {172.31.67.241:9400}
[2018-09-07T06:33:43,164][INFO ][o.e.n.Node ] [node-esonaws] started
But nothing worked!!
All these configurations working fine on the local machine and running correctly my spring boot application.
Note: Earlier I was able to run spring boot 1.4.0 with elastic search 2.3.5 successfully on AWS EC2.
One interesting thing is that same configuration elastic search 6.2.3 with spring boot application running fine on the local machine but on EC2 instance throwing error mentioned above.
How to run spring boot 2.0.3 + elastic search 6.2.3 on AWS EC2?