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-692: add update-config.md #4897

Merged
merged 2 commits into from
May 28, 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
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 @@ -7,6 +7,8 @@ items:
href: preparing-vms-with-terraform.md
- name: Restart
href: restart.md
- name: Update config
href: update-config.md
- name: Observability
include:
mode: link
Expand Down
44 changes: 44 additions & 0 deletions ydb/docs/en/core/devops/ansible/update-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Updating configuration of {{ ydb-short-name }} clusters deployed with Ansible

During [initial deployment](initial-deployment.md), the Ansible playbook used the provided config file to create the initial cluster configuration. Technically, it generates two variants of the original config file and deploys them to all hosts via Ansible's mechanism for cross-server file copy. This article explains which options are available to change the cluster's configuration after the initial deployment.

## Update configuration via Ansible playbook

[ydb-ansible](https://github.com/ydb-platform/ydb-ansible) repository contains a playbook called `ydb_platform.ydb.update_config` that can be used to update {{ ydb-short-name }} cluster's configuration. Go to the same directory used for the [initial deployment](initial-deployment.md), edit `files/config.yaml` as needed, and then run this playbook:

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

The playbook deploys the new version of the config files and then performs a [rolling restart](restart.md).

### Filter by node type

Tasks in the `ydb_platform.ydb.update_config` 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 change the configuration of all storage nodes:

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

These two commands are equivalent and will change the configuration of all database nodes:
```bash
ansible-playbook ydb_platform.ydb.update_config --tags database
ansible-playbook ydb_platform.ydb.update_config --tags dynamic
```

### Skip restart

There's a `no_restart` tag to only deploy the config files and skip the cluster restart. This might be useful if the cluster will be [restarted](restart.md) later manually or as part of some other maintenance tasks. Example:

```bash
ansible-playbook ydb_platform.ydb.update_config --tags no_restart
```

## Dynamic configuration

{{ ydb-short-name }} has its own configuration management mechanism called [dynamic configuration](../../maintenance/manual/dynamic-config.md). It is agnostic of the chosen cluster deployment method and allows for flexible cluster configuration even in multitenant environments.

Consider switching to dynamic configuration if manually deploying config files and doing a complete rolling restart on any change is no longer feasible.
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 @@ -7,6 +7,8 @@ items:
href: preparing-vms-with-terraform.md
- name: Перезапуск
href: restart.md
- name: Обновление конфигурации
href: update-config.md
- name: Наблюдаемость
include:
mode: link
Expand Down
44 changes: 44 additions & 0 deletions ydb/docs/ru/core/devops/ansible/update-config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Обновление конфигурации кластеров {{ ydb-short-name }}, развёрнутых с Ansible

Во время [первоначального развёртывания](initial-deployment.md) Ansible playbook использует предоставленный конфигурационный файл для создания начальной конфигурации кластера. Технически, он генерирует два варианта конфигурационного файла на основе исходного и размещает их на всех хостах через механизм Ansible для копирования файлов между серверами. В этой статье рассматриваются доступные способы для измения онфигурации кластера после первоначального развёртывания.

## Обновление конфигурации через Ansible playbook

В репозитории [ydb-ansible](https://github.com/ydb-platform/ydb-ansible) есть playbook под названием `ydb_platform.ydb.update_config`, который можно использовать для обновления конфигурации кластера {{ ydb-short-name }}. Перейдите в ту же директорию, которая использовалась для [первоначального развёртывания](initial-deployment.md) кластера, отредактируйте файл `files/config.yaml` по необходимости и затем запустите этот playbook:

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

Этот playbook развернёт новую версию конфигурационных файлов и затем выполнит [постепенную перезагрузку](restart.md) кластера.

### Фильтрация по типу узла

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

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

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

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

### Пропуск перезагрузки

Также есть тег `no_restart`, который позволяет только обновить конфигурационные файлы и пропустить перезагрузку кластера. Это может быть полезно, если кластер будет [перезагружен](restart.md) позже вручную или в рамках других задач по обслуживанию. Пример запуска:

```bash
ansible-playbook ydb_platform.ydb.update_config --tags no_restart
```

## Динамическая конфигурация

У {{ ydb-short-name }} есть собственный механизм управления конфигурацией под названием [динамическая конфигурация](../../maintenance/manual/dynamic-config.md). Он не зависит от выбранного метода развёртывания кластера и позволяет гибко настраивать кластер даже в мультиарендных средах.

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