【问题标题】:How to redirect tcp to port 9300 for elasticsearch server in nginx?如何将 tcp 重定向到 nginx 中弹性搜索服务器的端口 9300?
【发布时间】:2018-11-13 16:01:58
【问题描述】:

我可以通过这个简单的 nginx 配置将其余的通信重定向到 elasticsearch 服务器:

http {

sendfile            on;
tcp_nopush          on;
tcp_nodelay         on;
keepalive_timeout   30;
types_hash_max_size 2048;
client_max_body_size 50M;

include             /etc/nginx/mime.types;
default_type        application/octet-stream;

include /etc/nginx/conf.d/*.conf;
index   index.html index.htm;

server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  localhost;
    root         /usr/share/nginx/html;

    include /etc/nginx/default.d/*.conf;

    location / {
        proxy_pass http://localhost:9200;
        proxy_set_header Host $host;
    }
}
}

如果我尝试为客户端传输协议重定向到端口 9300,它不起作用,则客户端无法连接到弹性搜索服务器。 将 tcp 重定向到端口 9300 的正确 nginx 配置是什么?

【问题讨论】:

    标签: elasticsearch nginx configuration


    【解决方案1】:

    请注意,如果是新开发,您应该使用其余客户端,而不是已弃用的传输客户端。 https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html#_tcp_transport 您可能需要设置设置 transport.publish_port 和 transport.publish_host...

    如果反向代理只是 TCP 代理,它应该可以工作,这里是 nginx on tcp proxy 的文档: https://docs.nginx.com/nginx/admin-guide/load-balancer/tcp-udp-load-balancer/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-02-02
      • 2021-12-20
      • 1970-01-01
      • 2013-09-06
      • 1970-01-01
      • 2017-09-19
      • 2018-06-04
      相关资源
      最近更新 更多