1 Introduction

1.1 Concepts

Site ID is a random unique identifier of the node that persists between restarts and host name changes. Each node creates this identifier once and then never changes it.

By default, classy initializes site with a random value. Business applications can override this behavior by registering classy:on_node_init/2 hook containing a call to classy_node:maybe_init_the_site/1:

  classy:on_node_init(
    fun() ->
       classy_node:maybe_init_the_site(MySiteId)
    end,
    0)
  

Cluster ID is a unique random identifier of the cluster.

Each site starts in its very own cluster with a random ID. When a site joins a remote node, it inherits its cluster ID of the remote.

Run level is global system state derived from the configuration and the number of peers. It indicates “readiness” of the local site.

  1. stopped: Classy application itself is not running or is not ready.
  2. single: Classy application is ready to process cluster membership information, but the number of known peers is less than n_sites.
  3. cluster: the number of known peers is >= n_sites, but the number of connected peers is less than quorum.
  4. quorum: the number of connected peers satisfies the configuration. Site is fully connected and operational.

Unless the node is stopped abruptly (erlang:halt, kill, power loss), run levels always advance and retard in sequence.

Business applications can track the run level via classy:run_level/2 hook. This hook can, for example, activate or deactivate some business applications.


JavaScript license information