You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

通过端口转发连接Elasticsearch后无法通信问题求助

Troubleshooting Connection Issues with New Elasticsearch via CF SSH Port Forwarding

Let’s work through some targeted checks to figure out why your new Elasticsearch instance isn’t reachable, even though your ELK connection is working:

1. Double-Check Your Port Forwarding Command

First, let’s confirm the basics of your tunnel setup:

cf ssh my-logstash -L 9200:ES_HOST:443 -L 9201:ELK:59464 -i 0
  • Make sure ES_HOST is the exact correct hostname or IP of your new Elasticsearch instance—typos here are super common.
  • Verify the remote Elasticsearch is actually listening on port 443. Some setups use 9200 for HTTP or 9243 for HTTPS by default. Test this directly from the my-logstash instance by running:
    # Use telnet if available
    telnet ES_HOST 443
    # Or curl for more detail
    curl -v https://ES_HOST:443
    

2. Check for Local Port Conflicts

Your local machine might have another service hogging port 9200, which blocks the tunnel. Check with these commands:

  • On Linux/macOS:
    lsof -i :9200
    
  • On Windows (PowerShell):
    netstat -ano | findstr ":9200"
    

If another process is using the port, either stop that process or adjust your tunnel to use a different local port (e.g., -L 9202:ES_HOST:443).

3. Validate SSL/TLS Configuration

Since you’re connecting to port 443, Elasticsearch is likely using HTTPS. Test your local connection with SSL considerations:

  • For quick testing, skip certificate verification temporarily with curl:
    curl -k https://localhost:9200
    
  • If the cert is self-signed, you’ll need to import it into your local trust store, or configure your Elasticsearch client (like Logstash) to trust the certificate explicitly.

4. Confirm Network Access from my-logstash

The my-logstash instance might not have permission to reach the new Elasticsearch host. SSH directly into my-logstash (without port forwarding) and run:

curl -v https://ES_HOST:443

If this fails, you’ll need to adjust firewall rules, security groups, or network policies to allow traffic from my-logstash to the new Elasticsearch instance on port 443.

5. Verify the SSH Tunnel is Active

Sometimes tunnels drop silently without warning. Check if the cf ssh process is still running on your local machine, or reconnect with verbose output to debug tunnel issues:

cf ssh my-logstash -v -L 9200:ES_HOST:443 -L 9201:ELK:59464 -i 0

The verbose logs will show if there are problems establishing or maintaining the tunnel connection.


内容的提问来源于stack exchange,提问作者don ali

火山引擎 最新活动