Product SiteDocumentation Site

54.2. Установка кластерного ПО и создание кластера

Для управления кластером Pacemaker можно использовать утилиты pcs или crm (пакет crmsh).
Установить на всех узлах необходимые пакеты:
# apt-get install corosync resource-agents pacemaker pcs

Примечание

Данные пакеты не входят в состав ISO-образа дистрибутива, их можно установить из репозитория p10. О добавлении репозиториев с использованием графических приложений вы можете почитать в разделе Управление репозиториями.

Примечание

Пакет resource-agent — содержит агенты ресурсов (набор скриптов) кластера, соответствующие спецификации Open Cluster Framework (OCF), используемые для взаимодействия с различными службами в среде высокой доступности, управляемой менеджером ресурсов Pacemaker. Если есть необходимость управлять дополнительными ресурсами, следует установить недостающий пакет resource-agents-*:
$ apt-cache search resource-agents*
Пакет pcs (pacemaker/corosync configuration system) — утилита для управления, настройки и мониторинга кластера. Управляется как через командную строку, так и через веб-интерфейс.
При установке Pacemaker автоматически будет создан пользователь hacluster. Для использования pcs, а также для доступа в веб-интерфейс нужно задать пароль пользователю hacluster (одинаковый на всех узлах):
# passwd hacluster
Запустить и добавить в автозагрузку службу pcsd:
# systemctl enable --now pcsd
Настроить аутентификацию (на одном узле):
# pcs host auth node01 node02 node03 -u hacluster
Password:
node02: Authorized
node01: Authorized
node03: Authorized
После этого кластером можно управлять с одного узла.
Создать кластер:
# pcs cluster setup newcluster node01 node02 node03
Destroying cluster on hosts: 'node01', 'node02', 'node03'...
node03: Successfully destroyed cluster
node01: Successfully destroyed cluster
node02: Successfully destroyed cluster
Requesting remove 'pcsd settings' from 'node01', 'node02', 'node03'
node01: successful removal of the file 'pcsd settings'
node03: successful removal of the file 'pcsd settings'
node02: successful removal of the file 'pcsd settings'
Sending 'corosync authkey', 'pacemaker authkey' to 'node01', 'node02', 'node03'
node01: successful distribution of the file 'corosync authkey'
node01: successful distribution of the file 'pacemaker authkey'
node03: successful distribution of the file 'corosync authkey'
node03: successful distribution of the file 'pacemaker authkey'
node02: successful distribution of the file 'corosync authkey'
node02: successful distribution of the file 'pacemaker authkey'
Sending 'corosync.conf' to 'node01', 'node02', 'node03'
node01: successful distribution of the file 'corosync.conf'
node02: successful distribution of the file 'corosync.conf'
node03: successful distribution of the file 'corosync.conf'
Cluster has been successfully set up.
Запустить кластер:
# pcs cluster start --all
node02: Starting Cluster...
node03: Starting Cluster...
node01: Starting Cluster...
Настройка автоматического включения кластера при загрузке:
# pcs cluster enable --all
node01: Cluster Enabled
node02: Cluster Enabled
node03: Cluster Enabled
Проверка состояния кластера:
# pcs status cluster
Cluster Status:
 Status of pacemakerd: 'Pacemaker is running' (last updated 2023-09-27 16:59:12 +02:00)
 Cluster Summary:
   * Stack: corosync
   * Current DC: node01 (version 2.1.5-alt1-a3f44794f) - partition with quorum
   * Last updated: Wed Sep 27 16:59:13 2023
   * Last change:  Wed Sep 27 16:59:09 2023 by hacluster via crmd on node01
   * 3 nodes configured
   * 0 resource instances configured
 Node List:
   * Online: [ node01 node02 node03 ]

PCSD Status:
  node02: Online
  node01: Online
  node03: Online
Проверка синхронизации узлов кластера:
# corosync-cmapctl | grep members
runtime.members.1.config_version (u64) = 0
runtime.members.1.ip (str) = r(0) ip(192.168.0.113)
runtime.members.1.join_count (u32) = 1
runtime.members.1.status (str) = joined
runtime.members.2.config_version (u64) = 0
runtime.members.2.ip (str) = r(0) ip(192.168.0.145)
runtime.members.2.join_count (u32) = 1
runtime.members.2.status (str) = joined
runtime.members.3.config_version (u64) = 0
runtime.members.3.ip (str) = r(0) ip(192.168.0.132)
runtime.members.3.join_count (u32) = 1
runtime.members.3.status (str) = joined