I wanted to reach out to see if anyone could help me with the following error I am getting while attempting to establish connection to Elastic PROD DB server.
Thanks for running those tests. That's very helpful information!
Your results confirm that the server is online and your machine can reach it, but the connection to the Elasticsearch port (9200) is being blocked or refused. This tells us the problem is likely on the server itself, either with the Elasticsearch service or a firewall.
Let's check a few things directly on the server. You may need to ask your system administrator for help with these commands.
1. Is Elasticsearch Running?
First, let's verify that the Elasticsearch service is active.
On most modern Linux systems, you can use this command:
sudo systemctl status elasticsearch
Look for a line that says Active: active (running).
2. Is It Listening on the Correct Port and IP?
If the service is running, let's see exactly what network address and port it's using. The service might be running but only listening for connections from localhost (the server itself).
Use this command to see what's listening on port 9200:
sudo netstat -tulpn | grep 9200
Good Output: You want to see 0.0.0.0:9200 or <server_ip>:9200. This means it's listening on all network interfaces or the correct public one.
Problem Output: If you see 127.0.0.1:9200 or localhost:9200, it means Elasticsearch is only accepting connections from the server itself. This is a common setting in the elasticsearch.yml configuration file (network.host).
3. Could a Firewall Be Blocking the Port?
If Elasticsearch is running and listening on the correct IP address, the final suspect is a firewall on the server. Here are commands to check the most common firewalls:
For firewalld (CentOS/RHEL): sudo firewall-cmd --list-all
Check if port 9200/tcp is listed under ports.
For UFW (Ubuntu/Debian): sudo ufw status
Check the list of rules to see if port 9200 is allowed.
Based on the output of these checks, we should be able to pinpoint the exact cause. Let me know what you find.
In addition to Qsfrom @gabriel.landau , tell us please a little about the Elasticsearch server, what do you know about it? Did you or your team set it up? Are you responsible for it? Is it a cluster, or a single instance? Is it within your own "LAN", or a virtual equivalent, or "somewhere else"? Are you within some kind of corporate IT environment, the sort of place where network connectivity requires firewalls/access-lists/similar to be updated and managed by network/security/... teams? You mention 'PROD", is that to distinguish between that specific service and (eg) other TEST, DEV, Staging/Integration/ProProd/... services, and if so, does that connectivity work?
If you don't have some sort of access (access meant in widest sense) it will be very difficult for us, not knowing your environment, to establish why you cannot connect.
Thank you for your help and support. Please note, I have come to find out that the root cause of this connectivity issue is due to our corporate firewall settings. In order to access Elastic DB via the port, we will need to complete work with our network and security team.
Again, thank you for the helpful info provided. I will mark this one as resolved. Resolution being firewall settings need to be updated.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.