33.6. Службы кластера #
Конфигурация кластера Postgres Pro Shardman хранится в распределённом хранилище. Службы кластера Postgres Pro Shardman организованы как службы systemd. Демон настройки Postgres Pro Shardman shardmand отслеживает конфигурацию кластера и управляет экземплярами PostgreSQL. У каждого узла есть одна служба shardmand, которая обычно называется shardmand@CLUSTER_NAME.service. Здесь CLUSTER_NAME — это имя кластера Postgres Pro Shardman, по умолчанию cluster0.
Каждый shardmand включает в себя несколько интегрированных потоков keeper.
С каждым зарегистрированным экземпляром СУБД связан поток keeper, который напрямую управляет этим экземпляром PostgreSQL. Поток keeper запускает, останавливает, инициализирует и изменяет экземпляры PostgreSQL в зависимости от необходимого состояния кластера. В Postgres Pro Shardman используются только синхронизированные реплики, иначе есть риск потери данных в случае сбоя узла.
shardmand — это модуль systemd, его журналы записываются в journald. Ознакомиться с его работой можно, используя команду journalctl. Например, чтобы получить все журналы с 2023-05-09 10:00 для службы shardmand кластера cluster0, можно использовать следующую команду:
$ journalctl -u shardmand@cluster0 --since '2023-05-09 10:00'
Чтобы задать уровень детализации журнала для всех служб Postgres Pro Shardman, укажите SDM_LOG_LEVEL в файле конфигурации shardmand.
33.6. Cluster Services #
The Postgres Pro Shardman cluster configuration is stored in the distributed storage. Postgres Pro Shardman cluster services are organized as systemd services. The Postgres Pro Shardman configuration daemon shardmand monitors the cluster configuration and manages PostgreSQL instances. Each node has one shardmand service, whose typical name is shardmand@CLUSTER_NAME.service. Here CLUSTER_NAME is the Postgres Pro Shardman cluster name, cluster0 by default.
Each shardmand includes several integrated keeper threads.
Each registered DBMS instance has an associated keeper thread that directly manages this PostgreSQL instance. The keeper starts, stops, initializes and update PostgreSQL instances according to the desired cluster state. Postgres Pro Shardman only uses synchronous replicas (otherwise, there is a chance to lose data when a node fails).
shardmand is a systemd unit, its logs are written to journald. You can use journalctl to examine it. For example, to get all logs since 2023-05-09 10:00 for the shardmand service of the cluster0 cluster, you can use the following command:
$ journalctl -u shardmand@cluster0 --since '2023-05-09 10:00'
To control the log verbosity for all Postgres Pro Shardman services, set SDM_LOG_LEVEL in the shardmand configuration file.