Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a remote proxy connection mode #49067

Open
14 of 16 tasks
Tim-Brooks opened this issue Nov 14, 2019 · 15 comments
Open
14 of 16 tasks

Implement a remote proxy connection mode #49067

Tim-Brooks opened this issue Nov 14, 2019 · 15 comments
Labels
:Distributed/Network Http and internode communication implementations >enhancement Meta Team:Distributed Meta label for distributed team

Comments

@Tim-Brooks
Copy link
Contributor

Tim-Brooks commented Nov 14, 2019

Summary

We are interested in implementing a proxy connection mode for remote cluster connections. Instead of sniffing the remote cluster and connecting directly to specific nodes, this connection mode will open single channel connections to the remote cluster with no regard for the identity of the remote node. This will allow an intermediate proxy to make the routing decisions.

Tasks

7.6.1/7.7

  • Update documentation for new sniff settings
  • Update documentation to expose new proxy settings

Future:

  • Deprecate generic seed node and max number of connections settings
  • Add setting upgraders for 7.x->8.0

Usage

To enable this mode the following settings must be configured:

// The mode defaults to sniff, so proxy must explicitly be configured
cluster.remote.test_remote_cluster.mode: "proxy"

// The proxy address is required
cluster.remote.test_remote_cluster.proxy_address: "localhost:9300"

// Optional, defaults to 18
cluster.remote.test_remote_cluster.proxy_socket_connections: 18

// Optional, defaults to disabled. If this is set, the Elasticsearch default 
// distribution TLS implementation will send the configured hostname in the 
// TLS SNI header.
cluster.remote.test_remote_cluster.server_name: "application.example.com"
@Tim-Brooks Tim-Brooks added >enhancement :Distributed/Network Http and internode communication implementations v8.0.0 v7.6.0 labels Nov 14, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (:Distributed/Network)

Tim-Brooks added a commit that referenced this issue Nov 22, 2019
This is related to #49067. This commit adds the simple connection
strategy settings and strategy mode setting to the cluster settings
registry. With these changes, the simple connection mode can be used.
Additionally, it adds validation to ensure that settings cannot be
misconfigured.
Tim-Brooks added a commit that referenced this issue Nov 25, 2019
This commit back ports three commits related to enabling the simple
connection strategy.

Allow simple connection strategy to be configured (#49066)

Currently the simple connection strategy only exists in the code. It
cannot be configured. This commit moves in the direction of allowing it
to be configured. It introduces settings for the addresses and socket
count. Additionally it introduces new settings for the sniff strategy
so that the more generic number of connections and seed node settings
can be deprecated.

The simple settings are not yet registered as the registration is
dependent on follow-up work to validate the settings.

Ensure at least 1 seed configured in remote test (#49389)

This fixes #49384. Currently when we select a random subset of seed
nodes from a list, it is possible for 0 seeds to be selected. This test
depends on at least 1 seed being selected.

Add the simple strategy to cluster settings (#49414)

This is related to #49067. This commit adds the simple connection
strategy settings and strategy mode setting to the cluster settings
registry. With these changes, the simple connection mode can be used.
Additionally, it adds validation to ensure that settings cannot be
misconfigured.
Tim-Brooks added a commit to Tim-Brooks/elasticsearch that referenced this issue Nov 28, 2019
This is related to elastic#49067. As part of this work a new sniff number of
node connections setting, a simple addresses setting, and a simple
number of sockets setting have been added. This commit ensures that
these settings are properly hooked up to support dynamic updates.
Tim-Brooks added a commit that referenced this issue Dec 3, 2019
This is related to #49067. As part of this work a new sniff number of
node connections setting, a simple addresses setting, and a simple
number of sockets setting have been added. This commit ensures that
these settings are properly hooked up to support dynamic updates.
Tim-Brooks added a commit to Tim-Brooks/elasticsearch that referenced this issue Dec 3, 2019
This is related to elastic#49067. As part of this work a new sniff number of
node connections setting, a simple addresses setting, and a simple
number of sockets setting have been added. This commit ensures that
these settings are properly hooked up to support dynamic updates.
Tim-Brooks added a commit that referenced this issue Dec 5, 2019
This is related to #49067. As part of this work a new sniff number of
node connections setting, a simple addresses setting, and a simple
number of sockets setting have been added. This commit ensures that
these settings are properly hooked up to support dynamic updates.
@Tim-Brooks Tim-Brooks changed the title Implement a simple remote connection mode Implement a remote proxy connection mode Dec 20, 2019
@polyfractal polyfractal added v7.7.0 and removed v7.6.0 labels Jan 15, 2020
SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this issue Jan 23, 2020
This is related to elastic#49067. As part of this work a new sniff number of
node connections setting, a simple addresses setting, and a simple
number of sockets setting have been added. This commit ensures that
these settings are properly hooked up to support dynamic updates.
@ywelsch ywelsch added the Meta label Jan 28, 2020
ywelsch added a commit that referenced this issue Feb 3, 2020
Adds more tests for the new "proxy" remote cluster connection mode, using a Docker-based
setup, as well as testing SNI-based routing using HAProxy.

- Checks that the new proxy mode can work in situations where the publish host of the nodes in
the remote cluster are not routable.
- Checks that the new proxy mode can work with clusters where nodes are hidden behind
HAProxy.
- Checks that the new proxy mode can work with clusters where nodes are hidden behind
HAProxy, using SNI to identify the nodes/cluster behind HAProxy.

Relates #49067
ywelsch added a commit that referenced this issue Feb 3, 2020
Adds more tests for the new "proxy" remote cluster connection mode, using a Docker-based
setup, as well as testing SNI-based routing using HAProxy.

- Checks that the new proxy mode can work in situations where the publish host of the nodes in
the remote cluster are not routable.
- Checks that the new proxy mode can work with clusters where nodes are hidden behind
HAProxy.
- Checks that the new proxy mode can work with clusters where nodes are hidden behind
HAProxy, using SNI to identify the nodes/cluster behind HAProxy.

Relates #49067
ywelsch added a commit that referenced this issue Feb 3, 2020
Adds more tests for the new "proxy" remote cluster connection mode, using a Docker-based
setup, as well as testing SNI-based routing using HAProxy.

- Checks that the new proxy mode can work in situations where the publish host of the nodes in
the remote cluster are not routable.
- Checks that the new proxy mode can work with clusters where nodes are hidden behind
HAProxy.
- Checks that the new proxy mode can work with clusters where nodes are hidden behind
HAProxy, using SNI to identify the nodes/cluster behind HAProxy.

Relates #49067
@jexertier
Copy link

From : https://discuss.elastic.co/t/documentation-to-link-remote-clusters-using-proxy/220229

When I try to find "proxy" in 7.6.0 remote clusters documentation I can't find any occurence, it seems that the documentation is not yet updated according to this issue.

The Usage section of this issue is unclear for me. I don't know where to begin to implement this. I have two clusters (localcluster_1 and remotecluster_2) on different locations running on Kubernetes deployed with ECK. Working fine.

  • What are the steps to link localcluster_1 to remotecluster_2 ? I guess the most important configuration part is taking place on remotecluster_2. elasticsearch.yml welcome for both cluster !

Tim-Brooks added a commit to Tim-Brooks/elasticsearch that referenced this issue Feb 25, 2020
@Tim-Brooks
Copy link
Contributor Author

@jexertier

The documentation for Elasticsearch in the process of being updated in #52779 for the next
release.

7.6 did go live with the functionality described in this PR and can be configured using the above settings.

The only two required settings are:

cluster.remote.test_remote_cluster.mode: "proxy"
cluster.remote.test_remote_cluster.proxy_address: "localhost:9300"

Similar to other remote cluster settings they can be configured in a yml file. However, those settings are limited to the node with the yml file. The most common mode of enablement for cluster wide remote connections is the settings update infrastructure.

These specific settings are pretty low-level though. They essentially require that you have a proxy in between your two Elasticsearch clusters. localcluster1 would open connections to this proxy and is dependent on this proxy routing those connections to remotecluster_2. It is designed for infrastructure setups where users do not want to expose remote cluster_2 ports to localcluster1. This is common in the Kubernetes case (I think using some type of proxy abstraction).

I think in your specific case you are looking to enable this on ECK. ECK I know has started or completed work to use this proxy mode to integrate remote cluster connections. I'll ping @pebrc here as he might be able to give you some direction on the ECK side.

@pebrc
Copy link

pebrc commented Feb 26, 2020

@tbrooks8 I responded on the discuss forum post linked above. We have some preliminary documentation describing how to use the new functionality in our master branch https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-remote-clusters.html

@alisonelizabeth
Copy link
Contributor

Would it make sense to align the naming for the remote cluster mode settings with the _remote/info API?

For example:

  • cluster.remote.${cluster_alias}.proxy_address currently maps to address. Should this be proxy_address?
  • cluster.remote.${cluster_alias}.proxy_socket_connections currently maps to max_socket_connections. Should this be max_proxy_socket_connections?

@fpytloun
Copy link

fpytloun commented Mar 4, 2020

I just tried proxy mode and found out that it does not support skip_unavailable option. It cannot be set if seeds are not set but seeds can't be set with mode: proxy.

My issue is that without this option, if some of remote clusters are offline, searches will fail. I am looking for option that will not break searches if some of remote clusters is not working.

@Tim-Brooks
Copy link
Contributor Author

@fpytloun Thanks for the report. This was fixed in #52829 and will be included in 7.6.1 and 7.7.

Tim-Brooks added a commit that referenced this issue Mar 9, 2020
Tim-Brooks added a commit that referenced this issue Mar 16, 2020
@rjernst rjernst added the Team:Distributed Meta label for distributed team label May 4, 2020
@ywelsch
Copy link
Contributor

ywelsch commented Jul 23, 2020

@tbrooks8 Can we close this?

@Tim-Brooks
Copy link
Contributor Author

I will look into the final two outstanding tasks soon. And then close.

@IASecurity
Copy link

IASecurity commented Dec 16, 2021

Hi there - we are faced with an issue using this proxy technology in our ECE setup - as we have ALB's fronting our environments.
The consequent connection to a proxy node - has to be a uninterrupted 2-way TLS handshake to a Proxy on Layer4, which we cant provide through an ALB.

I would like to suggest an alternative to providing a single Proxy - but instead enable the possibly to provide a list of proxies so that we gain high-availability across multiple regions without the need to setup an NLB to balance across multiple proxy nodes.
There is also the added benefit that Proxied connections wont have to leave the the VPC - and then wont add extra cost from having to cross a NAT Gateway.

Hope it makes sense.

@DaveCTurner
Copy link
Contributor

@IASecurity the proxy address is resolved afresh on each connection attempt so you can today provide multiple proxy addresses via DNS. That said, I can see why you might want Elasticsearch to handle multiple addresses itself so this seems like a reasonable feature request. Would you open a separate issue to suggest it?

@IASecurity
Copy link

You sir - have just saved us a lot of work and money :) - Not only do we not have to create more IaC for components and security groups ets. - but we also get to keep the 25Gbit connection speeds between our EC2, by not having to go over a NLB.
If Elasticsearch is trying to opportunistically reconnect all 18 connections defined in the Remote Clusters configuration - it is bound to reestablish those by simple DNS loadbalancing like you suggest. In that case i think the multiple destination handling in Elasticsearch for this scenario, might already be sufficient.

I just tried setting a DNS record up across 3 Proxy nodes - and that does work!

@IASecurity
Copy link

Thanks for this: #82366

@archoversight
Copy link

Is there any documentation on how to configure the proxy? Other than TCP pass-through so that mTLS continues to function, how do we do health checking? Is a simple connect() based health check enough? Is there some other endpoint or payload we can send to validate that the node is ready to receive connections?

@original-brownbear
Copy link
Member

@tbrooks8 anything left here or can we close this one now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed/Network Http and internode communication implementations >enhancement Meta Team:Distributed Meta label for distributed team
Projects
None yet
Development

No branches or pull requests