Jhipster microservices cause conflict on port 9300 of Elasticsearch - elasticsearch

Elasticsearch works with ports 9200 and 9300, but if I start a JHipster micro-service configured to work with Elasticsearch before starting the Elasticsearch service Elasticsearch fails because something in the JHipster service starts at port 9300.
I checked this situation by running the netstat -a command in Windows CMD.
If Elasticsearch uses port 9300 and the microservice will use Elasticsearch, why is the microservice occupying port 9300?
Need to change anything else for the service to use Elasticsearch in dev mode?

You can run elasticsearch on different ports than the default one. To do so add/update in elasticsearch.yml file the following:
http.port: 9201
transport.port: 9301

Related

How do I curl my elasticsearch on AWS EC2

I installed elasticsearch(docker) 8.2 on aws ec2(ubuntu 20.04.)
Everything is working.My only problem is that I can't reach(curl) it from other instances and my backend server(it is on same vpc).
I added my node to its discovery node, and also set network.host: 0.0.0.0
but I still can't reach it
(I tried with both private and public ip)
Is it necessary to install SSL/TSL on it with elastic 8?
Does anyone has any suggestion how to access it?
Looks like you forgot to bind the docker container port to host port, you need to add below config, to your Elasticsearch container docker yml
ports:
- "9202:9200" (bind 9200 port of host to docker port of 9200, 9200 is the Elasticsearch port by default)
After that you should be able to do the curl from other instances in the VPC.

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"]

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.

On iMac, access elasticsearch and neo4j ports on local ip address?

ifconfig shows
inet 192.168.10.1
I can access
http://localhost/
http://127.0.0.1/
http://192.168.10.1
They are all the same.
I also can access neo4j and elasticsearch ports on the following urls
Elasticsearch
http://127.0.0.1:9200/
http://localhost:9200/
Neo4j
http://127.0.0.1:7474/browser/
http://localhost:7474/browser/
But port 9200 and 7474 are not working for 192.168.10.1
http://192.168.10.1:9200
http://192.168.10.1:7474
Something I need to do make the port 7474 (neo4j) and 9200 (elasticsearch) working for 192.168.10.1, but I don't know how.
Please advise, thanks!
I figured it out.
Neo4j
Set up neo4j on the ip (except localhost), in my case
http://192.168.10.1:7474
In the neo4j.conf file
uncomment the following line.
# With default configuration Neo4j only accepts local connections.
# To accept non-local connections, uncomment this line:
dbms.connectors.default_listen_address=0.0.0.0
Elasticsearch
Modify elasticsearch.yml
add the following line
network.host: 0.0.0.0
Then start elasticsearch.

Resources