Skip to content

Commit 3b78abe

Browse files
authored
Soragerole pre collections (#37)
* separate storage init phase from ydbd_storage role * labels in service files * unified agent installation role * complex setup examples: LDAP, unified agent * log rotation config added * enable log rotation when UA is installed * file permissions setup * proper permissions for config backup * set the current directory of ydbd to audit target path * relative audit file output directory in config samples * wait scripts should run without arguments too * umask for files generated by ydbd * removed obsolete libidn and cluster name support * make congestion settings optional * updated the example config for new settings * syntax fix * automatic startup for ydbd * README.md updated
1 parent 7375965 commit 3b78abe

32 files changed

+572
-140
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,24 @@ The meaning and format of the variables used are specified in the table below.
3636
| --------- | ------- |
3737
| `ansible_python_interpreter` | The correct path to the Python interpreter on the YDB cluster hosts. |
3838
| `ydb_dir` | Path of the YDB software installation directory to be created on the hosts. |
39-
| `libidn_archive` | Enable the installation of custom-built libidn for RHEL, AlmaLinux or Rocky Linux. |
4039
| `ydb_archive` | YDB server binary package in .tar.gz format |
40+
| `ydb_version` | YDB version label used to define the installation directory path for the particular version of YDB binary package. Typically depends oin the `ydb_archive` value |
4141
| `ydb_unpack_options` | Extra flags to be passed to `tar` for unpacking the YDB server binaries, typically should contain the value `--strip-component=1` |
4242
| `ydb_tls_dir` | Path to the local directory with the TLS certificates and keys, as generated by the [sample script](https://github.com/ydb-platform/ydb/tree/main/ydb/deploy/tls_cert_gen), or following the filename convention used by the sample script |
4343
| `ydb_config` | The name of the cluster configuration file within the `files` subdirectory (**without** the `actor_system_config` snippet!) |
4444
| `ydb_domain` | The name of the root domain hosting the databases, value `Root` is used in the YDB documentation |
45+
| `ydb_dbname` | Database name which is used for database creation, database nodes deployment and database nodes rolling restart |
4546
| `ydb_disks` | Disk layout of storage nodes, defined as `ydbd_static` in the hosts file. Defined as list of structures having the following fields:<br/> `name` - physical device name (like `/dev/sdb` or `/dev/vdb`);<br/> `label` - the desired YDB data partition label, as used in the cluster configuration file (like `ydb_disk_1`) |
46-
| `ydb_dynnodes` | Set of dynamic nodes to be ran on each host listed as `ydbd_dynamic` in the hosts file. Defined as list of structures having the following fields:<br/> `dbname` - name of the YDB database handled by the corresponding dynamic node;<br/> `instance` - dynamic node service instance name, allowing to distinguish between multiple dynamic nodes for the same database running in the same host;<br/> `offset` - integer number `0-N`, used as the offset for the standard network port numbers (`0` means using the standard ports). |
47-
| `ydb_brokers` | List of host names running the YDB static nodes, exactly 3 (three) host names must be specified |
47+
| `ydb_dynnodes` | Set of dynamic nodes to be ran on each host listed as `ydbd_dynamic` in the hosts file. Defined as list of structures having the following fields:<br/> `dbname` - name of the YDB database handled by the corresponding dynamic node;<br/> `instance` - dynamic node service instance name, allowing to distinguish between multiple dynamic nodes for the same database running in the same host;<br/> `offset` - integer number `0-N`, used as the offset for the standard network port numbers (`0` means using the standard ports);<br/> `affinity` - CPU core mask or range to be used for the service instance, optional. |
48+
| `ydb_affinity_static` | CPU core mask or range to be used by the storage nodes services, optional |
49+
| `ydb_brokers` | List of host names running the YDB static nodes, normally three host names must be specified |
4850
| `ydb_cores_static` | Number of cores to be used by thread pools of the static nodes |
4951
| `ydb_cores_dynamic` | Number of cores to be used by thread pools of the dynamic nodes |
50-
| `ydb_dbname` | Database name, for database creation, dynamic nodes deployment and dynamic nodes rolling restart |
5152
| `ydb_pool_kind` | YDB default storage pool kind, as specified in the static nodes configuration file in the `storage_pool_types.kind` field |
5253
| `ydb_default_groups` | Initial number of storage groups in the newly created database |
5354
| `dynnode_restart_sleep_seconds` | Number of seconds to sleep after startup of each dynamic node during the rolling restart. |
55+
| `ydb_congestion_setting` | TCP congestion control setting, recommended value is `htcp`. Optional |
56+
| `ydb_congestion_module` | TCP congestion control kernel loadable module name, recommended value is `tcp_htcp`. Optional |
5457

5558
## Installing the YDB cluster using the Ansible playbooks
5659

binaries-all.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- hosts: all
2+
roles:
3+
- role: ydbd

binaries-dynamic.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
- hosts: ydbd_dynamic
22
roles:
33
- role: ydbd
4+
- role: ydbd_dynamic

binaries-static.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
- hosts: ydbd_static
22
roles:
33
- role: ydbd
4+
- role: ydbd_static

files/config-3nodes-extra.yaml

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
storage_config_generation: 0
2+
static_erasure: mirror-3-dc
3+
host_configs: # the list of available host configurations in the cluster.
4+
- drive:
5+
- path: /dev/disk/by-partlabel/ydb_disk_1
6+
type: SSD
7+
- path: /dev/disk/by-partlabel/ydb_disk_2
8+
type: SSD
9+
- path: /dev/disk/by-partlabel/ydb_disk_3
10+
type: SSD
11+
host_config_id: 1
12+
hosts:
13+
- host: zeit-1
14+
host_config_id: 1
15+
walle_location:
16+
body: 1
17+
data_center: 'zone-a'
18+
rack: '1'
19+
- host: zeit-2
20+
host_config_id: 1
21+
walle_location:
22+
body: 2
23+
data_center: 'zone-b'
24+
rack: '2'
25+
- host: zeit-3
26+
host_config_id: 1
27+
walle_location:
28+
body: 3
29+
data_center: 'zone-c'
30+
rack: '3'
31+
domains_config:
32+
# There can be only one root domain in a cluster. Domain name prefixes all scheme objects names, e.g. full name of a table table1 in database db1.
33+
# in a cluster with domains_config.domain.name parameter set to Root would be equal to /Root/db1/table1
34+
domain:
35+
- name: Domain0
36+
domain_id: 1
37+
storage_pool_types:
38+
- kind: ssd
39+
pool_config:
40+
box_id: 1
41+
# fault tolerance mode name - none, block-4-2, or mirror-3-dc..
42+
# See docs for more details https://ydb.tech/en/docs/deploy/configuration/config#domains-blob
43+
erasure_species: mirror-3-dc
44+
kind: ssd
45+
geometry:
46+
realm_level_begin: 10
47+
realm_level_end: 20
48+
domain_level_begin: 10
49+
domain_level_end: 256
50+
pdisk_filter:
51+
- property:
52+
- type: SSD # device type to match host_configs.drive.type
53+
vdisk_kind: Default
54+
state_storage:
55+
- ring:
56+
node: [1, 2, 3]
57+
nto_select: 3
58+
ssid: 1
59+
security_config:
60+
enforce_user_token_requirement: true
61+
monitoring_allowed_sids:
62+
- "root"
63+
- "ydb-admin1@ldap"
64+
- "CN=ydb-admins,OU=demo1,DC=ydb,DC=demo@ldap"
65+
administration_allowed_sids:
66+
- "root"
67+
- "ydb-admin1@ldap"
68+
- "CN=ydb-admins,OU=demo1,DC=ydb,DC=demo@ldap"
69+
viewer_allowed_sids:
70+
- "root"
71+
- "ydb-admin1@ldap"
72+
- "CN=ydb-admins,OU=demo1,DC=ydb,DC=demo@ldap"
73+
74+
blob_storage_config: # configuration of static blobstorage group.
75+
# YDB uses this group to store system tablets' data, like SchemeShard
76+
service_set:
77+
groups:
78+
- erasure_species: mirror-3-dc # fault tolerance mode name for the static group
79+
rings: # in mirror-3-dc must have exactly 3 rings or availability zones
80+
- fail_domains: # first record: fail domains of the static group describe where each vdisk of the static group should be located.
81+
- vdisk_locations:
82+
- node_id: zeit-1
83+
pdisk_category: SSD
84+
path: /dev/disk/by-partlabel/ydb_disk_1
85+
- vdisk_locations:
86+
- node_id: zeit-1
87+
pdisk_category: SSD
88+
path: /dev/disk/by-partlabel/ydb_disk_2
89+
- vdisk_locations:
90+
- node_id: zeit-1
91+
pdisk_category: SSD
92+
path: /dev/disk/by-partlabel/ydb_disk_3
93+
- fail_domains: # second ring: fail domains of the static group describe where each vdisk of the static group should be located.
94+
- vdisk_locations:
95+
- node_id: zeit-2
96+
pdisk_category: SSD
97+
path: /dev/disk/by-partlabel/ydb_disk_1
98+
- vdisk_locations:
99+
- node_id: zeit-2
100+
pdisk_category: SSD
101+
path: /dev/disk/by-partlabel/ydb_disk_2
102+
- vdisk_locations:
103+
- node_id: zeit-2
104+
pdisk_category: SSD
105+
path: /dev/disk/by-partlabel/ydb_disk_3
106+
- fail_domains: # third ring: fail domains of the static group describe where each vdisk of the static group should be located.
107+
- vdisk_locations:
108+
- node_id: zeit-3
109+
pdisk_category: SSD
110+
path: /dev/disk/by-partlabel/ydb_disk_1
111+
- vdisk_locations:
112+
- node_id: zeit-3
113+
pdisk_category: SSD
114+
path: /dev/disk/by-partlabel/ydb_disk_2
115+
- vdisk_locations:
116+
- node_id: zeit-3
117+
pdisk_category: SSD
118+
path: /dev/disk/by-partlabel/ydb_disk_3
119+
120+
channel_profile_config:
121+
profile:
122+
- channel:
123+
- erasure_species: mirror-3-dc
124+
pdisk_category: 1 # 0=ROT, 1=SSD, 2=NVME
125+
storage_pool_kind: ssd
126+
- erasure_species: mirror-3-dc
127+
pdisk_category: 1
128+
storage_pool_kind: ssd
129+
- erasure_species: mirror-3-dc
130+
pdisk_category: 1
131+
storage_pool_kind: ssd
132+
profile_id: 0
133+
134+
interconnect_config:
135+
start_tcp: true
136+
encryption_mode: OPTIONAL
137+
path_to_certificate_file: "/opt/ydb/certs/node.crt"
138+
path_to_private_key_file: "/opt/ydb/certs/node.key"
139+
path_to_ca_file: "/opt/ydb/certs/ca.crt"
140+
141+
grpc_config:
142+
cert: "/opt/ydb/certs/node.crt"
143+
key: "/opt/ydb/certs/node.key"
144+
ca: "/opt/ydb/certs/ca.crt"
145+
services_enabled:
146+
- legacy
147+
148+
auth_config:
149+
use_builtin_auth: true
150+
ldap_authentication:
151+
host: "dc2016.ydb.demo"
152+
port: 389
153+
base_dn: "OU=demo1,DC=ydb,DC=demo"
154+
bind_dn: "[email protected]"
155+
bind_password: "P@$$w0rd+"
156+
search_filter: "sAMAccountName=$username"
157+
use_tls:
158+
enable: true
159+
ca_cert_file: "/etc/ssl/certs/ca-certificates.crt"
160+
cert_require: DEMAND
161+
ldap_authentication_domain: "ldap"
162+
refresh_time: "10m"
163+
164+
table_service_config:
165+
sql_version: 1
166+
167+
bootstrap_config:
168+
shared_cache_config: {memory_limit: '4294967296'}
169+
170+
feature_flags:
171+
enable_grpc_audit: false
172+
enable_get_node_labels: true
173+
enable_views: true
174+
175+
log_config:
176+
default_level: 4
177+
uaclient_config:
178+
uri: 'localhost:16400'
179+
log_name: main
180+
181+
audit_config:
182+
unified_agent_backend:
183+
format: JSON
184+
log_name: audit
185+
186+
# Actor system config is appended to the configuration file by Ansible task.
187+
# Provided here in the commented form for reference
188+
#actor_system_config:
189+
# use_auto_config: true
190+
# node_type: STORAGE # STORAGE or COMPUTE
191+
# cpu_count: 6

files/config-3nodes.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ bootstrap_config:
147147
audit_config:
148148
file_backend:
149149
format: JSON
150-
file_path: "/opt/ydb/audit/ydb-audit.log"
150+
file_path: "ydb-audit.log"
151151
# Actor system config is appended to the configuration file by Ansible task.
152152
# Provided here in the commented form for reference
153153
#actor_system_config:

files/config-9nodes.yaml.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ bootstrap_config:
168168
audit_config:
169169
file_backend:
170170
format: JSON
171-
file_path: "/opt/ydb/audit/ydb-audit.log"
171+
file_path: "ydb-audit.log"
172172
# Actor system config is appended to the configuration file by Ansible task.
173173
# Provided here in the commented form for reference
174174
#actor_system_config:

files/example-dynamic-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
metadata:
2+
kind: MainConfig
3+
cluster: ""
4+
version: 6
5+
config:
6+
yaml_config_enabled: true
7+
log_config:
8+
default_level: 4
9+
allowed_labels:
10+
node_id:
11+
type: string
12+
host:
13+
type: string
14+
tenant:
15+
type: string
16+
selector_config: []

files/modules-ydbd.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

group_vars/all.example

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,20 @@
22

33
ansible_python_interpreter: /usr/bin/python3
44

5-
# libidn compiled code.
6-
# Required for RHEL 8, RHEL 9 and similar (AlmaLinux, etc)
7-
# libidn_archive: libidn.tar.gz
8-
95
# YDB cluster domain (aka cluster identifier), Root in the documentation
106
ydb_domain: Domain0
117

12-
# YDB cluster name
13-
ydb_cluster: cluster1
14-
158
# YDB software installation directory
169
ydb_dir: /opt/ydb
1710

1811
# Source directory with TLS keys and certificares
1912
ydb_tls_dir: ./tls/CA/certs/2023-03-09_16-49-39
2013

2114
# YDB server software archive
22-
ydb_archive: yasubd-24.1.18.1-linux-amd64.tar.gz
15+
ydb_archive: yasubd-24.1.18.2-linux-amd64.tar.gz
2316

2417
# YDB server software release
25-
ydb_version: 24.1.18.1
18+
ydb_version: 24.1.18.2
2619

2720
# Extra options passed to tar for unpack, typically "--strip-component=1"
2821
ydb_unpack_options: "--strip-component=1"
@@ -48,7 +41,8 @@ ydb_cores_dynamic: 14
4841
ydb_disks:
4942
- name: /dev/vdb
5043
label: ydb_disk_1
51-
# Configuration settings for dynamic YDB cluster nodes
44+
- name: /dev/vdc
45+
label: ydb_disk_2
5246

5347
# The list of exactly three node brokers (static nodes)
5448
ydb_brokers:
@@ -73,4 +67,14 @@ ydb_dynnodes:
7367
ydb_affinity_static: '0-31'
7468

7569
# Extra sleep time to allow dynamic nodes to settle up
76-
dynnode_restart_sleep_seconds: 30
70+
dynnode_restart_sleep_seconds: 10
71+
72+
# Source path to Unified Agent binary
73+
unified_agent_binary: ../unified_agent
74+
# Unified Agent installation root
75+
unified_agent_home: /opt/ydb/unified_agent
76+
77+
# Optional network congestion control setting, htcp recommended
78+
ydb_congestion_setting: htcp
79+
# Optional module to load the congestion control algorithm
80+
ydb_congestion_module: tcp_htcp

0 commit comments

Comments
 (0)