Skip to content

Add-on clusters

Deploy multi-host add-on clusters with one inventory group per type — shared secrets and TLS material, quorum layouts and lifecycle

The addon_<type>_cluster inventory groups deploy one cluster-capable add-on across several hosts. They are the multi-host companion of Add-ons: the entry fields (type, name, state, params, args, clean_data, force, autostart) are the same, but the host lists, peer arguments and shared secrets are derived from the inventory instead of being written per host.

The groups are deliberately not a “deploy everything” group. The reference VMs are small, so one add-on type is reconciled per run and every command selects its group with --limit addon_<type>_cluster.

Inventory and variables

hosts.ini defines the four hosts once in [all], then selects them by bare name into one group per add-on type. Quorum add-ons use three hosts; MinIO/silo MNSD and the other four-member layouts use all four:

[all]
node1 ansible_host=192.0.2.10 private_ip=192.0.2.10
node2 ansible_host=192.0.2.11 private_ip=192.0.2.11
node3 ansible_host=192.0.2.12 private_ip=192.0.2.12
node4 ansible_host=192.0.2.13 private_ip=192.0.2.13

[all:vars]
ansible_user=root
ansible_port=22

[addon_etcd_cluster]
node1
node2
node3

[addon_minio_cluster]
node1
node2
node3
node4

private_ip is required: peer arguments, advertised addresses and the shared certificate SANs all use it. Host order matters — the add-on play runs with serial: 1 in inventory order, so the first host bootstraps the quorum before the others join.

Each group has its own self-contained group_vars directory. Copy the ones you use and edit them:

cd ansible
cp group_vars/addon_etcd_cluster/main.yml.example \
   group_vars/addon_etcd_cluster/main.yml

main.yml is gitignored; it holds the environment-specific values (the SeaweedFS metadata DSN, any explicit passwords). Each file declares its topology variables and one addon_<group>_addons list, so a reader sees everything that add-on needs in one place:

_addon_cluster_etcd_hosts: "{{ groups['addon_etcd_cluster'] }}"
_addon_cluster_etcd_index: "{{ _addon_cluster_etcd_hosts.index(inventory_hostname) | int }}"

addon_etcd_cluster_addons:
  - type: etcd
    state: present
    name: "etcd-{{ (_addon_cluster_etcd_index | int) + 1 }}"

The type name uses - replaced by _ in group and variable names: addon_clickhouse_keeper_cluster_addons targets clickhouse-keeper.

Each list entry follows the fields documented on Add-ons; state is set directly on each entry:

  • present installs the member, or keeps it if it already exists.
  • absent removes the member. Its data is deleted too unless the entry sets clean_data: false.

The runtime selector is playbook plumbing, not add-on configuration (group_vars/all/main.yml):

_addon_limit: "{{ ansible_limit | default('', true) }}"
_addon_group: >-
  {{ _addon_limit
     if (_addon_limit is match('^addon_[A-Za-z0-9_]+$') and _addon_limit in groups)
     else '' }}
_addon_kind: "{{ _addon_group | regex_replace('^addon_', '') }}"
_addon_type: "{{ _addon_kind | regex_replace('_(single|cluster)$', '') }}"
_addon_mode: >-
  {{ 'cluster' if _addon_kind is match('.*_cluster$')
     else ('single' if _addon_kind is match('.*_single$') else '') }}
pgcli_addons: >-
  {{ lookup('vars', 'addon_' ~ _addon_kind ~ '_addons', default=[])
     if _addon_group | length > 0 else [] }}

--limit addon_etcd_cluster expands pgcli_addons to addon_etcd_cluster_addons on those three hosts; without an add-on limit the list is empty, so the play is a no-op. apply.yaml rejects wildcards, comma-separated lists and addon_<type> names without a mode suffix.

Shared material

Multi-member add-ons need a common password and, optionally, a common TLS certificate. roles/addon_cluster_shared generates this once on the controller (the machine running ansible-playbook) before pg_addon runs on each member:

Material Location
Random passwords (minio_root_password, silo_root_password, rustfs_root_password, seaweedfs_root_password, redis_password, clickhouse_admin_password) var/addon_cluster/shared/ on the controller
Shared CA (ca.crt, ca.key), server key/CSR/certificate, chain and combined PEM same directory; the CA private key never leaves the controller
RabbitMQ Erlang cookie and admin password generated by pg addon rabbitmq secret generate and published to etcd

On the members the files land under /data/pg/addon/shared/ (ca.crt, server-chain.crt, server.key, server.pem; private files are 0600). The server certificate covers every private_ip of the selected addon_<type>_cluster group.

Password values are loaded into the matching _addon_cluster_<type>_* variables with set_fact during the run, so the templates keep them empty:

_addon_cluster_minio_root_user: admin
_addon_cluster_minio_root_password: ""

Set the add-on’s own _tls: true switch to use the shared certificate where the type supports it (minio, silo, rustfs, seaweedfs, kafka, rabbitmq). The install summary then prints https:// endpoints; pg mc adds --insecure for the self-signed CA.

RabbitMQ is the exception: its cookie and admin password must be identical on every member, so the role publishes them to etcd under /pgcli/rabbitmq/clusters/<name>/secrets/ and each member installs with --secrets-from-etcd. This requires a running etcd cluster; deploy the etcd section first. The generation command runs on the controller, so the controller needs the pg binary at pgcli_install_path and must reach the first endpoint in _addon_cluster_rabbitmq_etcd_endpoints.

Shipped layouts

Type Members Ports Notes
etcd first 3 2379 client, 2380 peer first host bootstraps, the rest --join it
minio 4 9100 API, 9101 console MNSD; each node contributes its own /data
silo 4 9200 API, 9201 console MNSD
rustfs 4 9300 API, 9301 console MNMD; one drive per node. Raw SigV4 requests need an x-amz-content-sha256 header
seaweedfs first 3 8400 master, 8401 volume, 8402 filer, 8403 S3 masters must be an odd count; the filer metadata database must exist in PostgreSQL first
redis 4 6379 (+ cluster bus 16379) installs four cluster-enabled members; apply.yaml assembles the slots and waits for a healthy cluster afterwards
clickhouse-keeper first 3 9181 client, 9234 Raft 3-member Raft quorum; --server-id = host index + 1
clickhouse 4 8123 HTTP, 9000 native, 9009 interserver 2 shards × 2 replicas over the Keeper above; deploy Keeper first
kafka first 3 9092 broker, 19093 controller KRaft quorum; 512 MiB heap fits the reference VMs
rabbitmq first 3 5672 AMQP, 15672 management needs etcd; shared cookie/password come from etcd
rocketmq first 3 9876 namesrv, 10911 broker, 8080 proxy, 8081 gRPC reduced heaps for small hosts
vmcluster 4 8480 insert, 8481 select, 8482 storage, 8483/8484 internal first host runs storage+insert+select, the rest storage only
vlcluster 4 9430 insert, 9431 select, 9432 storage same access/storage split; storage is sharded without replication

The three-node layouts (addon_etcd_cluster, addon_seaweedfs_cluster, addon_clickhouse_keeper_cluster, addon_kafka_cluster, addon_rabbitmq_cluster, addon_rocketmq_cluster) list only the first three hosts in hosts.ini, so their group files need no [:3] slices or state expressions. The four-member layouts list all four hosts. MinIO/silo MNSD needs at least four endpoints; Redis, vmcluster and vlcluster also use all four.

Create, verify, destroy

Run one type at a time:

cd ansible
uv run ansible-playbook playbooks/apply.yaml --limit addon_etcd_cluster \
  --tags addon

The play is serial: 1 and follows inventory order. For quorum add-ons, the first host must be up before the joiners, so do not reorder hosts between runs.

Verify

Run these on a member unless noted otherwise.

Type Command
etcd pg etcdctl endpoint health and pg etcdctl member list
minio / silo / rustfs / seaweedfs pg mc against the API port, then read the object back through a second member (see below)
redis pg redis-cli -- --cluster check 192.0.2.10:6379 (the play runs the equivalent check after assembly)
clickhouse-keeper pg addon clickhouse-keeper status --name keeper-cluster
clickhouse pg addon clickhouse cluster status --name clickhouse-cluster
kafka pg addon kafka cluster status --name kafka-cluster; pg addon kafka topic list --name kafka-cluster
rabbitmq pg addon rabbitmq cluster status --name rabbitmq-cluster
rocketmq pg addon rocketmq cluster status --name rocketmq-cluster
vmcluster insert a sample then query it through vmselect (see below)
vlcluster insert a sample then query it through vlselect (see below)

Cross-node S3 read (same password on every member, generated on the controller):

PW=$(cat var/addon_cluster/shared/minio_root_password)
pg mc alias set n1 http://192.0.2.10:9100 admin "$PW"
pg mc mb n1/demo
pg mc cp /etc/hostname n1/demo/
pg mc alias set n2 http://192.0.2.11:9100 admin "$PW"
pg mc cat n2/demo/hostname

Use port 9200 for silo, 9300 for rustfs and 8403 for seaweedfs (and the matching password file).

Redis needs no manual step: apply.yaml waits for every member, runs --cluster create ... --cluster-yes once when the cluster has not been assembled yet (passing --cluster-replicas from the add-on params, default 0), then waits until cluster_state:ok reports all 16384 slots across the expected number of nodes. A rerun skips the create step once the cluster is healthy. A partially joined cluster is not reset automatically: the play stops and asks you to reset the members and rerun. The equivalent commands for installs driven by pg addon alone:

pg redis-cli -- --cluster create \
  192.0.2.10:6379 192.0.2.11:6379 192.0.2.12:6379 192.0.2.13:6379 \
  --cluster-replicas 0 --cluster-yes
pg redis-cli -- --cluster check 192.0.2.10:6379

--cluster-yes is required in non-interactive runs: without it redis-cli prompts for confirmation and exits without applying the plan.

VictoriaMetrics cluster:

curl -s -X POST http://192.0.2.10:8480/insert/0/prometheus/api/v1/import/prometheus \
  --data-binary 'demo_metric{host="node1"} 42'
curl -s 'http://192.0.2.10:8481/select/0/prometheus/api/v1/query?query=demo_metric'

The first query can return an empty result while vminsert is still dialing every vmstorage node; retry after a few seconds.

VictoriaLogs cluster:

curl -s -X POST http://192.0.2.10:9430/insert/jsonline \
  -H 'Content-Type: application/json' \
  -d '{"_msg":"hello","app":"demo"}'
curl -s 'http://192.0.2.10:9431/select/logsql/query?query=app:demo&limit=10'

Content-Type: application/json is required. Without it the endpoint can return 200 while silently dropping the payload.

Destroy

Set each entry’s state in the group file to absent and re-run the same command. Data is removed with the member unless the entry sets clean_data: false; for SeaweedFS this includes the rendered s3.json and filer.toml. With serial: 1, members are removed one host at a time.

Dependency order:

  • etcd is the RabbitMQ coordination backend and the HA DCS. Remove RabbitMQ (and any Patroni cluster) before etcd.
  • clickhouse-keeper must outlive its ClickHouse members. Remove ClickHouse first, then Keeper.
  • The controller-side material in var/addon_cluster/shared/ survives a destroy/create cycle. To rotate passwords, remove that directory while every member is absent; existing members keep their old passwords and must be recreated. RabbitMQ secrets live in etcd, so they disappear with the etcd data and are regenerated on the next RabbitMQ run.

Removing an add-on does not touch the shared TLS files on the members, so a recreate can reuse them.