Skip to main content

Выключение co_etcd нод

Описание проблемы:​

Во время включения сервера роли etcd при запуске может возникнуть ошибка:

tocommit(1352138) is out of range [lastIndex(1351566)]. Was the raft log corrupted, truncated, or lost?

Ошибка указывает на несоответствие индекса коммита (tocommit) и последнему доступному индексу в логе Raft (lastIndex). Это критическая ошибка, которая приводит остановке ноды.

Решение:​

  1. Остановить контейнер etcd на поврежденной ноде с помощью команды:
docker stop etcd
  1. Удалить все данные с помощью команды:
rm -rf /srv/docker/etcd/data/*
  1. Удалить отказавшую ноду с помощью команды:
docker exec etcd bash -c 'ETCDCTL_API=2 etcdctl \
--endpoints=https://etcd.installation.example.net:2379 \
member remove etcd-2.installation.example.net:2380'

где: etcd-2.installation.example.net:2380 — отказавшая нода.

  1. Добавьте заново ноду etcd с помощью команды:
docker exec etcd bash -c 'ETCDCTL_API=2 etcdctl \
--endpoints=https://etcd.installation.example.net:2379 member add etcd-2.installation.example.net \
https://etcd-2.installation.example.net:2380'

где: etcd-2.installation.example.net:2380 — новая нода, вместо отказавшей.

  1. Запустить контейнер etcd на затронутом узле с помощью команды:
docker start etcd

Возможные ошибки:​

При удалении контейнера командой docker rm -f etcd && rm -rf /srv/docker/etcd рекомендуется^

  1. Выполнить запуск установки продукта на сервере с ролью operator с тегом etcd
ansible-playbook playbooks/main.yml -t etcd

Запуск установки завершится с ошибкой, но это позволит создать необходимые каталоги и конфигурацию.

  1. Открыть конфигурационный файл /srv/docker/etcd/conf/etcd.conf

`3. Указать параметру``initial-cluster-state: значение 'existing'

  1. Выполнить в разделе «Решение» пункты со второго до пятого.

Диагностика:​

Проверка работы кластера с помощью команды:

docker exec etcd bash -c 'ETCDCTL_API=2 etcdctl --endpoints=https://etcd-2.installation.example.net:2379 cluster-health'

где: etcd-2.installation.example.net:2380 — новая нода, вместо отказавшей.

# example output
# member 52ec08613f4a3b2 is healthy: got healthy result from https://etcd-2.installation.example.net:2379
# member aadf8d7abb7d4002 is healthy: got healthy result from https://etcd-2.installation.example.net:2379
# member c911d1301ce37fe5 is healthy: got healthy result from https://etcd-2.installation.example.net:2379
# member d557dfef94eab298 is healthy: got healthy result from https://etcd-2.installation.example.net:2379
# member e671864977360de2 is healthy: got healthy result from https://etcd-2.installation.example.net:2379
# cluster is healthy