Update ClusterClient documentation to include the new discovery feature #7265
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
When the Cluster Cannot Be Reached at All
Watching ClusterClient Actor Termination
It is possible to make the cluster client stop entirely if it cannot find a receptionist it can talk to within a configurable interval. This is configured with the
reconnect-timeout
, which defaults to off. This can be useful when initial contacts are provided from some kind of service registry, cluster node addresses are entirely dynamic and the entire cluster might shut down or crash, be restarted on new addresses. Since the client will be stopped in that case a monitoring actor can watch it and uponTerminate
a new set of initial contacts can be fetched and a new cluster client started.Contact Auto-Discovery Using Akka.Discovery
Note
This feature is currently considered as an advanced feature and is not currently compatible with Akka.Discovery Akka.Hosting extensions.
This feature should not be used until Akka.Management 1.5.26 is released.
This feature is added in Akka.NET 1.5.26. Instead of watching for actor termination manually, you can leverage Akka.Discovery to discover cluster client contact points inside a dynamic environment such as Kubernetes, AWS, or anywhere else with Azure Table
The HOCON configuration to set these are:
To enable contact auto-discovery, you will need to:
akka.cluster.client.use-initial-contacts-discovery
to true.akka.cluster.client.discovery.service-name
that matches the service name of the Akka.Discovery extension that you used:pod-label-selector
HOCON setting or theKubernetesDiscoveryOptions.PodLabelSelector
options property.akka.discovery.aws-api-ec2-tag-based.tag-key
HOCON setting or the Akka.HostingEc2ServiceDiscoveryOptions.TagKey
options property.akka.discovery.aws-api-ecs.tags
HOCON setting or the Akka.HostingEcsServiceDiscoveryOptions.Tags
options property.service-name
HOCON setting or theAkkaDiscoveryOptions.ServiceName
options property.akka.cluster.client.discovery.method
to a valid discovery method name listed underakka.discovery
.akka.cluster.client.discovery.actor-system-name
to the target cluster ActorSystem name.akka.cluster.client.discovery,port-name
if the discovery extension that you're using depends on port names.akka.cluster.client.discovery.receptionist-name
if you're using a non-default receptionist name.Using Akka.Discovery For Both Akka.Cluster.Tools.Client And Akka.Management.Cluster.Bootstrap
If you need to use Akka.Discovery with both ClusterClient AND ClusterBootstrap, you will have to make sure that you have TWO different Akka.Discovery settings living side-by-side under the
akka.discovery
HOCON setting object.Akka.Discovery.KubernetesApi Example
In your YAML file:
metadata.labels.app: cluster
, then you will need to add another tag to the instances that runs the Receptionists, e.g.metadata.labels.contact: cluster-client
like so:In your cluster client Akka.NET node HOCON settings:
akka.discovery.kubernetes-api
HOCON section and paste it above or under the original settings. You can also copy the value from hereakka.discovery.kubernetes-api-cluster-client
. The key name does not matter, what matters is that the name does not collide with any other setting section name underakka.discovery
.akka.discovery.kubernetes-api-cluster-client.pod-label-selector
to "contact={0}" to match what we have in the YAML file.akka.cluster.client.discovery.service-name
to "cluster-client" to match what we have in the YAML file.akka.cluster.client.discovery.port-name
value to "akka-remote" to match what we have in the YAML file.akka.discovery.method
HOCON value to "kubernetes-api", this is the discovery extension that will be used by ClusterBootstrap.akka.cluster.client.discovery.method
value from "<method>" to "kubernetes-api-cluster-client", this is the discovery extension that will be used by ClusterClient. If not set, this will default to the value set inakka.discovery.method
, which is NOT what we want.Akka.Discovery.Azure Example
In your cluster receptionist Akka.NET node HOCON settings:
akka.discovery.azure
HOCON section and paste it above or under the original settings. You can also copy the value from hereakka.discovery.azure-cluster-client
. The key name does not matter, what matters is that the name does not collide with any other setting section name underakka.discovery
.akka.discovery.azure-cluster-client.public-port
to the remoting port of the Akka.NET node.akka.discovery.azure-cluster-client.service-name
to "cluster-client". The name does not matter, what matters is that this name HAS to match the service name we'll be using inakka.cluster.client.discovery.service-name
.akka.discovery.azure-cluster-client.table-name
toakkaclusterreceptionists
to separate the discovery table from ClusterBootstrap entries.In your cluster client Akka.NET node HOCON settings:
akka.cluster.client.discovery.service-name
to "cluster-client" to match what we have in the receptionist node HOCON file.akka.discovery.method
HOCON value to "azure", this is the discovery extension that will be used by ClusterBootstrap.akka.cluster.client.discovery.method
value from "<method>" to "azure-cluster-client", this is the discovery extension that will be used by ClusterClient. If not set, this will default to the value set inakka.discovery.method
, which is NOT what we want.akka.discovery.azure-cluster-client.table-name
to match the table name with the receptionist side, it wasakkaclusterreceptionists
in our example aboveakka.cluster.client.discovery.service-name
to "cluster-client" to match what we have in the receptionist node HOCON file.akka.discovery.method
HOCON value to "azure".akka.cluster.client.discovery.method
value from "<method>" to "azure", this is the discovery extension that will be used by ClusterClient. If not set, this will default to the value set inakka.discovery.method
, which will be the same.akka.discovery.azure-cluster-client.table-name
to match the table name with the receptionist side, it wasakkaclusterreceptionists
in our example above.