Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YDBDOCS-690: introduce the restart article for Ansible clusters #4807

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ydb/docs/en/core/devops/ansible/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ This section of {{ ydb-short-name }} documentation contains a collection of arti

The key articles to get started with this section:

* [Initial deployment](initial-deployment.md)
* [Preparing VMs with Terraform](preparing-vms-with-terraform.md)
* [{#T}](initial-deployment.md)
* [{#T}](preparing-vms-with-terraform.md)
* [{#T}](restart.md)
* Observability:
* [{#T}](observability/logging.md)
55 changes: 55 additions & 0 deletions ydb/docs/en/core/devops/ansible/restart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Restarting {{ ydb-short-name }} clusters deployed with Ansible

{{ ydb-short-name }} clusters provide strong availability guarantees; thus, the cluster's fault tolerance model needs to be considered during any maintenance, including cluster restarts. There are two kinds of nodes that might need to be restarted:

* Database nodes (also known as dynamic) are stateless; thus, the primary consideration is having enough of them running to handle each database's load. A basic rolling restart with a little delay is usually sufficient for dynamic nodes.
* Storage nodes (also known as static) are stateful and responsible for safely persisting data. Thus, they require special handling to ensure data availability. Each {{ ydb-short-name }} cluster has a dedicated component that keeps track of all outages and maintenance and can tell if it is currently safe to stop or restart a particular node. Thus, asking for its permission for each operation is essential, and a complete restart of storage nodes often takes a while.

## Restart via Ansible playbook

[ydb-ansible](https://github.com/ydb-platform/ydb-ansible) repository contains a playbook called `ydb_platform.ydb.restart` that can be used to restart a {{ ydb-short-name }} cluster. Run it from the same directory used for the [initial deployment](initial-deployment.md).

### Restart all nodes

By default, the `ydb_platform.ydb.restart` restarts all cluster nodes. Static nodes go first, then dynamic nodes. The command to run it:

```bash
ansible-playbook ydb_platform.ydb.restart
```

### Filter by node type

Tasks in the `ydb_platform.ydb.restart` playbook are tagged with node types, so you can use Ansible's tags functionality to filter nodes by their kind.

These two commands are equivalent and will restart all storage nodes:

```bash
ansible-playbook ydb_platform.ydb.restart --tags storage
ansible-playbook ydb_platform.ydb.restart --tags static
```

These two commands are equivalent and will restart all database nodes:
```bash
ansible-playbook ydb_platform.ydb.restart --tags database
ansible-playbook ydb_platform.ydb.restart --tags dynamic
```

### Filter by hostname

To restart a specific host or subset of hosts, use the `--limit` argument:

```bash
ansible-playbook ydb_platform.ydb.restart --limit='<hostname>'
ansible-playbook ydb_platform.ydb.restart --limit='<hostname-1,hosntname-2>'
```

It can be used together with tags, too:
```bash
ansible-playbook ydb_platform.ydb.restart --tags database --limit='<hostname>'
```

## Restart nodes manually

The [ydbops](https://github.com/ydb-platform/ydbops) tool properly implements various {{ ydb-short-name }}cluster manipulations, including restarts. The `ydb_platform.ydb.restart` playbook explained above uses it behind the scenes, but it can be used manually, too.

There are more guidelines and information on how this works in the [{#T}](../manual/maintenance-without-downtime.md) article.
2 changes: 2 additions & 0 deletions ydb/docs/en/core/devops/ansible/toc_p.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ items:
href: initial-deployment.md
- name: Preparing VMs with Terraform
href: preparing-vms-with-terraform.md
- name: Restart
href: restart.md
- name: Observability
include:
mode: link
Expand Down
7 changes: 5 additions & 2 deletions ydb/docs/ru/core/devops/ansible/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@

Ключевые статьи для начала работы с этим разделом:

* [Первоначальное развертывание](initial-deployment.md)
* [Подготовка виртуальных машин с помощью Terraform](preparing-vms-with-terraform.md)
* [{#T}](initial-deployment.md)
* [{#T}](preparing-vms-with-terraform.md)
* [{#T}](restart.md)
* Наблюдаемость:
* [{#T}](observability/logging.md)
55 changes: 55 additions & 0 deletions ydb/docs/ru/core/devops/ansible/restart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Перезапуск кластеров {{ ydb-short-name }}, развёрнутых с помощью Ansible

Кластеры {{ ydb-short-name }} обеспечивают высокие гарантии доступности; таким образом, необходимо учитывать модель отказоустойчивости кластера во время любого технического обслуживания, включая перезапуск кластера. Существует два типа узлов, которые могут потребовать перезапуска:

* Database узлы (также известные как динамические) не сохраняют состояние; поэтому основное внимание стоит уделять тому, чтобы их было достаточно для обработки нагрузки каждой базы данных. Обычно для динамических узлов достаточно простого поэтапного перезапуска с небольшими задержками.
* Storage узлы (также известные как статические) имеют персистентное состояние и отвечают за безопасное хранение данных. Поэтому они требуют особого обращения для обеспечения доступности данных. Каждый кластер {{ ydb-short-name }} имеет выделенный компонент, который отслеживает все сбои и обслуживание и может определить, безопасно ли сейчас остановить или перезапустить конкретный узел. Поэтому важно запрашивать у него разрешение на каждую операцию, а полный перезапуск узлов хранения часто занимает некоторое время.

## Перезапуск через Ansible playbook

Репозиторий [ydb-ansible](https://github.com/ydb-platform/ydb-ansible) содержит playbook под названием `ydb_platform.ydb.restart`, который можно использовать для перезапуска кластера {{ ydb-short-name }}. Запускайте его из той же директории, которая использовалась для [изначального развёртывания](initial-deployment.md).

### Перезапуск всех узлов

По умолчанию `ydb_platform.ydb.restart` перезапускает все узлы кластера. Сначала идут статические узлы, затем динамические. Команда для его запуска:

```bash
ansible-playbook ydb_platform.ydb.restart
```

### Фильтр по типу узлов

Задачи в playbook `ydb_platform.ydb.restart` помечены типами узлов, поэтому вы можете использовать функциональность тегов Ansible для фильтрации узлов по их типу.

Эти две команды эквивалентны и перезапустят все узлы хранения:

```bash
ansible-playbook ydb_platform.ydb.restart --tags storage
ansible-playbook ydb_platform.ydb.restart --tags static
```

Эти две команды эквивалентны и перезапустят все узлы баз данных:
```bash
ansible-playbook ydb_platform.ydb.restart --tags database
ansible-playbook ydb_platform.ydb.restart --tags dynamic
```

### Фильтр по имени хоста

Чтобы перезапустить конкретный хост или подмножество хостов, используйте аргумент `--limit`:

```bash
ansible-playbook ydb_platform.ydb.restart --limit='<hostname>'
ansible-playbook ydb_platform.ydb.restart --limit='<hostname-1,hosntname-2>'
```

Его можно использовать и вместе с тегами:
```bash
ansible-playbook ydb_platform.ydb.restart --tags database --limit='<hostname>'
```

## Перезапуск узлов вручную

Инструмент [ydbops](https://github.com/ydb-platform/ydbops) реализует различные манипуляции с кластерами {{ ydb-short-name }}, включая перезапуск. Описанный выше playbook `ydb_platform.ydb.restart` использует его за сценой, но использование его вручную тоже допустимо.

Больше рекомендаций и информации о том, как это работает, находится в статье [{#T}](../manual/maintenance-without-downtime.md).
2 changes: 2 additions & 0 deletions ydb/docs/ru/core/devops/ansible/toc_p.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ items:
href: initial-deployment.md
- name: Подготовка виртуальных машин с Terraform
href: preparing-vms-with-terraform.md
- name: Перезапуск
href: restart.md
- name: Наблюдаемость
include:
mode: link
Expand Down
Loading