Skip to content

Commit 499c5ac

Browse files
Added documentation for multi-disk log migrations (#59652)
Co-authored-by: Ben Ahmady <32935794+subatoi@users.noreply.github.com>
1 parent a475709 commit 499c5ac

File tree

1 file changed

+228
-7
lines changed

1 file changed

+228
-7
lines changed

content/admin/monitoring-and-managing-your-instance/multiple-data-disks/configuring-multiple-data-disks.md

Lines changed: 228 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Configuring multiple data disks
33
product: '{% data variables.product.prodname_ghe_server %}'
4-
intro: 'You can configure additional data disks and use them to host MySQL and repositories data.'
4+
intro: 'You can configure additional data disks and use them to host data of different services.'
55
versions:
66
ghes: '>= 3.19'
77
type: overview
@@ -25,6 +25,10 @@ topics:
2525
* Resources can be allocated in a targeted way, preventing critical services from being starved.
2626
* Scaling:
2727
* Customers on both standalone and high-availability topologies can scale out as needed.
28+
{% ifversion ghes > 3.19 %}
29+
* Resiliency:
30+
* Isolating logs from the root disk enhances resiliency by preventing the volume of logs from flooding the root disk.
31+
{%- endif %}
2832

2933
## Constraints
3034

@@ -34,12 +38,19 @@ topics:
3438
* You can minimize this by configuring a replica with multi-data disks, replicating data from the primary, and then failing over to the replica.
3539
* If you are adding multi-data disks directly to the primary, expect a much longer downtime.
3640
* During the public preview, multi-data disks should be used only in non-production environments.
41+
{% ifversion ghes < 3.20 %}
3742
* It is not recommended to migrate MySQL and repositories to the same disk.
3843
* Currently, only MySQL and repositories can be migrated to additional disks.
44+
{%- endif %}
45+
{% ifversion ghes > 3.19 %}
46+
* It is not recommended to migrate MySQL, repositories, system logs, or {% data variables.product.github %} logs to the same disk. Each additional disk should only contain one migration.
47+
* Currently, only MySQL, repositories, system logs, and {% data variables.product.github %} logs can be migrated to additional disks.
48+
* Rebooting the {% data variables.product.prodname_ghe_server %} node is required after migrating system logs to ensure it is working on a system level. It will take some time as config apply also runs during startup of the node.
49+
{%- endif %}
3950

4051
## Resource recommendations
4152

42-
If you add disks that are as fast or faster than your current ones, you should see improved performance. Storage devices are typically measured by IOPS (Input/Output Operations Per Second), throughput, and latency. For MySQL, we recommend using a disk with lower latency and higher IOPS than your existing data disk. For repositories, choose a disk with higher IOPS and throughput than your current data disk.
53+
If you add disks that are as fast or faster than your current ones, you should see improved performance. Storage devices are typically measured by IOPS (Input/Output Operations Per Second), throughput, and latency. For MySQL, we recommend using a disk with lower latency and higher IOPS than your existing data disk. For repositories, choose a disk with higher IOPS and throughput than your current data disk.{% ifversion ghes > 3.19 %} For logs, we recommend using a disk with higher IOPS and throughput than your existing data disk to handle continuous write operations from logging activities. {%- endif %}
4354

4455
In high availability setups, it is best to use multi-data disks on both the primary and all replicas. Mixing configurations, where the primary has multi-data disks but the replica does not, is not recommended.
4556

@@ -72,7 +83,25 @@ In high availability setups, it is best to use multi-data disks on both the prim
7283
/usr/local/share/enterprise/ghe-storage-multi-disk init /dev/nvme3n1 git
7384
```
7485

86+
{% ifversion ghes > 3.19 %}
87+
88+
``` shell copy
89+
/usr/local/share/enterprise/ghe-storage-multi-disk init /dev/nvme4n1 systemlogs
90+
```
91+
92+
93+
``` shell copy
94+
/usr/local/share/enterprise/ghe-storage-multi-disk init /dev/nvme5n1 githublogs
95+
```
96+
97+
{%- endif %}
98+
99+
{% ifversion ghes < 3.20 %}
75100
Please note that `/dev/nvme2n1` and `/dev/nvme3n1` are example paths only. They might not match the paths on your system. Similarly, `db` and `git` are examples. You may choose different names.
101+
{%- endif %}
102+
{% ifversion ghes > 3.19 %}
103+
Please note that `/dev/nvme2n1`, `/dev/nvme3n1`, `/dev/nvme4n1`, and `/dev/nvme5n1` are example paths only. They might not match the paths on your system. Similarly, `db`, `git`, `systemlogs`, and `githublogs` are examples. You may choose different names.
104+
{%- endif %}
76105

77106
1. Switch to maintenance mode.
78107

@@ -94,14 +123,39 @@ In high availability setups, it is best to use multi-data disks on both the prim
94123
/usr/local/share/enterprise/ghe-storage-migrate-repositories git
95124
```
96125

126+
{% ifversion ghes > 3.19 %}
127+
To migrate system logs:
128+
129+
``` shell copy
130+
/usr/local/share/enterprise/ghe-storage-migrate-logs systemlogs
131+
```
132+
133+
After migrating system logs, reboot the instance:
134+
135+
``` shell copy
136+
sudo reboot
137+
```
138+
139+
To migrate {% data variables.product.github %} logs:
140+
141+
``` shell copy
142+
/usr/local/share/enterprise/ghe-storage-migrate-github-logs githublogs
143+
```
144+
{%- endif %}
145+
97146
1. Exit maintenance mode.
98147

99148
``` shell copy
100149
gh es maintenance set --enabled false
101150
```
102151

103152
1. Test the instance for a period of time to make sure everything works as expected.
153+
{% ifversion ghes < 3.20 %}
104154
1. **Only after sufficient testing**, remove `/data/user/mysql-backup` and `/data/user/repositories-backup`.
155+
{%- endif %}
156+
{% ifversion ghes > 3.19 %}
157+
1. **Only after sufficient testing**, remove `/data/user/mysql-backup`, `/data/user/repositories-backup`, `/var/log-backup`, `/data/github/current/log-backup`, and `/data/github/shared/log-backup`.
158+
{%- endif %}
105159

106160
Keeping these folders during testing allows you to roll back in an emergency. After sufficient testing, you should remove those backup folders to free up space.
107161

@@ -112,18 +166,24 @@ The following guidance helps reduce downtime in high availability (HA) topologie
112166
For HA topologies, the best approach is to stand up a new replica with multiple data disks configured, replicate data from the primary, and then promote the replica to primary. Migrating data to additional disks on the current primary is not recommended, as this process can lead to significant downtime.
113167

114168
1. Set up a new HA replica with better disks.
115-
169+
{% ifversion ghes < 3.20 %}
116170
To plan for the data migration, use `du -sh /data/user/mysql` and `du -sh /data/user/repositories` on the primary to calculate disk space requirements for the new replica.
171+
{%- endif %}
172+
{% ifversion ghes > 3.19 %}
173+
To plan for the data migration, use `du -sh /data/user/mysql`, `du -sh /data/user/repositories`, `du -sh /var/log`, `du -sh /data/github/current/log`, and `du -sh /data/github/shared/log` on the primary to calculate disk space requirements for the new replica.
174+
{%- endif %}
117175

118176
1. Set up multi-disk on the new HA replica.
119177
1. Allow the HA primary to replicate to the replica.
120178
1. Follow the failover sequence as documented in [AUTOTITLE](/admin/monitoring-and-managing-your-instance/configuring-high-availability/initiating-a-failover-to-your-replica-appliance).
121179

122180
While the replication process can take a long time, the advantage is that it runs in the background, so the actual disruption from maintenance mode is dramatically reduced.
123181

124-
## Example: configuring two additional disks
182+
## Example: configuring additional disks
183+
184+
This example demonstrates the required commands and outputs for disk initialization and data migration. Specifically, `/data/user/mysql` is migrated to `/data/multi-disk/db/mysql`, and `/data/user/repositories` is migrated to `/data/multi-disk/git/repositories`.{% ifversion ghes > 3.19 %} Additionally, system logs are migrated to `/data/multi-disk/systemlogs/log`, and {% data variables.product.github %} logs are migrated to `/data/multi-disk/githublogs`.{%- endif %}
125185

126-
This example demonstrates the required commands and outputs for disk initialization and data migration. Specifically, `/data/user/mysql` is migrated to `/data/multi-disk/db/mysql`, and `/data/user/repositories` is migrated to `/data/multi-disk/git/repositories`.
186+
{% ifversion ghes < 3.20 %}
127187

128188
```shell
129189
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk status
@@ -139,7 +199,7 @@ admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk ini
139199
Starting initialization sequence for /dev/nvme3n1 at /data/multi-disk/git...
140200
141201
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-migrate-mysql db
142-
Start mysql migration to /data/multi-disk/db...
202+
Start MySQL migration to /data/multi-disk/db...
143203
Running checks..
144204
Error: maintenance mode must be enabled before being able to proceed.
145205
ERROR: Last Command: return 1 LINE: 36 ghe-storage-migrate-mysql
@@ -148,7 +208,7 @@ Script exited with exit code: 1
148208
admin@ghe-test-primary:~$ ghe-maintenance -s
149209
150210
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-migrate-mysql db
151-
Start repository migration to /data/multi-disk/db...
211+
Start MySQL migration to /data/multi-disk/db...
152212
Success: /data/user/mysql moved to /data/multi-disk/db/mysql
153213
Script exited with exit code: 0
154214
@@ -178,22 +238,159 @@ ghe-storage-init-db.log ghe-storage-init-git.log ghe-storage-migrate-mysql.log
178238
179239
```
180240

241+
{%- endif %}
242+
243+
{% ifversion ghes > 3.19 %}
244+
245+
```shell
246+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk status
247+
Checking system status...
248+
249+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk info
250+
Dumping disk status and information...
251+
252+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk init /dev/nvme2n1 db
253+
Starting initialization sequence for /dev/nvme2n1 at /data/multi-disk/db...
254+
255+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk init /dev/nvme3n1 git
256+
Starting initialization sequence for /dev/nvme3n1 at /data/multi-disk/git...
257+
258+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk init /dev/nvme4n1 systemlogs
259+
Starting initialization sequence for /dev/nvme4n1 at /data/multi-disk/systemlogs...
260+
261+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk init /dev/nvme5n1 githublogs
262+
Starting initialization sequence for /dev/nvme5n1 at /data/multi-disk/githublogs...
263+
264+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-migrate-mysql db
265+
Start MySQL migration to /data/multi-disk/db...
266+
Running checks..
267+
Error: maintenance mode must be enabled before being able to proceed.
268+
ERROR: Last Command: return 1 LINE: 36 ghe-storage-migrate-mysql
269+
Script exited with exit code: 1
270+
271+
admin@ghe-test-primary:~$ ghe-maintenance -s
272+
273+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-migrate-mysql db
274+
Start MySQL migration to /data/multi-disk/db...
275+
Success: /data/user/mysql moved to /data/multi-disk/db/mysql
276+
Script exited with exit code: 0
277+
278+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-migrate-repositories git
279+
Start repository migration to /data/multi-disk/git...
280+
Success: /data/user/repositories moved to /data/multi-disk/git
281+
Script exited with exit code: 0
282+
283+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-migrate-logs systemlogs
284+
Start log migration to /data/multi-disk/systemlogs...
285+
Success: /var/log moved to /data/multi-disk/systemlogs/log
286+
Please restart the GitHub Enterprise instance to apply the changes.
287+
Script exited with exit code: 0
288+
289+
admin@ghe-test-primary:~$ sudo reboot
290+
291+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-migrate-github-logs githublogs
292+
Error: Config apply currently in progress. Please wait for it to finish...
293+
294+
# Wait for config apply to finish
295+
296+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-migrate-github-logs githublogs
297+
Start github log migration to /data/multi-disk/githublogs...
298+
Success: moved to /data/multi-disk/githublogs
299+
Script exited with exit code: 0
300+
301+
admin@ghe-test-primary:~$ ghe-maintenance -u
302+
303+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk status
304+
Checking system status...
305+
Multi disk setup is enabled...
306+
Potential disks are automatically mounted on startup...
307+
# Disk check
308+
Detected multi disk path at /data/multi-disk/db...
309+
/data/multi-disk/db is set up correctly for multi disk use.
310+
Detected multi disk path at /data/multi-disk/git...
311+
/data/multi-disk/git is set up correctly for multi disk use.
312+
Detected multi disk path at /data/multi-disk/githublogs...
313+
/data/multi-disk/githublogs is set up correctly for multi disk use.
314+
Detected multi disk path at /data/multi-disk/systemlogs...
315+
/data/multi-disk/systemlogs is set up correctly for multi disk use.
316+
# Service migration check
317+
MySQL migration was detected...
318+
/data/user/mysql -> /data/multi-disk/db/mysql is correctly symlinked.
319+
Repositories migration was detected...
320+
/data/user/repositories -> /data/multi-disk/git/repositories is correctly symlinked.
321+
GitHub current log migration was detected...
322+
/data/github/current/log -> /data/multi-disk/githublogs/github-current-log is correctly symlinked.
323+
GitHub shared log migration was detected...
324+
/data/github/shared/log -> /data/multi-disk/githublogs/github-shared-log is correctly symlinked.
325+
Logs migration was detected...
326+
/var/log -> /data/multi-disk/systemlogs/log is correctly symlinked.
327+
328+
admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk info
329+
Dumping disk status and information...
330+
# Multi disk configuration /data/user/multi-disk-config:
331+
DISK_DB="lvm"
332+
DISK_GIT="lvm"
333+
DISK_SYSTEMLOGS="lvm"
334+
DISK_GITHUBLOGS="lvm"
335+
MYSQL_MIGRATION_PATH="/data/multi-disk/db/mysql"
336+
REPOSITORIES_MIGRATION_PATH="/data/multi-disk/git/repositories"
337+
# Multi-disk logs path is stored in /etc/multi-disk/ghe-multi-disk-logs-mount
338+
GHCURRENT_LOG_MIGRATION_PATH="/data/multi-disk/githublogs/github-current-log"
339+
GHSHARED_LOG_MIGRATION_PATH="/data/multi-disk/githublogs/github-shared-log"
340+
ENABLE_MULTI_DISK_LOGS_MOUNT=true
341+
342+
LOGS_MIGRATION_PATH=/data/multi-disk/systemlogs/log
343+
344+
admin@ghe-test-primary:~$ ls /var/log/multi-disk/
345+
ghe-storage-init-db.log ghe-storage-init-git.log ghe-storage-migrate-github-logs.log ghe-storage-migrate-mysql.log ghe-storage-init-githublogs.log ghe-storage-init-systemlogs.log ghe-storage-migrate-logs.log ghe-storage-migrate-repositories.log
346+
347+
```
348+
349+
{%- endif %}
350+
181351
## Hygiene checks
182352

183353
Both `/usr/local/share/enterprise/ghe-storage-multi-disk status` and `/usr/local/share/enterprise/ghe-storage-multi-disk info` are helpful for checking your setup.
184354

185355
To view the current multi-disk configuration, use:
186356

357+
{% ifversion ghes < 3.20 %}
358+
359+
```shell
360+
$ cat /data/user/multi-disk-config
361+
DISK_DB="lvm"
362+
DISK_GIT="lvm"
363+
MYSQL_MIGRATION_PATH="/data/multi-disk/db/mysql"
364+
REPOSITORIES_MIGRATION_PATH="/data/multi-disk/git/repositories"
365+
```
366+
367+
{%- endif %}
368+
{% ifversion ghes > 3.19 %}
369+
187370
```shell
188371
$ cat /data/user/multi-disk-config
189372
DISK_DB="lvm"
190373
DISK_GIT="lvm"
374+
DISK_SYSTEMLOGS="lvm"
375+
DISK_GITHUBLOGS="lvm"
191376
MYSQL_MIGRATION_PATH="/data/multi-disk/db/mysql"
192377
REPOSITORIES_MIGRATION_PATH="/data/multi-disk/git/repositories"
378+
# Multi-disk logs path is stored in /etc/multi-disk/ghe-multi-disk-logs-mount
379+
GHCURRENT_LOG_MIGRATION_PATH="/data/multi-disk/githublogs/github-current-log"
380+
GHSHARED_LOG_MIGRATION_PATH="/data/multi-disk/githublogs/github-shared-log"
381+
382+
$ cat /etc/multi-disk/ghe-multi-disk-logs-mount
383+
ENABLE_MULTI_DISK_LOGS_MOUNT=true
384+
385+
LOGS_MIGRATION_PATH=/data/multi-disk/systemlogs/log
193386
```
194387

388+
{%- endif %}
389+
195390
To review multi-disk logs, including disk initialization and migration events, run:
196391

392+
{% ifversion ghes < 3.20 %}
393+
197394
```shell
198395
$ ls -l /var/log/multi-disk/
199396
total 56
@@ -203,6 +400,24 @@ total 56
203400
-rw-r--r-- 1 root root 37296 Mar 3 13:30 ghe-storage-migrate-repositories.log
204401
```
205402

403+
{%- endif %}
404+
{% ifversion ghes > 3.19 %}
405+
406+
```shell
407+
$ ls -l /var/log/multi-disk/
408+
total 64
409+
-rw-r--r-- 1 root root 2115 Feb 13 16:32 ghe-storage-init-db.log
410+
-rw-r--r-- 1 root root 2478 Feb 13 16:36 ghe-storage-init-githublogs.log
411+
-rw-r--r-- 1 root root 2114 Feb 13 16:36 ghe-storage-init-git.log
412+
-rw-r--r-- 1 root root 2378 Feb 13 16:36 ghe-storage-init-systemlogs.log
413+
-rw-r--r-- 1 root root 20450 Feb 13 17:27 ghe-storage-migrate-github-logs.log
414+
-rw-r--r-- 1 root root 1053 Feb 13 17:15 ghe-storage-migrate-logs.log
415+
-rw-r--r-- 1 root root 2460 Feb 13 16:38 ghe-storage-migrate-mysql.log
416+
-rw-r--r-- 1 root root 19011 Feb 13 16:42 ghe-storage-migrate-repositories.log
417+
```
418+
419+
{%- endif %}
420+
206421
## Commands for managing multiple disks
207422

208423
These commands make it possible to add multiple disks and migrate specific services or folder paths to those disks. The original folder paths are maintained and kept static. Other services are unaware that anything has changed. The static folder paths are symlinked to the newly migrated paths.
@@ -220,3 +435,9 @@ The commands include:
220435
* Migrates `/data/user/repositories` to any disk path created using `ghe-storage-multi-disk init`.
221436
* ghe-storage-migrate-mysql
222437
* Migrates `/data/user/mysql` to any disk path created using `ghe-storage-multi-disk init`.
438+
{% ifversion ghes > 3.19 %}
439+
* ghe-storage-migrate-logs
440+
* Migrates `/var/log` to any disk path created using `ghe-storage-multi-disk init`.
441+
* ghe-storage-migrate-github-logs
442+
* Migrates `/data/github/current/log` and `/data/github/shared/log` to any disk path created using `ghe-storage-multi-disk init`.
443+
{%- endif %}

0 commit comments

Comments
 (0)