Couldn't connect to elasticsearch remotely

Hi All,

I'm new to Elasticsearch. I've installed elasticsearch 6.7.0 on Centos6.9. It is a single cluster node. I can successfully curl it on same machine. curl -XGET "http://xxx.xxx.xx.xx:9200" I get the following result

    {
  "name" : "........",
  "cluster_name" : ".................",
  "cluster_uuid" : "..........",
  "version" : {
    "number" : "6.7.0",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "......",
    "build_date" : "......",
    "build_snapshot" : false,
    "lucene_version" : "7.7.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

But I couldnt connect to elasticsearch from other system, It says curl(7): Failed to connect to xxx.xxx.xx.xx port 9200 : Timed out. I check the firewall settings, it is open and in my elasticsearch.yml file,

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
http.host: 0.0.0.0
transport.host: localhost
network.bind_host: 0.0.0.0
http.cors.allow-origin: "*"
http.cors.enabled: true
#
# Set a custom port for HTTP:
#
http.port: 9200
transport.tcp.port: 9300

Any help is greatly appreciated. Thanks in advance

Can you share elasticsearch starting logs?
Is there any reason you are masking the IP address here? Do you mean that it's a public IP and that you are exposing your elasticsearch cluster on internet?

Thank you for your prompt reply

[2019-04-09T14:56:20,286][WARN ][o.e.b.JNANatives         ] [test_mall] unable to install syscall filter:
    java.lang.UnsupportedOperationException: seccomp unavailable: CONFIG_SECCOMP not compiled into kernel, CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER are needed
            at org.elasticsearch.bootstrap.SystemCallFilter.linuxImpl(SystemCallFilter.java:342) ~[elasticsearch-6.7.0.jar:6.7.0]
            at org.elasticsearch.bootstrap.SystemCallFilter.init(SystemCallFilter.java:617) ~[elasticsearch-6.7.0.jar:6.7.0]
            at org.elasticsearch.bootstrap.JNANatives.tryInstallSystemCallFilter(JNANatives.java:260) [elasticsearch-6.7.0.jar:6.7.0]
            at org.elasticsearch.bootstrap.Natives.tryInstallSystemCallFilter(Natives.java:113) [elasticsearch-6.7.0.jar:6.7.0]
            at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:108) [elasticsearch-6.7.0.jar:6.7.0]
            at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) [elasticsearch-6.7.0.jar:6.7.0]
            at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) [elasticsearch-6.7.0.jar:6.7.0]
            at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) [elasticsearch-6.7.0.jar:6.7.0]
            at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) [elasticsearch-6.7.0.jar:6.7.0]
            at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) [elasticsearch-6.7.0.jar:6.7.0]
            at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) [elasticsearch-cli-6.7.0.jar:6.7.0]
            at org.elasticsearch.cli.Command.main(Command.java:90) [elasticsearch-cli-6.7.0.jar:6.7.0]
            at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) [elasticsearch-6.7.0.jar:6.7.0]
            at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) [elasticsearch-6.7.0.jar:6.7.0]
    [2019-04-09T14:56:20,614][INFO ][o.e.e.NodeEnvironment    ] [test_mall] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [6gb], net total_space [29.4gb], types [rootfs]
    [2019-04-09T14:56:20,614][INFO ][o.e.e.NodeEnvironment    ] [test_mall] heap size [990.7mb], compressed ordinary object pointers [true]
    [2019-04-09T14:56:20,651][INFO ][o.e.n.Node               ] [test_mall] node name [test_mall], node ID [UREzq21QS9Cx29nz8AwRZQ]
    [2019-04-09T14:56:20,652][INFO ][o.e.n.Node               ] [test_mall] version[6.7.0], pid[255833], build[default/rpm/8453f77/2019-03-21T15:32:29.844721Z], OS[Linux/2.6.32-754.el6.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_131/25.131-b11]
      ..................
    [2019-04-09T14:56:29,162][INFO ][o.e.x.s.a.s.FileRolesStore] [test_mall] parsed [0] roles from file [/etc/elasticsearch/roles.yml]
    [2019-04-09T14:56:30,046][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [test_mall] [controller/255851] [Main.cc@109] controller (64 bit): Version 6.7.0 (Build d74ae2ac01b10d) Copyright (c) 2019 Elasticsearch BV
    [2019-04-09T14:56:30,843][DEBUG][o.e.a.ActionModule       ] [test_mall] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
    [2019-04-09T14:56:31,200][INFO ][o.e.d.DiscoveryModule    ] [test_mall] using discovery type [zen] and host providers [settings]
    [2019-04-09T14:56:32,457][INFO ][o.e.n.Node               ] [test_mall] initialized
    [2019-04-09T14:56:32,457][INFO ][o.e.n.Node               ] [test_mall] starting ...
    [2019-04-09T14:56:32,659][INFO ][o.e.t.TransportService   ] [test_mall] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}, {[::1]:9300}
    [2019-04-09T14:56:32,742][WARN ][o.e.b.BootstrapChecks    ] [test_mall] max number of threads [1024] for user [elasticsearch] is too low, increase to at least [4096]
    [2019-04-09T14:56:32,742][WARN ][o.e.b.BootstrapChecks    ] [test_mall] system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
    [2019-04-09T14:56:35,827][INFO ][o.e.c.s.MasterService    ] [test_mall] zen-disco-elected-as-master ([0] nodes joined), reason: new_master {test_mall}{UREzq21QS9Cx29nz8AwRZQ}{m4bxiSN8QXalnNNmGZYEXg}{localhost}{127.0.0.1:9300}{ml.machine_memory=8389681152, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}
    [2019-04-09T14:56:35,834][INFO ][o.e.c.s.ClusterApplierService] [test_mall] new_master {test_mall}{UREzq21QS9Cx29nz8AwRZQ}{m4bxiSN8QXalnNNmGZYEXg}{localhost}{127.0.0.1:9300}{ml.machine_memory=8389681152, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true}, reason: apply cluster state (from master [master {test_mall}{UREzq21QS9Cx29nz8AwRZQ}{m4bxiSN8QXalnNNmGZYEXg}{localhost}{127.0.0.1:9300}{ml.machine_memory=8389681152, xpack.installed=true, ml.max_open_jobs=20, ml.enabled=true} committed version [1] source [zen-disco-elected-as-master ([0] nodes joined)]])
    [2019-04-09T14:56:35,932][INFO ][o.e.h.n.Netty4HttpServerTransport] [test_mall] publish_address {xxx.xxx.xx.xx:9200}, bound_addresses {[::]:9200}
    [2019-04-09T14:56:35,933][INFO ][o.e.n.Node               ] [test_mall] started
    [2019-04-09T14:56:36,551][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [test_mall] Failed to clear cache for realms [[]]
    [2019-04-09T14:56:36,618][INFO ][o.e.l.LicenseService     ] [test_mall] license [fd218012-bd44-4eae-8831-35cb0da9702b] mode [basic] - valid
    [2019-04-09T14:56:36,629][INFO ][o.e.g.GatewayService     ] [test_mall] recovered [4] indices into cluster_state
    [2019-04-09T14:56:37,461][INFO ][o.e.c.r.a.AllocationService] [test_mall] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[test][4], [testserverelastic_][0]] ...]).
    [2019-04-09T15:35:24,191][INFO ][o.e.c.m.MetaDataCreateIndexService] [test_mall] [testserverelastic1] creating index, cause [api], templates [], shards [6]/[6], mappings [category]

Yes, I've installed my elasticsearch in my testserver and I tried to connect to it locally from my system. I couldnt connect through curl or browser.

Don't expose your cluster on internet without any protection.

You can have a look at cloud.elastic.co where you can have a secured cluster up and running in few minutes.

But if you really want to do it:

Change network.host setting to bound it to the public IP of your server.

Thanks for your support. I'll check cloud.elastic.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.