How to access Elasticsearch from other network ? <my static public ip address>:9200 - elasticsearch

I have my Elasticsearch running on my windows 10 server. I want to access it with < my static public ip address >:9200
I can access my elasticsearch from the server with:
localhost:9200
127.0.0.1:9200
<my ipv4 address from ipconfig>:9200
I can access my elasticsearch from the other device connected to same network as server:
<my ipv4 address from ipconfig>:9200
But i cannot access it with outside of network with:
<my static public ip address>:9200
I have already created inbound port rule for 9200 in firewall settings.
And my network settings in elasticsearch.yml
http.port: 9200
network.host: 0.0.0.0
transport.tcp.port: 9300
discovery.type: single-node
discovery.seed_hosts: ["0.0.0.0", "[::1]"]
network.bind_host: 0.0.0.0
Please help me ?
Note: I have static public ip address and i found my public ip address from https://whatismyipaddress.com/

I have resolved my issue.
Everything was good, i just allowed incoming connection on port 9200 in AWS ec2 console. Now it's working. Thank you.
Now i can access it with <my static public ip address>:9200

Related

Can't connect to remote ElasticSearch server using local machine's IP Address

I can't connect to ElasticSearch on my Digital Ocean droplet using my local machine's IP Address.
I got the IP Address by: Terminal > ipconfig getifaddr en0
- With that result, let's say: 100.888.777.99
I logged into my droplet by running: ssh username#111.222.3.444
Updated my UFW Rules by running: sudo ufw allow 9200 from 100.888.777.99
From my local machine I ran: curl -X GET 'http://111.222.3.444:9200'
And received: curl: (7) Failed to connect to 111.222.3.444 port 9200: Operation timed out
What am I doing wrong?
Things I've tried:
Changing the network.host variable in elasticsearch/elasticsearch.yml
network.host: 0.0.0.0 (also this a security risk since ip addresses are allowed )
Restarting the server
sudo /etc/init.d/elasticsearch restart
Adding more varibles to elasticsearch/elasticsearch.yml
transport.host: localhost
transport.tcp.port: 9300
http.port: 9200
I found that when I changed the UFW Rules to allow all connection to port 9200, I was able to connect to ElasticSearch from my local machine, but without that, it would not connect.
sudo ufw allow 9200
After some deep diving I found the issue was that the IP address that was returned by Terminal wasn't the correct one to use. I had to use the Public IP Address which I got from https://www.whatismyip.com/, you can also get this by:
Terminal > curl ifconfig.me
So when I removed the old UFW rule: 9200 ALLOW IN 100.888.777.99
And used the Public IP Address: sudo ufw allow 9200 from Public_IP_Address it connected.
I'm still not sure why my machine's IP Address doesn't work though...

elasticsearch setup on Gcloud VM fails

I wish to run my elasticsearch remotely on gcloud VM, this is configured to run at 127.0.0.1 at a specific port 9200. How to access this from a website outside this vm? If I change the network host to 0.0.0.0 on the yml file, even 9200 port becomes inaccessible. How do I overcome this problem?
Changed network.host: [_site_ , _local_ , _global_ ]
_site_ = internal ip given by google cloud vm,
_local_ = 127.0.0.1,
_global_ = found using curl ifconfig.me,
Opened a specific port (9200) and tried to connect with global IP address.
curl to the global ip gives
>Output: Failed to connect to (_global_ ip) port 9200: connection refused.
So put network.host:0.0.0.0 and then try to allow 9200 and 9201 port and restart the elasticsearch service.If you are using ubuntu then sudo service elasticsearch restart then check by doing curl -XGET 'http://localhost:9200?pretty'.Let me know if you are still facing any issues.
Use following configurations for elasticsearch.yml
network.host: 0.0.0.0
action.auto_create_index: false
index.mapper.dynamic: false
Solved this problem by going through the logs and found out that the public ip address is re-mapped to the internal ip address, hence network.host can't be set to external ip directly. Elasticsearch yml config is as follows:
'network.host: xx.xx.xxx.xx' is set to the internal ip (given by google),
'http.cors.enabled: true',
'http.cors.allow-origin:"*", (Do not use * in production, its a security issue)
'discovery.type: single-node' in my case to make it work independently and not in a cluster
Now this sandboxed version can be accessed from outside the VM using the external IP address given by Google.

How to change Elasticsearch network host

I've install ES on my VM which it has an OS of centos 7. It network.host: bind to the localhost. I can browse via port 9200.
My problem is that I've changed the network host to:0.0.0.0 (So I can get public access from my host PC).
the service started but the port is not listening.
I want to access ES from my host PC.
How can i change the network.host ?
I faced same issue in elasticsearch 7.3.0 version. I resolved by putting following
values in /etc/elasticsearch/elasticsearch.yaml as shown below
network.host: 127.0.0.1
http.host: 0.0.0.0
If you are planning to set network.host other than default(127.0.0.1) then change following details in /etc/elasticsearch/elasticsearch.yml
network.host: 0.0.0.0
discovery.seed_hosts: []
Looking at the Elasticsearch Network Settings documentation, it doesn't appear that 0.0.0.0 is a valid setting for network.host.
Try instead the special value _global_. So the section of your elasticsearch.yaml might look like this:
network:
host: _global_
This should tell Elasticsearch to listen on all network interfaces.
Since the version 7.3 of Elastic Search, it's necessary to put the following line
cluster.initial_master_nodes: node-1
network.host: 0.0.0.0
If your application is running on AWS and Elastic search is running on different host
network.host: YOUR_AWS_PRIVATE_IP
This works for me.

not able to connect to 9300 port through telnet elastic search

I have a elasticsearch node running on a server. My application which is on different server trying to connect to elasticsearch on 9300 through TransportClient. But I am getting following error "Caused by: org.elasticsearch.client.transport.NoNodeAvailableException: None of the configured nodes are available: [{#transport#-1}{Ir-wPDBRR9umDbtoqGIp0A}{X.X.X.X}{X.X.X.X:9300}]".
And I am not able to connect to the elasticsearch server on 9300 port through telnet as well. Here are my elasticsearch.yml settings
transport.host: localhost
transport.tcp.port: 9300
http.port: 9200
network.host: 0.0.0.0
is there any setting I am missing to access the ES remotely?
Any help will be appriciated.

Elastic search not accessible remotely

I am trying to access Elastic Search remotely, but getting connection error.
When I curl localhost:9200 in the remote server, I get the desired output. But remotely server_address:9200 is not accessible.
Any suggestions?
In elasticsearch.yml file modify/add network.host setting as below.
network.host: 0.0.0.0
and then restart your elasticsearch server.
Change (/etc/elasticsearch/elasticsearch.yml)network_host IP to your server private IP address.Then the ES can be access with same network range.
network.host: "192.168.xx.xx"
http.port: 9200
Edit your elasticsearch.yml file.
network.host: server_ip
http.port: 9200
transport.tcp.port: 9300

Resources