### libcluster Cluster.Supervisor.start_link/1 Source: https://hexdocs.pm/libcluster/changelog This function starts the Cluster.Supervisor, which in turn starts and manages the configured cluster strategies. It's the entry point for initializing libcluster in an application. ```Elixir Cluster.Supervisor.start_link(strategies: [Cluster.Strategy.Kubernetes]) ``` -------------------------------- ### libcluster Kubernetes Strategy: Example Configuration Source: https://hexdocs.pm/libcluster/changelog This provides a comprehensive example of configuring the Kubernetes strategy for libcluster. It includes settings for discovery method, polling interval, and other relevant options. ```Elixir config :libcluster, strategies: [ {Cluster.Strategy.Kubernetes, [basename: "my-app", polling_interval: 30_000]} ] ``` -------------------------------- ### Start Cluster Supervisor with Epmd Strategy Source: https://hexdocs.pm/libcluster/index This Elixir code demonstrates how to configure and start the `Cluster.Supervisor` in an Elixir application's supervision tree. It uses the `Cluster.Strategy.Epmd` strategy with a predefined list of hosts. ```elixir defmodule MyApp.Appdouse do use Application def start(_type, _args) do topologies = [ example: [ strategy: Cluster.Strategy.Epmd, config: [hosts: [:"a@127.0.0.1", :"b@127.0.0.1"]] ] ] children = [ {Cluster.Supervisor, [topologies, [name: MyApp.ClusterSupervisor]]}, # ..other children.. ] Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor) end end ``` -------------------------------- ### libcluster Kubernetes DNSSRV Strategy: Example Configuration Source: https://hexdocs.pm/libcluster/changelog This provides an example configuration for the Kubernetes DNSSRV strategy in libcluster. It demonstrates how to set the discovery method (domain-based) and polling interval. ```Elixir config :libcluster, strategies: [ {Cluster.Strategy.Kubernetes.DNSSRV, [domain: "_elixir._tcp.my-svc.svc.cluster.local", polling_interval: 30_000]} ] ``` -------------------------------- ### Start Cluster Supervisor with Epmd Strategy Source: https://hexdocs.pm/libcluster/readme This Elixir code demonstrates how to configure and start the `Cluster.Supervisor` in an Elixir application's supervision tree. It uses the `Cluster.Strategy.Epmd` strategy with a predefined list of hosts. ```elixir defmodule MyApp.Appdouse do use Application def start(_type, _args) do topologies = [ example: [ strategy: Cluster.Strategy.Epmd, config: [hosts: [:"a@127.0.0.1", :"b@127.0.0.1"]] ] ] children = [ {Cluster.Supervisor, [topologies, [name: MyApp.ClusterSupervisor]]}, # ..other children.. ] Supervisor.start_link(children, strategy: :one_for_one, name: MyApp.Supervisor) end end ``` -------------------------------- ### libcluster Kubernetes DNS Strategy: Example Configuration Source: https://hexdocs.pm/libcluster/changelog This provides an example configuration for the Kubernetes DNS strategy in libcluster. It demonstrates how to set the discovery method and polling interval for DNS-based node discovery. ```Elixir config :libcluster, strategies: [ {Cluster.Strategy.Kubernetes.DNS, [basename: "my-service", polling_interval: 45_000]} ] ``` -------------------------------- ### libcluster ErlangHosts Strategy: Start link Source: https://hexdocs.pm/libcluster/changelog This function is used to start the ErlangHosts strategy supervisor, which manages the connections to nodes specified in the Erlang.hosts file. It ensures the strategy is running and connected. ```Elixir Cluster.Strategy.ErlangHosts.start_link() ``` -------------------------------- ### libcluster: Cluster.Strategy.ErlangHosts start_link Source: https://hexdocs.pm/libcluster/api-reference Starts the Cluster.Strategy.ErlangHosts process. This strategy uses a .hosts.erlang file to manage node connections. ```Elixir Cluster.Strategy.ErlangHosts.start_link(opts()) ``` -------------------------------- ### libcluster: Cluster.Strategy.LocalEpmd start_link Source: https://hexdocs.pm/libcluster/api-reference Starts the Cluster.Strategy.LocalEpmd process. This strategy relies on Erlang's built-in distribution protocol. ```Elixir Cluster.Strategy.LocalEpmd.start_link(opts()) ``` -------------------------------- ### Cluster.Supervisor start_link/1 Source: https://hexdocs.pm/libcluster/Cluster Starts a new instance of the Cluster.Supervisor. It accepts configuration and optional supervisor arguments, allowing for flexible integration into supervision trees. ```Elixir start_link(args) ``` -------------------------------- ### libcluster: Cluster.Strategy.Kubernetes start_link Source: https://hexdocs.pm/libcluster/api-reference Starts the Cluster.Strategy.Kubernetes process. This strategy fetches endpoint or pod information from Kubernetes to form clusters. ```Elixir Cluster.Strategy.Kubernetes.start_link(opts()) ``` -------------------------------- ### libcluster Cluster.Strategy.start_link/1 Source: https://hexdocs.pm/libcluster/changelog This function starts a cluster strategy process. It takes the strategy module and its configuration as arguments and returns a tuple indicating success or failure. ```Elixir Cluster.Strategy.start_link(Cluster.Strategy.DNSPoll, [poll_interval: 5000]) ``` -------------------------------- ### libcluster: Cluster.Strategy.Rancher start_link Source: https://hexdocs.pm/libcluster/api-reference Starts the Cluster.Strategy.Rancher process. This strategy queries the Rancher metadata API to connect nodes within the same service. ```Elixir Cluster.Strategy.Rancher.start_link(opts()) ``` -------------------------------- ### libcluster: Cluster.Strategy.DNSPoll start_link Source: https://hexdocs.pm/libcluster/api-reference Starts the Cluster.Strategy.DNSPoll process. This strategy polls DNS for nodes matching a specific pattern and connects them. ```Elixir Cluster.Strategy.DNSPoll.start_link(opts()) ``` -------------------------------- ### libcluster: Cluster.Strategy.Kubernetes.DNSSRV start_link Source: https://hexdocs.pm/libcluster/api-reference Starts the Cluster.Strategy.Kubernetes.DNSSRV process. This strategy uses SRV queries for a headless service in Kubernetes to discover nodes. ```Elixir Cluster.Strategy.Kubernetes.DNSSRV.start_link(opts()) ``` -------------------------------- ### libcluster: Cluster.Strategy.Gossip start_link Source: https://hexdocs.pm/libcluster/api-reference Starts the Cluster.Strategy.Gossip process. This strategy uses multicast UDP to discover and connect nodes. ```Elixir Cluster.Strategy.Gossip.start_link(opts()) ``` -------------------------------- ### libcluster: Cluster.Strategy.Kubernetes.DNS start_link Source: https://hexdocs.pm/libcluster/api-reference Starts the Cluster.Strategy.Kubernetes.DNS process. This strategy uses a headless service in Kubernetes to discover nodes via DNS. ```Elixir Cluster.Strategy.Kubernetes.DNS.start_link(opts()) ``` -------------------------------- ### Install libcluster Dependency Source: https://hexdocs.pm/libcluster/index This code snippet shows how to add libcluster as a dependency in an Elixir project using `mix.exs`. It specifies the version constraint for libcluster. ```elixir defp deps do [{:libcluster, "~> MAJ.MIN"}] end ``` -------------------------------- ### Cluster.Supervisor child_spec/1 Source: https://hexdocs.pm/libcluster/Cluster Provides the child specification for starting the Cluster.Supervisor module under a supervisor. This is a standard Elixir way to define supervised processes. ```Elixir child_spec(init_arg) ``` -------------------------------- ### Install libcluster Dependency Source: https://hexdocs.pm/libcluster/readme This code snippet shows how to add libcluster as a dependency in an Elixir project using `mix.exs`. It specifies the version constraint for libcluster. ```elixir defp deps do [{:libcluster, "~> MAJ.MIN"}] end ``` -------------------------------- ### Elixir child_spec for Supervisor Source: https://hexdocs.pm/libcluster/Cluster.Strategy.Kubernetes Provides the `child_spec/1` function for the libcluster module, which returns a supervisor child specification. This allows the module to be started and managed under an Elixir supervisor. ```Elixir child_spec(init_arg) Returns a specification to start this module under a supervisor. See `Supervisor`. ``` -------------------------------- ### libcluster Epmd Strategy: Specify hosts to connect to Source: https://hexdocs.pm/libcluster/changelog This configuration option allows you to specify a list of hosts that the Epmd strategy should attempt to connect to when it starts. This is useful for pre-defining known nodes. ```Elixir config :libcluster, Cluster.Strategy.Epmd, hosts: ["node1@host1", "node2@host2"] ``` -------------------------------- ### Extract Topology Information using Kubernetes DNS SRV Source: https://hexdocs.pm/libcluster/Cluster.Strategy.Kubernetes Shows an example of how the Kubernetes DNS SRV strategy extracts topology information by querying DNS for a headless service. It includes the output of a `dig` command for SRV records, illustrating the multiple entries returned for a headless service. ```Shell $ hostname -f myapp-1.myapp-headless.default.svc.cluster.local # An SRV query for a headless service returns multiple entries $ dig SRV myapp-headless.default.svc.cluster.local ; <<>> DiG 9.14.3 <<>> SRV myapp-headless.default.svc.cluster.local ;; global options: +cmd ;; Got answer: ;; WARNING: .local is reserved for Multicast DNS ;; You are currently testing what happens when an mDNS query is leaked to DNS ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7169 ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 2 ;; QUESTION SECTION: ;myapp-headless.default.svc.cluster.local. IN SRV ;; ANSWER SECTION: myapp-headless.default.svc.cluster.local. 30 IN SRV 10 50 0 myapp-0.myapp-headless.default.svc.cluster.local. myapp-headless.default.svc.cluster.local. 30 IN SRV 10 50 0 myapp-1.myapp-headless.default.svc.cluster.local. ;; ADDITIONAL SECTION: myapp-0.myapp-headless.default.svc.cluster.local. 30 IN A 10.1.0.95 myapp--1.myapp-headless.default.svc.cluster.local. 30 IN A 10.1.0.96 ;; Query time: 0 msec ;; SERVER: 10.96.0.10#53(10.96.0.10) ;; WHEN: Wed Jul 03 11:55:27 UTC 2019 ;; MSG SIZE rcvd: 167 ``` -------------------------------- ### libcluster Cluster.Supervisor.child_spec/1 Source: https://hexdocs.pm/libcluster/changelog This function generates a child specification for the Cluster.Supervisor. This supervisor is responsible for managing the overall libcluster process, including starting and stopping strategies. ```Elixir Cluster.Supervisor.child_spec(strategies: [Cluster.Strategy.Epmd]) ``` -------------------------------- ### libcluster Kubernetes Strategy: Getting ip_or_domain Source: https://hexdocs.pm/libcluster/changelog This section explains how to configure the Kubernetes strategy to discover nodes using their IP addresses or domain names. It covers the options required for IP-based or domain-based discovery. ```Elixir config :libcluster, Cluster.Strategy.Kubernetes, # Example: Use pod IP addresses for discovery ip_or_domain: :pod_ip ``` -------------------------------- ### libcluster Kubernetes DNS Strategy: Getting ip Source: https://hexdocs.pm/libcluster/changelog This section explains how to configure the Kubernetes DNS strategy to discover nodes by their IP addresses. It covers the necessary settings for IP-based discovery within a Kubernetes environment. ```Elixir config :libcluster, Cluster.Strategy.Kubernetes.DNS, # Example: Use pod IP addresses ip: :pod_ip ``` -------------------------------- ### Configure libcluster Polling Interval Source: https://hexdocs.pm/libcluster/Cluster.Strategy.Kubernetes Demonstrates how to configure the polling interval for topology synchronization in libcluster using an Elixir configuration. The example sets the polling interval to 10,000 milliseconds (10 seconds) for the Kubernetes DNS SRV strategy. ```Elixir config:libcluster,topologies:[erlang_nodes_in_k8s:[strategy:Elixir.Cluster.Strategy.Kubernetes.DNSSRV,config:[service:"myapp-headless",application_name:"myapp",namespace:"default",polling_interval:10_000]]] ``` -------------------------------- ### libcluster Cluster.Strategy.child_spec/1 Source: https://hexdocs.pm/libcluster/changelog This function generates a child specification for a given cluster strategy. This specification is used when starting the strategy as part of a supervision tree in Elixir. ```Elixir Cluster.Strategy.child_spec(Cluster.Strategy.Kubernetes) ``` -------------------------------- ### libcluster Kubernetes Strategy: Getting basename Source: https://hexdocs.pm/libcluster/changelog This section details how to configure the Kubernetes strategy to discover nodes based on their base names. It outlines the necessary configuration options for this specific discovery method. ```Elixir config :libcluster, Cluster.Strategy.Kubernetes, # Example: Use the service name as the base name basename: "my-elixir-service" ``` -------------------------------- ### libcluster Kubernetes DNSSRV Strategy: Getting domain Source: https://hexdocs.pm/libcluster/changelog This section explains how to configure the Kubernetes DNSSRV strategy to discover nodes using specific domain names. It covers the settings for SRV record lookups based on provided domain information. ```Elixir config :libcluster, Cluster.Strategy.Kubernetes.DNSSRV, # Example: Specify a custom domain for SRV records domain: "_elixir._tcp.my-service.my-namespace.svc.cluster.local" ``` -------------------------------- ### libcluster Kubernetes DNS Strategy: Getting basename Source: https://hexdocs.pm/libcluster/changelog This section details the configuration for the Kubernetes DNS strategy to discover nodes using their base names. It specifies how the strategy should interpret Kubernetes service names. ```Elixir config :libcluster, Cluster.Strategy.Kubernetes.DNS, # Example: Use the Kubernetes service name basename: "my-elixir-service" ``` -------------------------------- ### libcluster Kubernetes DNSSRV Strategy: Getting basename Source: https://hexdocs.pm/libcluster/changelog This section details the configuration for the Kubernetes DNSSRV strategy to discover nodes using their base names. It specifies how the strategy should interpret Kubernetes service names for SRV record lookups. ```Elixir config :libcluster, Cluster.Strategy.Kubernetes.DNSSRV, # Example: Use the Kubernetes service name basename: "my-elixir-service" ``` -------------------------------- ### libcluster Gossip Strategy: Multicast Interface Source: https://hexdocs.pm/libcluster/changelog This configuration option specifies the network interface to be used for multicast communication in the Gossip strategy. This is important for ensuring nodes can discover each other in specific network setups. ```Elixir config :libcluster, Cluster.Strategy.Gossip, multicast_interface: {192, 168, 1, 100} ``` -------------------------------- ### Supervising Topologies with Cluster.Supervisor Source: https://hexdocs.pm/libcluster/Cluster Demonstrates how to supervise configured topologies within an Elixir application's supervision tree using Cluster.Supervisor. It shows manual configuration and the alternative of using Mix configuration. ```Elixir defmodule MyApp.AppdouseApplicationdefstart(_type,_args)dotopologies=[example:[strategy:Cluster.Strategy.Epmd,config:[hosts:[:"a@127.0.0.1",:"b@127.0.0.1"]],]]children=[{Cluster.Supervisor,[topologies:[name:MyApp.ClusterSupervisor]]},..otherchildren..]Supervisor.start_link(children,strategy::one_for_one,name:MyApp.Supervisor)endendcopy ``` ```Elixir config:libcluster,topologies:[example:[...]]copy ``` -------------------------------- ### Configure libcluster in Mix Config Source: https://hexdocs.pm/libcluster/index Demonstrates how to configure libcluster using a Mix configuration file (`config.exs`). This involves defining topologies and specifying the clustering strategy, connection, disconnection, and node listing functions. The configuration is then passed to the `Cluster.Supervisor` module. ```Elixir config :libcluster, topologies: [ epmd_example: [ # The selected clustering strategy. Required. strategy: Cluster.Strategy.Epmd, # Configuration for the provided strategy. Optional. config: [hosts: [:"a@127.0.0.1", :"b@127.0.0.1"]], # The function to use for connecting nodes. The node # name will be appended to the argument list. Optional connect: {:net_kernel, :connect_node, []}, # The function to use for disconnecting nodes. The node # name will be appended to the argument list. Optional disconnect: {:erlang, :disconnect_node, []}, # The function to use for listing nodes. # This function must return a list of node names. Optional list_nodes: {:erlang, :nodes, [:connected]}, ], # more topologies can be added ... gossip_example: [ # ... ] ] ``` -------------------------------- ### Configure libcluster in Mix Config Source: https://hexdocs.pm/libcluster/readme Demonstrates how to configure libcluster using a Mix configuration file (`config.exs`). This involves defining topologies and specifying the clustering strategy, connection, disconnection, and node listing functions. The configuration is then passed to the `Cluster.Supervisor` module. ```Elixir config :libcluster, topologies: [ epmd_example: [ # The selected clustering strategy. Required. strategy: Cluster.Strategy.Epmd, # Configuration for the provided strategy. Optional. config: [hosts: [:"a@127.0.0.1", :"b@127.0.0.1"]], # The function to use for connecting nodes. The node # name will be appended to the argument list. Optional connect: {:net_kernel, :connect_node, []}, # The function to use for disconnecting nodes. The node # name will be appended to the argument list. Optional disconnect: {:erlang, :disconnect_node, []}, # The function to use for listing nodes. # This function must return a list of node names. Optional list_nodes: {:erlang, :nodes, [:connected]}, ], # more topologies can be added ... gossip_example: [ # ... ] ] ``` -------------------------------- ### Kubernetes StatefulSet and Headless Service Configuration Source: https://hexdocs.pm/libcluster/Cluster.Strategy.Kubernetes This snippet shows a Kubernetes Service definition for a headless service and a StatefulSet configuration. The headless service allows pods to be discovered via DNS, and the StatefulSet ensures stable network identifiers for pods, which is crucial for the Cluster.Strategy.Kubernetes.DNSSRV strategy. ```yaml apiVersion: v1 kind: Service metadata: name: "myapp-headless" labels: app: myapp spec: ports: - port: 4000 name: web clusterIP: None selector: app: myapp --- apiVersion: apps/v1 kind: StatefulSet metadata: name: myapp spec: serviceName: "myapp-headless" replicas: 2 selector: matchLabels: app: myapp template: metadata: labels: app: myapp spec: containers: - name: myapp image: myapp:v1.0.0 imagePullPolicy: Always ports: - containerPort: 4000 name: http protocol: TCPcopy ``` -------------------------------- ### libcluster Cluster.Strategy.connect_nodes/4 Source: https://hexdocs.pm/libcluster/changelog This function attempts to establish connections to a list of nodes. It takes the current node, the list of nodes to connect to, and connection options as arguments. ```Elixir Cluster.Strategy.connect_nodes(self(), nodes_to_connect, [:longnames]) ``` -------------------------------- ### Configure Erlang Node Name for Mix Releases Source: https://hexdocs.pm/libcluster/Cluster.Strategy.Kubernetes This snippet demonstrates how to configure the Erlang node name for a mix release by setting the RELEASE_DISTRIBUTION and RELEASE_NODE environment variables. It uses a shell script snippet that dynamically sets the node name based on the release name and the pod's fully qualified domain name (hostname -f). ```bash # rel/env.sh.eex export RELEASE_DISTRIBUTION=name export RELEASE_NODE=<%=@release.name%>@$(hostname-f) copy ``` -------------------------------- ### libcluster LocalEpmd Strategy: Uses epmd for local discovery Source: https://hexdocs.pm/libcluster/changelog The LocalEpmd strategy utilizes the standard Erlang port mapper daemon (epmd) to discover nodes running on the local host. This is a straightforward method for local cluster management. ```Elixir config :libcluster, strategies: [ {Cluster.Strategy.LocalEpmd, []} ] ``` -------------------------------- ### libcluster: Cluster.Strategy.ErlangHosts child_spec Source: https://hexdocs.pm/libcluster/api-reference Provides the child_spec for the Cluster.Strategy.ErlangHosts. This strategy uses a .hosts.erlang file to manage node connections. ```Elixir Cluster.Strategy.ErlangHosts.child_spec(opts()) ``` -------------------------------- ### Elixir Cluster.Strategy.State Type Definition Source: https://hexdocs.pm/libcluster/Cluster.Strategy Defines the structure for the state of a libcluster strategy. It includes configuration, connection and disconnection callbacks, node listing functions, metadata, and topology information. ```Elixir @type t() :: %Cluster.Strategy.State{ config: [{atom(), term()}], connect: {module(), atom(), [term()]}, disconnect: {module(), atom(), [term()]}, list_nodes: {module(), atom(), [:connected] | [:connected | [any()]]}, meta: term(), topology: atom() } ``` -------------------------------- ### libcluster Configuration: Telemetry events for node connect/disconnect Source: https://hexdocs.pm/libcluster/changelog This update introduces telemetry events that can be used to track node connections and disconnections. This allows for monitoring and analysis of cluster membership changes. ```Elixir config :libcluster, :telemetry_options, node_connect: true, node_disconnect: true ``` -------------------------------- ### libcluster Rancher Strategy: Clustering Source: https://hexdocs.pm/libcluster/changelog This section describes the integration of libcluster with the Rancher container platform. It outlines how libcluster can discover and manage Elixir nodes within a Rancher environment. ```Elixir config :libcluster, strategies: [ {Cluster.Strategy.Rancher, []} ] ``` -------------------------------- ### libcluster: Cluster.Strategy.Kubernetes.DNSSRV child_spec Source: https://hexdocs.pm/libcluster/api-reference Provides the child_spec for the Cluster.Strategy.Kubernetes.DNSSRV. This strategy uses SRV queries for a headless service in Kubernetes to discover nodes. ```Elixir Cluster.Strategy.Kubernetes.DNSSRV.child_spec(opts()) ``` -------------------------------- ### libcluster: Cluster.Strategy.Kubernetes child_spec Source: https://hexdocs.pm/libcluster/api-reference Provides the child_spec for the Cluster.Strategy.Kubernetes. This strategy fetches endpoint or pod information from Kubernetes to form clusters. ```Elixir Cluster.Strategy.Kubernetes.child_spec(opts()) ``` -------------------------------- ### libcluster: Cluster.Strategy.Kubernetes.DNS child_spec Source: https://hexdocs.pm/libcluster/api-reference Provides the child_spec for the Cluster.Strategy.Kubernetes.DNS. This strategy uses a headless service in Kubernetes to discover nodes via DNS. ```Elixir Cluster.Strategy.Kubernetes.DNS.child_spec(opts()) ``` -------------------------------- ### libcluster: Cluster.Supervisor child_spec Source: https://hexdocs.pm/libcluster/api-reference Provides the child_spec for the Cluster.Supervisor, which is used to supervise configured topologies. This is designed to be integrated into an existing supervision tree. ```Elixir Cluster.Supervisor.child_spec(topology()) ``` -------------------------------- ### libcluster: Cluster.Strategy.Rancher child_spec Source: https://hexdocs.pm/libcluster/api-reference Provides the child_spec for the Cluster.Strategy.Rancher. This strategy queries the Rancher metadata API to connect nodes within the same service. ```Elixir Cluster.Strategy.Rancher.child_spec(opts()) ``` -------------------------------- ### libcluster: Cluster.Strategy.connect_nodes Source: https://hexdocs.pm/libcluster/api-reference Connects to a list of nodes. This function is part of the Cluster.Strategy behavior. ```Elixir Cluster.Strategy.connect_nodes(nodes(), node(), timeout(), strategy_name()) ``` -------------------------------- ### libcluster: Cluster.Strategy.DNSPoll child_spec Source: https://hexdocs.pm/libcluster/api-reference Provides the child_spec for the Cluster.Strategy.DNSPoll. This strategy polls DNS for nodes matching a specific pattern and connects them. ```Elixir Cluster.Strategy.DNSPoll.child_spec(opts()) ``` -------------------------------- ### libcluster: Cluster.Strategy.Epmd child_spec Source: https://hexdocs.pm/libcluster/api-reference Provides the child_spec for the Cluster.Strategy.Epmd. This strategy relies on Erlang's built-in distribution protocol. ```Elixir Cluster.Strategy.Epmd.child_spec(opts()) ``` -------------------------------- ### libcluster: Cluster.Strategy.DNSPoll lookup_all_ips Source: https://hexdocs.pm/libcluster/api-reference Looks up all IP addresses for a given hostname. This is used by the DNSPoll strategy to discover nodes. ```Elixir Cluster.Strategy.DNSPoll.lookup_all_ips(hostname()) ``` -------------------------------- ### libcluster Kubernetes DNSSRV Strategy: Polling Interval Source: https://hexdocs.pm/libcluster/changelog This section describes how to configure the polling interval for the Kubernetes DNSSRV strategy. This setting controls how often the strategy queries DNS for SRV record updates. ```Elixir config :libcluster, Cluster.Strategy.Kubernetes.DNSSRV, polling_interval: 60_000 # Poll every 60 seconds ``` -------------------------------- ### libcluster: Cluster.Strategy.Gossip child_spec Source: https://hexdocs.pm/libcluster/api-reference Provides the child_spec for the Cluster.Strategy.Gossip. This strategy uses multicast UDP to discover and connect nodes. ```Elixir Cluster.Strategy.Gossip.child_spec(opts()) ``` -------------------------------- ### libcluster Kubernetes DNS Strategy: Polling Interval Source: https://hexdocs.pm/libcluster/changelog This section describes how to configure the polling interval for the Kubernetes DNS strategy. This setting controls the frequency of checks for updates in the Kubernetes DNS records. ```Elixir config :libcluster, Cluster.Strategy.Kubernetes.DNS, polling_interval: 20_000 # Poll every 20 seconds ``` -------------------------------- ### libcluster Configuration: Kubernetes use cached resources option Source: https://hexdocs.pm/libcluster/changelog This option allows the Kubernetes strategy to utilize cached resource information, potentially improving performance by reducing direct API calls to the Kubernetes cluster. ```Elixir config :libcluster, Cluster.Strategy.Kubernetes, use_cached_resources: true ``` -------------------------------- ### libcluster Configuration: Epmd strategy reconnect after failures Source: https://hexdocs.pm/libcluster/changelog This configuration change enables the Epmd strategy to automatically attempt reconnection to nodes after experiencing connection failures, enhancing cluster stability. ```Elixir config :libcluster, Cluster.Strategy.Epmd, reconnect_after_failure: true ``` -------------------------------- ### libcluster Epmd Strategy: Allow reconnect after failures Source: https://hexdocs.pm/libcluster/changelog This update allows the Epmd strategy to automatically attempt to reconnect to nodes even after experiencing connection failures. This enhances the resilience of the cluster. ```Elixir config :libcluster, Cluster.Strategy.Epmd, # The default is true, so no explicit configuration is needed to enable reconnection. ``` -------------------------------- ### libcluster Kubernetes Strategy: Polling Interval Source: https://hexdocs.pm/libcluster/changelog This section describes how to set the polling interval for the Kubernetes strategy. This interval determines how frequently the strategy checks for changes in the Kubernetes cluster to update the node list. ```Elixir config :libcluster, Cluster.Strategy.Kubernetes, polling_interval: 15_000 # Poll every 15 seconds ``` -------------------------------- ### libcluster Configuration: Detect Self Signed Certificate Authority for Kubernetes Source: https://hexdocs.pm/libcluster/changelog This configuration allows the Kubernetes strategy to trust self-signed certificate authorities when connecting to the Kubernetes API. This is often necessary in development or private cluster environments. ```Elixir config :libcluster, Cluster.Strategy.Kubernetes, cacertfile: "/path/to/your/ca.crt" ``` -------------------------------- ### libcluster DNSPoll Strategy: Lookup all IPs Source: https://hexdocs.pm/libcluster/changelog This function is used within the DNSPoll strategy to retrieve all IP addresses associated with a given hostname. It's a core part of how this strategy discovers nodes via DNS. ```Elixir Cluster.Strategy.DNSPoll.lookup_all_ips("my-service.example.com") ``` -------------------------------- ### libcluster Configuration: Default multicast address change Source: https://hexdocs.pm/libcluster/changelog This changelog entry notes a change in the default multicast address used by the Gossip strategy. The address was updated from 230.1.1.251 to 233.252.1.32 for improved compatibility or performance. ```Elixir config :libcluster, Cluster.Strategy.Gossip, multicast_address: "233.252.1.32" # New default ``` -------------------------------- ### libcluster: Cluster.Strategy.difference Source: https://hexdocs.pm/libcluster/api-reference Calculates the difference between two lists of nodes. This function is part of the Cluster.Strategy behavior. ```Elixir Cluster.Strategy.difference(list1(), list2()) ``` -------------------------------- ### libcluster Cluster.Strategy.disconnect_nodes/4 Source: https://hexdocs.pm/libcluster/changelog This function attempts to disconnect from a list of nodes. It takes the current node, the list of nodes to disconnect from, and disconnection options as arguments. ```Elixir Cluster.Strategy.disconnect_nodes(self(), nodes_to_disconnect, []) ``` -------------------------------- ### libcluster Cluster.Strategy.difference/2 Source: https://hexdocs.pm/libcluster/changelog This function calculates the difference between two lists of nodes, returning the nodes that are present in the first list but not in the second. It's useful for identifying new or removed nodes. ```Elixir Cluster.Strategy.difference(current_nodes, discovered_nodes) ``` -------------------------------- ### libcluster Cluster.Strategy.intersection/2 Source: https://hexdocs.pm/libcluster/changelog This function calculates the intersection of two lists of nodes, returning the nodes that are common to both lists. This can be used to find nodes that are both currently connected and discovered. ```Elixir Cluster.Strategy.intersection(current_nodes, discovered_nodes) ``` -------------------------------- ### libcluster: Cluster.Strategy.intersection Source: https://hexdocs.pm/libcluster/api-reference Calculates the intersection of two lists of nodes. This function is part of the Cluster.Strategy behavior. ```Elixir Cluster.Strategy.intersection(list1(), list2()) ``` -------------------------------- ### libcluster: Cluster.Strategy.disconnect_nodes Source: https://hexdocs.pm/libcluster/api-reference Disconnects from a list of nodes. This function is part of the Cluster.Strategy behavior. ```Elixir Cluster.Strategy.disconnect_nodes(nodes(), node(), timeout(), strategy_name()) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.