info:To determine the technical writer assigned to the Stage/Group associated with this page, see https://handbook.gitlab.com/handbook/product/ux/technical-writing/#assignments
...
...
@@ -35,8 +36,95 @@ databases. Some examples:
## Known issues
- Once data is migrated to the `ci` database, you cannot migrate it back.
- HA setups or PgBouncer setups are not yet supported by this procedure.
## Migrate existing installations using a script
> A script for migrating existing Linux package installations was [introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/368729) in GitLab 16.8.
NOTE:
If something unexpected happens during the migration, it is safe to start over.
### Existing Linux package installations
#### Preparation
1. Verify available disk space:
- The database node that will store the `gitlabhq_production_ci` database needs enough space to store a copy of the existing database: we _duplicate_ `gitlabhq_production`. Run the following SQL query to find out how much space is needed. Add 25%, to ensure you will not run out of disk space.
- During the process, a dump of the `gitlabhq_production` database needs to be temporarily stored on the filesystem of the node that will run the migration. Execute the following SQL statement to find out how much local disk space will be used. Add 25%, to ensure you will not run out of disk space.
```shell
sudo gitlab-psql -c "select sum(pg_table_size(concat(table_schema,'.',table_name))) from information_schema.tables where table_catalog = 'gitlabhq_production' and table_type = 'BASE TABLE'"
```
1. Plan for downtime. The downtime is dependent on the size of the `gitlabhq_production` database.
- We dump `gitlabhq_production` and restore it into a new `gitlabhq_production_ci` database. Database sizes below 100 GB should be done within 30 minutes.
- We advise to also plan some time for smaller tasks like modifying the configuration.
1. Create the new `gitlabhq_production_ci` database:
```shell
sudo gitlab-psql -c"CREATE DATABASE gitlabhq_production_ci WITH OWNER 'gitlab'"
```
#### Migration
This process includes downtime. Running the migration script will stop the GitLab instance. After the migration has been finished, the instance is restarted.