Google Cloud Platform - Connecting to Elastic Search - elasticsearch

I am trying to access Elastic Search via my static IP address but it's not working.
What did I try?
I created a Bitnami Elastic Search VM Instance from GCP Marketplace
I assigned a static IP to the same VM
I replaced the network.host to 0.0.0.0 inside elasticsearch.yml file
I added my static IP to network.publish_host inside elasticsearch.yml file
I added a firewall rule to allow all ports and added 0.0.0.0 as source filter
Now when trying to access Elastic Search using http://_my_static_ip:9200 I get nothing, the request fails. What am I missing here?? Any help would be appreciated. Thanks

The issue was my GCP being using an IPv6 address, I didn't know about this, this is something a developer on Fiverr told me, anyone having the same issue with Bitnami's GCP deployment needs to add the following line:
-Djava.net.preferIPv4Stack=true
to the following file:
/opt/bitnami/elasticsearch/config/jvm.options
After that restart your elasticsearc service using the following command:
sudo /opt/bitnami/ctlscript.sh restart
That should fix the issue if you have proper firewall rules set up and also added proper IPs to elasticsearch.yml config file. Read original question's What did I try? section.

Related

ElasticSearch Connection Timed Out in EC2 Instance

I am setting up an ELK Stack (which consists of ElasticSearch, LogStash and Kibana) in a single EC2 instance. AWS EC2 instance. I am following the documentation from the elastic.co site.
TL;DR; I cannot access my ElasticSearch interface hosted in an EC2 from the Web URL. How to fix that?
Type : m4.large
vCPU : 2
Memory : 8 GB
Storage: 25 GB (EBS)
Note : I have provisioned the EC2 instance inside a VPC and with an Elastic IP.
I have installed all 3 components. ElasticSearch and LogStash are running as services while Kibana is running via the command ./bin/kibana inside kibana-7.10.1-linux-x86_64/ directory.
When I curl the ElasticSearch endpoint using
curl http://localhost:9200
I get this JSON output. (Which means the service is running and is accessible via Port 9200).
However, when I try to access the same URL via my browser, I get an error saying
Connection Timed Out
Isn't this supposed to return the same JSON output as the one I've mentioned above?
I have attached the elasticsearch.yml file here (Hosted in gofile.io).
Here are the Inbound Rules for the EC2 instance.
EDIT : I tried changing the network.host: 'localhost'
to network.host: 0.0.0.0 and restarted the service but this time I got an error while starting the service. I attached the screenshot of that.
EDIT 2 : I have uploaded the updated elasticsearch.yml to Gofile.org).
The problem is the following line in your elasticsearch.yml configuration file:
node.name: node-1
network.host: 'localhost'
With that configuration, your ES cluster is only accessible from the same host and not from the outside. According to the official documentation, you need to either specify 0.0.0.0 or a specific publicly accessible IP address, otherwise that won't work.
Note that you also need to configure the following two lines in order for the cluster to properly form:
discovery.seed_hosts: ["node-1-ip-address"]
# Bootstrap the cluster using an initial set of master-eligible nodes:
cluster.initial_master_nodes: ["node-1"]

Ambari sandbox : elasticsearch port 9200 cannot reach

I have started the Ambari Sandbox ( actual IP is 13.82.183.171 ).
I have started also elasticsearch on one terminal session.
If I open another terminal session , YES I can access to elasticsearch with CURL : curl -X GET http://localhost:9200      
BUT If I put the http://localhost:9200  or http://127.0.0.1:9200  directly in IE , it cannot reach it.
I tried :
1) modifying the elasticsearch.yml with network.host: 13.82.183.171 But elastic search then don´t start.
I think I have to open the port 9200 on ambari Sandbox, but don´t know how to do this
Thank You -
Sounds like it may be permission settings. Is your Elasticsearch using readonlyrest(readonlyrest.yml)? and if it is configured correctly?

how can i solve kibana bad request issue while runnig local host

I am trying to run ElasticSearch with Kibana in Windows 10.
i followed this tutorial step by step https://www.youtube.com/watch?v=16NeBf_IAmU
when i go to :
localhost:5601
all i get is:
{"statusCode":400,"error":"Bad Request","message":"Invalid cookie header"}
So it seems like the ElasticSearch is running, but for some reasons the Kibana cannot connect to it.Any idea ho can i solve this issue!!
Edit your kibana.yml
Remove comment from bellow lines ,if server.host is binded to localhost also no problems
server.host: 0.0.0.0
elasticsearch.url: "http://localhost:9200"
restart kibana and try to access it,
If it is causing problems because of cookies you can go through this
https://discuss.elastic.co/t/bug-cookies-are-invalidated-after-some-time/34252/5

Remote accessing of elasticsearch5?

I am working with elastic search 5 and I setup it on my local network.
Now I need t access through remote, I had changed my configuration as follows but it not worked.
network.host: 0.0.0.0
Any suggestion, please.
Got the solution to my problem.
I have added following configuration to yml file
http.host: myIpAddress
Reference available here
Thank you.

Configuring elastic search not to be localhost

After installing Elasticsearch 5.6.3 and setting Nodename to the server name. I tried to browse to Elasticsearch using IP:9200 but it didn't work. If I browse to localhost:9200 it works. Where do I go to change th default behaviour of Localhost. Since I want to open this up to other external servers so the loop back address of localhost isn't any good.
After installing Kibana 5.6.3, the same is obviously true here as well. Starting the kibana server with the ip fails, but with localhost doesn't.
At this point I have no indexes, I just want to prove Elasticsearch can be reached beyond localhost.
Thanks
Bill
You can configure your IP with the "network.host" setting in 'elasticsearch.yml' and 'kibana.yml' in your config directory.
Here is some link to the Elasticsearch doc to config yours :)
Configuring Elasticsearch
Important Settings
For a quick start development configuration the following settings can be placed into 'elasticsearch.yml':
network.host e.g.
network.host: 192.168.178.49
cluster.initial_master_nodes e.g.
cluster.initial_master_nodes: ["node_1"]
You can also define a cluster name:
cluster.name: my-application
Start it with the node name (example for Windows)
C:\InstallFolder\elasticsearch-7.10.0>C:\InstallFolder\elasticsearch-7.10.0\bin\elasticsearch.bat -Enode.name=node_1
Go to your browser and open http://192.168.178.49:9200 (replace with your IP). It shows a JSON result. The localhost:9200 will no longer work.
This config should not be used for production environments. See the official docs.
In general when starting from a command prompt it shows any errors when something fails. These are very helpful.

Resources