Unable to connet to localhost:9200


in terminal it shows Elasticsearch status as active and running

image
when i try to run this command it returning empty

Welcome!

Please don't post images of text as they are hard to read, may not display correctly for everyone, and are not searchable.

Instead, paste the text and format it with </> icon or pairs of triple backticks (```), and check the preview window to make sure it's properly formatted before posting it. This makes it more likely that your question will receive a useful answer.

It would be great if you could update your post to solve this.

That said, if you are using a 8.x version, you should try https instead with the --insecure option.

If you are not, please share the full logs of Elasticsearch.

hai @dadoonet
I'm using 7.x version

[2022-03-17T17:38:46,629][INFO ][o.e.e.NodeEnvironment    ] [shamir-Mi-NoteBook-14] using [1] data paths, mounts [[/ (/dev/sda2)]], net usable_space [59.7gb], net total_space [233.2gb], types [ext4]
[2022-03-17T17:38:46,629][INFO ][o.e.e.NodeEnvironment    ] [shamir-Mi-NoteBook-14] heap size [3.8gb], compressed ordinary object pointers [true]
[2022-03-17T17:38:46,699][INFO ][o.e.n.Node               ] [shamir-Mi-NoteBook-14] node name [shamir-Mi-NoteBook-14], node ID [bbmNV2bDSO-CrfAyrAIRLg], cluster name [elasticsearch], roles [ingest, data_frozen, ml, data_hot, transform, data_content, data_warm, master, remote_cluster_client, data, data_cold]
[2022-03-17T17:38:54,273][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [shamir-Mi-NoteBook-14] [controller/1893] [Main.cc@123] controller (64 bit): Version 8.1.0 (Build 36e2300340f08a) Copyright (c) 2022 Elasticsearch BV
[2022-03-17T17:38:54,426][INFO ][o.e.x.s.Security         ] [shamir-Mi-NoteBook-14] Security is enabled
[2022-03-17T17:38:54,638][INFO ][o.e.x.s.a.Realms         ] [shamir-Mi-NoteBook-14] license mode is [trial], currently licensed security realms are [reserved/reserved,file/default_file,native/default_native]
[2022-03-17T17:38:54,647][INFO ][o.e.x.s.a.s.FileRolesStore] [shamir-Mi-NoteBook-14] parsed [0] roles from file [/etc/elasticsearch/roles.yml]
[2022-03-17T17:38:55,016][INFO ][o.e.x.s.InitialNodeSecurityAutoConfiguration] [shamir-Mi-NoteBook-14] Auto-configuration will not generate a password for the elastic built-in superuser, as we cannot  determine if there is a terminal attached to the elasticsearch process. You can use the `bin/elasticsearch-reset-password` tool to set the password for the elastic user.
[2022-03-17T17:38:56,199][INFO ][o.e.t.n.NettyAllocator   ] [shamir-Mi-NoteBook-14] creating NettyAllocator with the following configs: [name=elasticsearch_configured, chunk_size=1mb, suggested_max_allocation_size=1mb, factors={es.unsafe.use_netty_default_chunk_and_page_size=false, g1gc_enabled=true, g1gc_region_size=4mb}]
[2022-03-17T17:38:56,223][INFO ][o.e.i.r.RecoverySettings ] [shamir-Mi-NoteBook-14] using rate limit [40mb] with [default=40mb, read=0b, write=0b, max=0b]
[2022-03-17T17:38:56,254][INFO ][o.e.d.DiscoveryModule    ] [shamir-Mi-NoteBook-14] using discovery type [multi-node] and seed hosts providers [settings]
[2022-03-17T17:38:57,159][INFO ][o.e.n.Node               ] [shamir-Mi-NoteBook-14] initialized
[2022-03-17T17:38:57,160][INFO ][o.e.n.Node               ] [shamir-Mi-NoteBook-14] starting ...
[2022-03-17T17:38:57,183][INFO ][o.e.x.s.c.f.PersistentCache] [shamir-Mi-NoteBook-14] persistent cache index loaded
[2022-03-17T17:38:57,184][INFO ][o.e.x.d.l.DeprecationIndexingComponent] [shamir-Mi-NoteBook-14] deprecation component started
[2022-03-17T17:38:57,302][INFO ][o.e.t.TransportService   ] [shamir-Mi-NoteBook-14] publish_address {localhost/127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
[2022-03-17T17:38:57,621][INFO ][o.e.c.c.Coordinator      ] [shamir-Mi-NoteBook-14] cluster UUID [kE7sxK_iQcaF2hM832yOXQ]
[2022-03-17T17:38:57,885][INFO ][o.e.c.s.MasterService    ] [shamir-Mi-NoteBook-14] elected-as-master ([1] nodes joined)[{shamir-Mi-NoteBook-14}{bbmNV2bDSO-CrfAyrAIRLg}{S2oucpo4T1-8lZ29ES7WTg}{localhost}{127.0.0.1:9300}{cdfhilmrstw} completing election, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 2, version: 56, delta: master node changed {previous [], current [{shamir-Mi-NoteBook-14}{bbmNV2bDSO-CrfAyrAIRLg}{S2oucpo4T1-8lZ29ES7WTg}{localhost}{127.0.0.1:9300}{cdfhilmrstw}]}
[2022-03-17T17:38:57,979][INFO ][o.e.c.s.ClusterApplierService] [shamir-Mi-NoteBook-14] master node changed {previous [], current [{shamir-Mi-NoteBook-14}{bbmNV2bDSO-CrfAyrAIRLg}{S2oucpo4T1-8lZ29ES7WTg}{localhost}{127.0.0.1:9300}{cdfhilmrstw}]}, term: 2, version: 56, reason: Publication{term=2, version=56}
[2022-03-17T17:38:58,031][INFO ][o.e.h.AbstractHttpServerTransport] [shamir-Mi-NoteBook-14] publish_address {192.168.0.106:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}, {192.168.0.106:9200}
[2022-03-17T17:38:58,032][INFO ][o.e.n.Node               ] [shamir-Mi-NoteBook-14] started
[2022-03-17T17:38:58,130][INFO ][o.e.l.LicenseService     ] [shamir-Mi-NoteBook-14] license [64da8fd7-880c-4f47-b18b-ae76f56194a3] mode [basic] - valid
[2022-03-17T17:38:58,132][INFO ][o.e.x.s.a.Realms         ] [shamir-Mi-NoteBook-14] license mode is [basic], currently licensed security realms are [reserved/reserved,file/default_file,native/default_native]
[2022-03-17T17:38:58,139][INFO ][o.e.g.GatewayService     ] [shamir-Mi-NoteBook-14] recovered [1] indices into cluster_state
[2022-03-17T17:38:58,530][INFO ][o.e.c.r.a.AllocationService] [shamir-Mi-NoteBook-14] current.health="GREEN" message="Cluster health status changed from [RED] to [GREEN] (reason: [shards started [[.geoip_databases][0]]])." previous.health="RED" reason="shards started [[.geoip_databases][0]]"
[2022-03-17T17:38:58,852][INFO ][o.e.i.g.DatabaseNodeService] [shamir-Mi-NoteBook-14] successfully loaded geoip database file [GeoLite2-Country.mmdb]
[2022-03-17T17:38:58,878][INFO ][o.e.i.g.DatabaseNodeService] [shamir-Mi-NoteBook-14] successfully loaded geoip database file [GeoLite2-ASN.mmdb]
[2022-03-17T17:38:59,689][INFO ][o.e.i.g.DatabaseNodeService] [shamir-Mi-NoteBook-14] successfully loaded geoip database file [GeoLite2-City.mmdb]
[2022-03-17T17:40:33,286][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [shamir-Mi-NoteBook-14] received plaintext http traffic on an https channel, closing connection

[2022-03-17T17:40:33,286][WARN ][o.e.x.s.t.n.SecurityNetty4HttpServerTransport] [shamir-Mi-NoteBook-14] received plaintext http traffic on an https channel, closing connection

Your cluster is setup with TLS enabled. So you need to access it over https, not http. Try

curl -X GET https://localhost:9200

FWIW, there is no need to use -k or --insecure when accessing a self-configured 8.x cluster. The HTTP CA cert is available at a specific location, you can use --cacert config/certs/http_ca.crt with curl.

1 Like

Ha! Thanks @ikakavas. That's indeed better and safer. :wink:

1 Like

thanks @ikakavas and @dadoonet

{"error":{"root_cause":[{"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","Bearer realm=\"security\"","ApiKey"]}}],"type":"security_exception","reason":"missing authentication credentials for REST request [/]","header":{"WWW-Authenticate":["Basic realm=\"security\" charset=\"UTF-8\"","Bearer realm=\"security\"","ApiKey"]}},"status":401}

how do i add authentication here?

curl -u elastic ....

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