How to bind Elasticsearch 2.0 on both Loopback and Non-Loopback interfaces?

时间:2015-10-29 11:07:27

标签: elasticsearch elasticsearch-2.0

Starting from version 2.0 Elasticsearch binds only on the loopback interface by default (_local_ in terms of configuration).

The documentation says that there is a way to switch to another network, for example, _non_loopback_ binds to the first non-loopback interface. It works fine.

But I cannot figure out how do I combine these settings so that Elasticsearch binds on both loopback and non-loopback interfaces simultaneously?

PS. My reason is that I use Logstash on each Elasticsearch instance that connects to it via localhost, but I also want other Elasticsearch instances to see each other to form the cluster...

3 个答案:

答案 0 :(得分:38)

对于2.0,您需要使用

network.bind_host: 0

答案 1 :(得分:2)

转到

    button1.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            mMap.clear();
            if (button1.isShown()) {
                mMap.addMarker(new MarkerOptions().position(new LatLng(, )).title("").snippet("My Location").icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_launcher)));

            }
        }
    });

    button2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mMap.clear();
            if (button2.isShown()) {
                mMap.addMarker(new MarkerOptions().position(new LatLng()).title("").icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_launcher_hospital)));
                mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(), ));


            }
        }
    });

    button3.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mMap.clear();
            if (button3.isShown()) {
                mMap.addMarker(new MarkerOptions().position(new LatLng(`enter code here`)).title(" ").icon(BitmapDescriptorFactory.fromResource(R.mipmap.ic_launcher_busstop)));
                mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(), ));
            }
        }
    });

打开'<path_to_elasticsearch>/elasticsearch-2.3.4/config'

添加       elasticsearch.yml

现在检查elasticsearch正在使用哪个端口(默认为network.host: 0.0.0.0),转到防火墙入站规则并添加这些端口。

答案 2 :(得分:0)

从ElasticSearch 7.x开始,此配置再次更改。对于绑定到环回,本地和外部IP的简单单节点群集,您基本上可以这样做:

network.host: [_local_, _site_, _global_]
cluster.initial_master_nodes: node-1

文档here中介绍了网络主机设置时,here对群集节点设置进行了说明,尽管它没有说明如何为network.host分配多个值。

相关问题