Skip to content

Commit b47c976

Browse files
elabproEugene Arbatsky
andauthored
YDBOPS-11282 Some changes to make install more comfortable (#68)
* More stable port listener Check for YDB presence on early stage * Fix problem with tcp_htcp +FAQ Update list of supported OS * Fix description * Fix list of OS --------- Co-authored-by: Eugene Arbatsky <[email protected]>
1 parent b40de5e commit b47c976

File tree

4 files changed

+101
-46
lines changed

4 files changed

+101
-46
lines changed

README.md

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ Current limitations:
2323
* the cluster configuration file has to be manually created;
2424
* there are no examples for configuring the storage nodes with different disk layouts (it seems to be doable by defining different `ydb_disks` values for different host groups).
2525

26+
## Supported operation system
27+
28+
- Ubuntu 20.04, 22.04, 24.04
29+
- Debian 11.11, 12.7
30+
- AstraLinux 1.7
31+
- AlmaLinux 8.9, 9.4, 9.5
32+
- Altlinux 8.4, 10, 10.1
33+
- RedHat 9.3
34+
- RedOS 7.3, 8
35+
- CentOS 8
36+
2637
## Ansible Collection - ydb_platform.ydb
2738

2839
Documentation for the collection.
@@ -169,17 +180,6 @@ graph TD;
169180
end
170181
```
171182
172-
## Supported operation system
173-
174-
- ydb_platform.ydb.initial_setup - Install cluster
175-
- Ubuntu 22.04, 24.04
176-
- Debian 11.11, 12.7
177-
- AstraLinux 1.7
178-
- AlmaLinux 8,9
179-
- Altlinux 10
180-
- RedHat 9
181-
- RedOS 7
182-
183183
# Install in isolated mode
184184
Isolated mode - situation when hosts are isolated from Internet (intranet, secure environment). There two possible way to install:
185185
1. Use bastion / jump host
@@ -277,3 +277,20 @@ sudo docker run -it --rm \
277277
-v /home/ansible/ydb-ansible:/root/.ansible/collections/ansible_collections/ydb_platform/ydb \
278278
ydb-ansible ansible-console ydb
279279
```
280+
281+
# FAQ
282+
1) Q: How to install on Linux with kernel 5.15.0-1073-kvm, which does not contain the tcp_htcp module?
283+
A1: define empty variable `ydb_congestion_module` in inventory
284+
A2: define variable in command line:
285+
`ansible-playbook ydb_platform.ydb.initial_setup --extra-vars "ydb_congestion_module="`
286+
287+
2) Q: How to handle error: `aborting playbook execution. Stop running YDB instances`?
288+
A1: Manually stop YDB instances on the hosts for new YDB installation
289+
A2: Use other hosts without YDB
290+
A3: Use ansible-console to stop YDB instances:
291+
```
292+
ansible-console ydb
293+
$ sudo systemctl stop ydbd-storage
294+
$ sudo systemctl stop ydbd-database-a
295+
$ sudo systemctl stop ydbd-database-b
296+
```

roles/check_connectivity/files/port_listner.py

Lines changed: 52 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,80 @@
11
# Simple script for checking connectivity
22
# It's starting TCP server to listen several ports
3+
#
4+
# Expected result: Listen on IPv4/IPv6 interface for incoming requests
5+
# Version: 1.2
6+
# Author: Eugene Arbatsky
7+
#
38
# Usage:
4-
# python3 port_listner.py <port1> [..<portN>]
9+
# python3 port_listner.py <FQDN> <port1> [..<portN>]
510
#
611
import socket
712
import threading
813
import sys
14+
import time
915

1016
def listen_port4(port):
11-
try:
12-
# Set up IPv4 address
13-
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
14-
s.bind(("0.0.0.0", port))
15-
s.listen(5)
17+
tries = 0
18+
while tries < 10:
19+
try:
20+
# Set up IPv4 address
21+
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
22+
s.bind(("0.0.0.0", port))
23+
s.listen(5)
1624

17-
print(f"Listen port IPv4 {port}...")
25+
print(f"Listen port IPv4 {port}...")
1826

19-
while True:
20-
conn, addr = s.accept()
21-
with conn:
22-
print(f"New connection from {addr}")
23-
conn.close()
24-
except:
25-
print(f"No IPv4")
27+
while True:
28+
conn, addr = s.accept()
29+
with conn:
30+
print(f"New connection from {addr}")
31+
conn.close()
32+
break
33+
except:
34+
print(f"No IPv4 or port is busy.. try again")
35+
tries = tries + 1
36+
time.sleep(1)
2637

2738
def listen_port6(port):
28-
try:
29-
# Set up IPv6 address
30-
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
31-
s.bind(("::", port))
32-
s.listen(5)
39+
tries = 0
40+
while tries < 10:
41+
try:
42+
# Set up IPv6 address
43+
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
44+
s.bind(("::", port))
45+
s.listen(5)
3346

34-
print(f"Listen port IPv6 {port}...")
47+
print(f"Listen port IPv6 {port}...")
3548

36-
while True:
37-
conn, addr = s.accept()
38-
with conn:
39-
print(f"New connection from {addr}")
40-
conn.close()
41-
except:
42-
print(f"No IPv6")
49+
while True:
50+
conn, addr = s.accept()
51+
with conn:
52+
print(f"New connection from {addr}")
53+
conn.close()
54+
break
55+
except:
56+
print(f"No IPv6 or port is busy .. try again")
57+
tries = tries + 1
58+
time.sleep(1)
4359

4460

4561
def main():
46-
if len(sys.argv) < 2:
62+
if len(sys.argv) < 3:
4763
print("No ports to listen!")
4864
return
4965

50-
ports = [int(port) for port in sys.argv[1:]]
66+
fqdn = sys.argv[1]
67+
ports = [int(port) for port in sys.argv[2:]]
5168

5269
threads = []
70+
# Determine prefered IP protocol
71+
info = socket.getaddrinfo(fqdn,ports[0])
5372

5473
for port in ports:
55-
thread = threading.Thread(target=listen_port4, args=(port,))
56-
threads.append(thread)
57-
thread.start()
58-
thread = threading.Thread(target=listen_port6, args=(port,))
74+
if 'AddressFamily.AF_INET6' in str(info[0][0]):
75+
thread = threading.Thread(target=listen_port6, args=(port,))
76+
else:
77+
thread = threading.Thread(target=listen_port4, args=(port,))
5978
threads.append(thread)
6079
thread.start()
6180

roles/check_connectivity/tasks/main.yaml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,27 @@
88
group: root
99
mode: 0755
1010

11+
- name: Get PIDs of YDBD
12+
shell: pgrep ydbd | wc -l
13+
register: pids_of_ydbd
14+
15+
- name: Check presence of YDBD
16+
when: pids_of_ydbd.stdout != "0"
17+
ansible.builtin.fail:
18+
msg: "aborting playbook execution. Stop running YDB instances"
19+
20+
- name: Stop script
21+
shell: "pkill -f -e \"port_listner\""
22+
ignore_errors: True
23+
24+
- name: Additional delay for OS to release ports
25+
ansible.builtin.pause: seconds=5
26+
1127
- name: Start script to listen YDB ports
12-
shell: "nohup python3 /tmp/port_listner.py {{ ydb_ports| join(' ') }} &"
28+
shell: "nohup python3 /tmp/port_listner.py {{ inventory_hostname }} {{ ydb_ports| join(' ') }} &"
29+
30+
- name: Additional delay for OS to take ports
31+
ansible.builtin.pause: seconds=5
1332

1433
- name: Check connections between nodes
1534
wait_for:

roles/system/tasks/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
mode: '0644'
3434
- name: Load the {{ ydb_congestion_module }} module
3535
command: "/sbin/modprobe {{ ydb_congestion_module }}"
36-
when: ydb_congestion_module is defined and ansible_distribution != "RedHat"
36+
when: ydb_congestion_module is defined and ydb_congestion_module != '' and ansible_distribution != "RedHat"
3737

3838
- name: Refresh the current sysctl settings
3939
command: "/sbin/sysctl --system"

0 commit comments

Comments
 (0)