View Source Cluster.Strategy.Database (Libcluster DB v0.1.0)

This clustering strategy relies on nodes stored in a database.

You can have libcluster automatically connect nodes on startup for you by configuring the strategy like below:

config :libcluster,
  topologies: [
    db_config_example: [
      strategy: Cluster.Strategy.Database,
      config: [repo: MyApp.Repo, timeout: 30_000]
    ]
  ]

An optional timeout can be specified in the config. This is the timeout that will be used in the GenServer to connect the nodes. This defaults to :infinity meaning that the connection process will only happen when the worker is started. Any integer timeout will result in the connection process being triggered. In the example above, it has been configured for 30 seconds.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Add a node to the database for libcluster to connect to

Delete a node from the database for libcluster to disconnect from

Get a list of nodes and whether they're connected or not

Callback implementation for Cluster.Strategy.start_link/1.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Add a node to the database for libcluster to connect to

Delete a node from the database for libcluster to disconnect from

Get a list of nodes and whether they're connected or not

Callback implementation for Cluster.Strategy.start_link/1.