Skip to content

Version v3.7.0 of the documentation is no longer actively maintained. The site that you are currently viewing is an archived snapshot. For up-to-date documentation, see the latest version.

Configure

node identity, dns, vip, data dir, and haproxy services

You don’t need to define node cluster and node instances explicitly. It is often implied by other database module’s cluster definition. If you define a PGSQL cluster, it defines a node cluster implicitly.

But there are some cases where you may want to use explicit named node clusters / instances. Such as running node groups for dedicated purpose (e.g., haproxy groups, node buffer pool, etc…)


Identity Parameters

Pigsty uses node’s primary IPv4 address (inventory_hostname) as its identity.

Name Type Level Necessity Comment
inventory_hostname ip - Required Node IP
nodename string I Optional Node Name
node_cluster string C Optional Node cluster name

The nodename & node_cluster can be used as optional secondary identity for monitoring purpose.

node cluster example
node-test:
  hosts:
    10.10.10.11: { nodename: node-test-1 }
    10.10.10.12: { nodename: node-test-2 }
    10.10.10.13: { nodename: node-test-3 }
  vars:
    node_cluster: node-test

This can be useful when you just want to monitor these nodes rather than running database on them.


Borrowed Identity

Because Pigsty is using a 1:1 mapping between NODE and PG instance (there’s only one PG instance per node), the node’s identity can be borrowed from corresponding PG instances:

Name Label Level Borrowed Identity Comment
nodename ins I {{ pg_cluster }}-{{ pg_seq }} PG Instance Name
node_cluster cls C {{ pg_cluster }} PG Cluster Name

This is default behavior, it’s convenient to have PG & NODE with the same cls / ins identity labels in the monitoring system. This can be disabled by overwriting the node_id_from_pg param to false

If there’s no corresponding PG instance defined, and no explicit nodename & node_cluster defined, the node will be labeled with cls as nodes and ins as the current hostname.


SSH Connection

The inventory_hostname is used by Ansible to connect to the node via SSH.

If your node cannot be simply access via ssh <inventory_hostname>, ssh alias and more ansible conn param (even a different IP) can be used. But the inventory_hostname is still the core identity of the node.

ssh param example
node-test:
  hosts:
    10.10.10.11: { nodename: node-test-1 , ansible_host: node-1 }
    10.10.10.12: { nodename: node-test-2 , ansible_host: 192.168.0.1 , ansible_port: 2222 , ansible_user: root }
  vars:
    node_cluster: node-test