|
| 1 | +--- |
| 2 | +title: Configuring multiple data disks |
| 3 | +product: '{% data variables.product.prodname_ghe_server %}' |
| 4 | +intro: 'You can configure additional data disks and use them to host MySQL and repositories data.' |
| 5 | +versions: |
| 6 | + ghes: '>= 3.19' |
| 7 | +type: overview |
| 8 | +topics: |
| 9 | + - Enterprise |
| 10 | +--- |
| 11 | + |
| 12 | +> [!NOTE] |
| 13 | +> The ability to configure and use multiple data disks is in {% data variables.release-phases.public_preview %} and subject to change. We would love to hear your feedback on the preview. You can share it with your customer success team, or leave a comment in the [community discussion post](https://github.com/orgs/community/discussions/181173). Our preferred option is sharing your feedback with your customer success team. |
| 14 | +
|
| 15 | +## Why introduce more disks to the GHES instance? |
| 16 | + |
| 17 | +* Improved resource distribution: |
| 18 | + * Different services have unique disk requirements. |
| 19 | + * MySQL is mostly latency and IOPS sensitive. |
| 20 | + * Some resources (such as repositories) don't benefit as much from expensive block storage. |
| 21 | +* Maximized VM limits: |
| 22 | + * A single disk is often not able to max out the limitations of an instance. |
| 23 | + * From a cost perspective, it is usually not feasible or worthwhile to run everything on the most expensive or fastest storage. |
| 24 | +* Clearer separation between resource allocation and services: |
| 25 | + * Resources can be allocated in a targeted way, preventing critical services from being starved. |
| 26 | +* Scaling: |
| 27 | + * Customers on both standalone and high-availability topologies can scale out as needed. |
| 28 | + |
| 29 | +## Constraints |
| 30 | + |
| 31 | +* Multi-data disks are only supported on Standalone and High Availability (HA) topologies. |
| 32 | +* Once multiple data disks are configured in a deployment, this change cannot be undone for that deployment. |
| 33 | +* Setting up multi-data disks and migrating data typically requires some downtime. |
| 34 | + * You can minimize this by configuring a replica with multi-data disks, replicating data from the primary, and then failing over to the replica. |
| 35 | + * If you are adding multi-data disks directly to the primary, expect a much longer downtime. |
| 36 | +* During the public preview, multi-data disks should be used only in non-production environments. |
| 37 | +* It is not recommended to migrate MySQL and repositories to the same disk. |
| 38 | +* Currently, only MySQL and repositories can be migrated to additional disks. |
| 39 | + |
| 40 | +## Resource recommendations |
| 41 | + |
| 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. |
| 43 | + |
| 44 | +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. |
| 45 | + |
| 46 | +## Setting up multiple data disks and data paths |
| 47 | + |
| 48 | +### Prerequisites |
| 49 | + |
| 50 | +* We recommend taking a recent backup of your data before getting started. |
| 51 | +* Create a test environment to try the feature. |
| 52 | + * During the public preview, we recommend **only** using the feature in a test environment. |
| 53 | + * Once the feature becomes generally available, we recommend testing the feature in a non-production environment before using it in production. |
| 54 | + |
| 55 | +### Instructions |
| 56 | + |
| 57 | +1. You can perform fresh installation of GHES or use an existing GHES instance. It should have the data disk configured at `/data/user`. |
| 58 | + |
| 59 | +1. Once `/data/user` is set up, add additional block storage devices to the instance. |
| 60 | + |
| 61 | + Currently, `ghe-storage-find` chooses the first block storage for setting up `/data/user` based on the alphabetical order of the block storage path. This happens on the first boot of the GHES appliance. |
| 62 | + |
| 63 | + To have more control over which disk is used for `/data/user`, it is better to complete the initialization process with only one disk attached initially. |
| 64 | + |
| 65 | +1. Initialize the multi-disk setup using the new block storage devices. To initialize multi-disk support, run `ghe-storage-multi-disk init`. On every reboot, the `ghe-multi-disk.service` will automatically remount the existing data disks at the correct paths. |
| 66 | + |
| 67 | + ``` shell copy |
| 68 | + /usr/local/share/enterprise/ghe-storage-multi-disk init /dev/nvme2n1 db |
| 69 | + ``` |
| 70 | + |
| 71 | + ``` shell copy |
| 72 | + /usr/local/share/enterprise/ghe-storage-multi-disk init /dev/nvme3n1 git |
| 73 | + ``` |
| 74 | + |
| 75 | + 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. |
| 76 | + |
| 77 | +1. Switch to maintenance mode. |
| 78 | + |
| 79 | + ``` shell copy |
| 80 | + gh es maintenance set --enabled true |
| 81 | + ``` |
| 82 | + |
| 83 | +1. Migrate your desired data paths. |
| 84 | + |
| 85 | + To migrate MySQL: |
| 86 | + |
| 87 | + ``` shell copy |
| 88 | + /usr/local/share/enterprise/ghe-storage-migrate-mysql db |
| 89 | + ``` |
| 90 | + |
| 91 | + To migrate repositories: |
| 92 | + |
| 93 | + ``` shell copy |
| 94 | + /usr/local/share/enterprise/ghe-storage-migrate-repositories git |
| 95 | + ``` |
| 96 | + |
| 97 | +1. Exit maintenance mode. |
| 98 | + |
| 99 | + ``` shell copy |
| 100 | + gh es maintenance set --enabled false |
| 101 | + ``` |
| 102 | + |
| 103 | +1. Test the instance for a period of time to make sure everything works as expected. |
| 104 | +1. **Only after sufficient testing**, remove `/data/user/mysql-backup` and `/data/user/repositories-backup`. |
| 105 | + |
| 106 | + 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. |
| 107 | + |
| 108 | +### Guidance for high availability configurations |
| 109 | + |
| 110 | +The following guidance helps reduce downtime in high availability (HA) topologies. If you are using a standalone topology, we do not have similar additional guidance at this time. |
| 111 | + |
| 112 | +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. |
| 113 | + |
| 114 | +1. Set up a new HA replica with better disks. |
| 115 | + |
| 116 | + 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. |
| 117 | + |
| 118 | +1. Set up multi-disk on the new HA replica. |
| 119 | +1. Allow the HA primary to replicate to the replica. |
| 120 | +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). |
| 121 | + |
| 122 | +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. |
| 123 | + |
| 124 | +## Example: configuring two additional disks |
| 125 | + |
| 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`. |
| 127 | + |
| 128 | +```shell |
| 129 | +admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk status |
| 130 | +Checking system status... |
| 131 | +
|
| 132 | +admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk info |
| 133 | +Dumping disk status and information... |
| 134 | +
|
| 135 | +admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk init /dev/nvme2n1 db |
| 136 | +Starting initialization sequence for /dev/nvme2n1 at /data/multi-disk/db... |
| 137 | +
|
| 138 | +admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk init /dev/nvme3n1 git |
| 139 | +Starting initialization sequence for /dev/nvme3n1 at /data/multi-disk/git... |
| 140 | +
|
| 141 | +admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-migrate-mysql db |
| 142 | +Start mysql migration to /data/multi-disk/db... |
| 143 | +Running checks.. |
| 144 | +Error: maintenance mode must be enabled before being able to proceed. |
| 145 | +ERROR: Last Command: return 1 LINE: 36 ghe-storage-migrate-mysql |
| 146 | +Script exited with exit code: 1 |
| 147 | +
|
| 148 | +admin@ghe-test-primary:~$ ghe-maintenance -s |
| 149 | +
|
| 150 | +admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-migrate-mysql db |
| 151 | +Start repository migration to /data/multi-disk/db... |
| 152 | +Success: /data/user/mysql moved to /data/multi-disk/db/mysql |
| 153 | +Script exited with exit code: 0 |
| 154 | +
|
| 155 | +admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-migrate-repositories git |
| 156 | +Start repository migration to /data/multi-disk/git... |
| 157 | +Success: /data/user/repositories moved to /data/multi-disk/git |
| 158 | +Script exited with exit code: 0 |
| 159 | +
|
| 160 | +admin@ghe-test-primary:~$ ghe-maintenance -u |
| 161 | +
|
| 162 | +admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk status |
| 163 | +Checking system status... |
| 164 | +/data/user/mysql -> /data/multi-disk/db/mysql is correctly symlinked. |
| 165 | +Repositories migration was detected... |
| 166 | +/data/user/repositories -> /data/multi-disk/git/repositories is correctly symlinked. |
| 167 | +
|
| 168 | +admin@ghe-test-primary:~$ /usr/local/share/enterprise/ghe-storage-multi-disk info |
| 169 | +Dumping disk status and information... |
| 170 | +# Multi disk configuration /data/user/multi-disk-config: |
| 171 | +DISK_DB="lvm" |
| 172 | +DISK_GIT="lvm" |
| 173 | +MYSQL_MIGRATION_PATH="/data/multi-disk/db/mysql" |
| 174 | +REPOSITORIES_MIGRATION_PATH="/data/multi-disk/git/repositories" |
| 175 | +
|
| 176 | +admin@ghe-test-primary:~$ ls /var/log/multi-disk/ |
| 177 | +ghe-storage-init-db.log ghe-storage-init-git.log ghe-storage-migrate-mysql.log ghe-storage-migrate-repositories.log |
| 178 | +
|
| 179 | +``` |
| 180 | + |
| 181 | +## Hygiene checks |
| 182 | + |
| 183 | +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. |
| 184 | + |
| 185 | +To view the current multi-disk configuration, use: |
| 186 | + |
| 187 | +```shell |
| 188 | +$ cat /data/user/multi-disk-config |
| 189 | +DISK_DB="lvm" |
| 190 | +DISK_GIT="lvm" |
| 191 | +MYSQL_MIGRATION_PATH="/data/multi-disk/db/mysql" |
| 192 | +REPOSITORIES_MIGRATION_PATH="/data/multi-disk/git/repositories" |
| 193 | +``` |
| 194 | + |
| 195 | +To review multi-disk logs, including disk initialization and migration events, run: |
| 196 | + |
| 197 | +```shell |
| 198 | +$ ls -l /var/log/multi-disk/ |
| 199 | +total 56 |
| 200 | +-rw-r--r-- 1 root root 2398 Mar 3 13:22 ghe-storage-init-db.log |
| 201 | +-rw-r--r-- 1 root root 2497 Mar 3 13:23 ghe-storage-init-git.log |
| 202 | +-rw-r--r-- 1 root root 2201 Mar 3 13:28 ghe-storage-migrate-mysql.log |
| 203 | +-rw-r--r-- 1 root root 37296 Mar 3 13:30 ghe-storage-migrate-repositories.log |
| 204 | +``` |
| 205 | + |
| 206 | +## Commands for managing multiple disks |
| 207 | + |
| 208 | +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. |
| 209 | + |
| 210 | +The commands include: |
| 211 | + |
| 212 | +* ghe-storage-multi-disk |
| 213 | + * `status` |
| 214 | + * `init` |
| 215 | + * `info` |
| 216 | + * `mount` |
| 217 | + * `start-services` (only recommended for debugging) |
| 218 | + * `stop-services` (only recommended for debugging) |
| 219 | +* ghe-storage-migrate-repositories |
| 220 | + * Migrates `/data/user/repositories` to any disk path created using `ghe-storage-multi-disk init`. |
| 221 | +* ghe-storage-migrate-mysql |
| 222 | + * Migrates `/data/user/mysql` to any disk path created using `ghe-storage-multi-disk init`. |
0 commit comments