I start elasticsearch and check status, it's running. But when I use curl to access, I receive an message: Connection refused.
Here is my code when I check in command line:
root@hieu: service elasticsearch start
root@hieu: systemctl -l status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendo
Active: active (running) since Sat 2019-04-27 16:34:31 +07; 1s ago
Docs: http://www.elastic.co
Main PID: 4980 (java)
Tasks: 15 (limit: 4535)
CGroup: /system.slice/elasticsearch.service
└─4980 /usr/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSIni
Thg 4 27 16:34:31 hieu-Latitude-E6420 systemd[1]: Started Elasticsearch.
Thg 4 27 16:34:31 hieu-Latitude-E6420 elasticsearch[4980]: warning: Falling back
Thg 4 27 16:34:32 hieu-Latitude-E6420 elasticsearch[4980]: OpenJDK 64-Bit Server
Thg 4 27 16:34:32 hieu-Latitude-E6420 elasticsearch[4980]: OpenJDK 64-Bit Server
root@hieu-Latitude-E6420:/home/hieu# curl -XGET 127.0.0.1:9200
curl: (7) Failed to connect to 127.0.0.1 port 9200: Connection refused
[2019-04-28T09:36:14,460][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [HzcmFIK] [controller/21576] [Main.cc@109] controller (64 bit): Version 6.7.1 (Build e1f492de67a719) Copyright (c) 2019 Elasticsearch BV
[2019-04-28T09:36:15,860][DEBUG][o.e.a.ActionModule ] [HzcmFIK] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-04-28T09:36:15,911][ERROR][o.e.g.GatewayMetaState ] [HzcmFIK] failed to read local state, exiting...
org.elasticsearch.ElasticsearchException: java.io.IOException: failed to read [id:0, file:/var/lib/elasticsearch/nodes/0/_state/global-0.st]
at org.elasticsearch.ExceptionsHelper.maybeThrowRuntimeAndSuppress(ExceptionsHelper.java:164) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.MetaDataStateFormat.loadLatestState(MetaDataStateFormat.java:304) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.MetaStateService.loadGlobalState(MetaStateService.java:112) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.MetaStateService.loadFullState(MetaStateService.java:57) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.GatewayMetaState.<init>(GatewayMetaState.java:88) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.node.Node.<init>(Node.java:499) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.node.Node.<init>(Node.java:266) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.7.1.jar:6.7.1]
at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.7.1.jar:6.7.1]
Caused by: java.io.IOException: failed to read [id:0, file:/var/lib/elasticsearch/nodes/0/_state/global-0.st]
at org.elasticsearch.gateway.MetaDataStateFormat.loadLatestState(MetaDataStateFormat.java:298) ~[elasticsearch-6.7.1.jar:6.7.1]
... 15 more
Caused by: java.lang.IllegalArgumentException: Unexpected field [cluster_uuid_committed]
at org.elasticsearch.cluster.metadata.MetaData$Builder.fromXContent(MetaData.java:1270) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.cluster.metadata.MetaData$1.fromXContent(MetaData.java:1300) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.cluster.metadata.MetaData$1.fromXContent(MetaData.java:1291) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.MetaDataStateFormat.read(MetaDataStateFormat.java:196) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.MetaDataStateFormat.loadLatestState(MetaDataStateFormat.java:294) ~[elasticsearch-6.7.1.jar:6.7.1]
... 15 more
[2019-04-28T09:36:15,938][ERROR][o.e.b.Bootstrap ] [HzcmFIK] Exception
org.elasticsearch.ElasticsearchException: java.io.IOException: failed to read [id:0, file:/var/lib/elasticsearch/nodes/0/_state/global-0.st]
at org.elasticsearch.ExceptionsHelper.maybeThrowRuntimeAndSuppress(ExceptionsHelper.java:164) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.MetaDataStateFormat.loadLatestState(MetaDataStateFormat.java:304) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.MetaStateService.loadGlobalState(MetaStateService.java:112) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.MetaStateService.loadFullState(MetaStateService.java:57) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.GatewayMetaState.<init>(GatewayMetaState.java:88) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.node.Node.<init>(Node.java:499) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.node.Node.<init>(Node.java:266) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:212) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:212) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.7.1.jar:6.7.1]
at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) [elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.7.1.jar:6.7.1]
Caused by: java.io.IOException: failed to read [id:0, file:/var/lib/elasticsearch/nodes/0/_state/global-0.st]
at org.elasticsearch.gateway.MetaDataStateFormat.loadLatestState(MetaDataStateFormat.java:298) ~[elasticsearch-6.7.1.jar:6.7.1]
... 15 more
Caused by: java.lang.IllegalArgumentException: Unexpected field [cluster_uuid_committed]
at org.elasticsearch.cluster.metadata.MetaData$Builder.fromXContent(MetaData.java:1270) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.cluster.metadata.MetaData$1.fromXContent(MetaData.java:1300) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.cluster.metadata.MetaData$1.fromXContent(MetaData.java:1291) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.MetaDataStateFormat.read(MetaDataStateFormat.java:196) ~[elasticsearch-6.7.1.jar:6.7.1]
at org.elasticsearch.gateway.MetaDataStateFormat.loadLatestState(MetaDataStateFormat.java:294) ~[elasticsearch-6.7.1.jar:6.7.1]
... 15 more
[2019-04-28T09:36:15,960][INFO ][o.e.x.m.p.NativeController] [HzcmFIK] Native controller process has stopped - no new native processes can be started
Thank two guys, I just change $JAVA_HOME from/usr/lib/jvm/java to /usr/lib/jvm/java-8-openjdk-amd64 (I check list of file in jvm folder and saw java-8-openjdk-amd64 instead of java ), then restart. I don't know what's wrong but it's work now.
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.