Cluster.Strategy.DynamicSrv (libcluster_dynamic_srv v1.0.0)

View Source

This implements a libcluster strategy that utilizes DNS SRV records in a generic way. The K8s SRV strategy is too prescriptive to use generically because of the way it formulates its SRV hostnames.

For this strategy to work the SRV records should be in the format of <node-name>.<service-domain-name>. This works with Consul by specifying the node-name as a label and the service-domain-name is service.consul by default.

You can read more about Consul's DNS SRV records here.

While this was implemented to work with Consul, it can be used with any DNS service that supports SRV records and tagging of the hostname.

Example Configuration:

config :libcluster,
  topologies: [
    dyn_srv: [
      strategy: Cluster.Strategy.DynamicSrv,
      config: [
        service: "my-service-name.service.consul"
      ]
    ]
  ]

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.