Commit 874e714c authored by Marcin Sedlak-Jakubowski's avatar Marcin Sedlak-Jakubowski

Merge branch 'add-pg-btree_gist-docs' into 'master'

Document PSQL `btree_gist` extension requirement

See merge request gitlab-org/gitlab!33118
parents e30e95e9 a38921bd
...@@ -305,6 +305,12 @@ Select one node as a primary node. ...@@ -305,6 +305,12 @@ Select one node as a primary node.
CREATE EXTENSION pg_trgm; CREATE EXTENSION pg_trgm;
``` ```
1. Enable the `btree_gist` extension:
```shell
CREATE EXTENSION btree_gist;
```
1. Exit the database prompt by typing `\q` and Enter. 1. Exit the database prompt by typing `\q` and Enter.
1. Verify the cluster is initialized with one node: 1. Verify the cluster is initialized with one node:
...@@ -736,9 +742,9 @@ consul['configuration'] = { ...@@ -736,9 +742,9 @@ consul['configuration'] = {
After deploying the configuration follow these steps: After deploying the configuration follow these steps:
1. On `10.6.0.31`, our primary database 1. On `10.6.0.31`, our primary database:
Enable the `pg_trgm` extension Enable the `pg_trgm` and `btree_gist` extensions:
```shell ```shell
gitlab-psql -d gitlabhq_production gitlab-psql -d gitlabhq_production
...@@ -746,33 +752,34 @@ After deploying the configuration follow these steps: ...@@ -746,33 +752,34 @@ After deploying the configuration follow these steps:
```shell ```shell
CREATE EXTENSION pg_trgm; CREATE EXTENSION pg_trgm;
CREATE EXTENSION btree_gist;
``` ```
1. On `10.6.0.32`, our first standby database 1. On `10.6.0.32`, our first standby database:
Make this node a standby of the primary Make this node a standby of the primary:
```shell ```shell
gitlab-ctl repmgr standby setup 10.6.0.21 gitlab-ctl repmgr standby setup 10.6.0.21
``` ```
1. On `10.6.0.33`, our second standby database 1. On `10.6.0.33`, our second standby database:
Make this node a standby of the primary Make this node a standby of the primary:
```shell ```shell
gitlab-ctl repmgr standby setup 10.6.0.21 gitlab-ctl repmgr standby setup 10.6.0.21
``` ```
1. On `10.6.0.41`, our application server 1. On `10.6.0.41`, our application server:
Set `gitlab-consul` user's PgBouncer password to `toomanysecrets` Set `gitlab-consul` user's PgBouncer password to `toomanysecrets`:
```shell ```shell
gitlab-ctl write-pgpass --host 127.0.0.1 --database pgbouncer --user pgbouncer --hostuser gitlab-consul gitlab-ctl write-pgpass --host 127.0.0.1 --database pgbouncer --user pgbouncer --hostuser gitlab-consul
``` ```
Run database migrations Run database migrations:
```shell ```shell
gitlab-rake gitlab:db:configure gitlab-rake gitlab:db:configure
...@@ -1324,7 +1331,7 @@ You can switch an exiting database cluster to use Patroni instead of repmgr with ...@@ -1324,7 +1331,7 @@ You can switch an exiting database cluster to use Patroni instead of repmgr with
NOTE: **Note:** NOTE: **Note:**
Ensure that there is no `walsender` process running on the primary node. Ensure that there is no `walsender` process running on the primary node.
`ps aux | grep walsender` must not show any running process. `ps aux | grep walsender` must not show any running process.
1. On the primary node, [configure Patroni](#configuring-patroni-cluster). Remove `repmgr` and any other 1. On the primary node, [configure Patroni](#configuring-patroni-cluster). Remove `repmgr` and any other
repmgr-specific configuration. Also remove any configuration that is related to PostgreSQL replication. repmgr-specific configuration. Also remove any configuration that is related to PostgreSQL replication.
......
...@@ -57,6 +57,7 @@ This section is for links to information elsewhere in the GitLab documentation. ...@@ -57,6 +57,7 @@ This section is for links to information elsewhere in the GitLab documentation.
- [GitLab database requirements](../../install/requirements.md#database) including - [GitLab database requirements](../../install/requirements.md#database) including
- Support for MySQL was removed in GitLab 12.1; [migrate to PostgreSQL](../../update/mysql_to_postgresql.md) - Support for MySQL was removed in GitLab 12.1; [migrate to PostgreSQL](../../update/mysql_to_postgresql.md)
- required extension `pg_trgm` - required extension `pg_trgm`
- required extension `btree_gist`
- required extension `postgres_fdw` for Geo - required extension `postgres_fdw` for Geo
- Errors like this in the `production/sidekiq` log; see: [Set default_transaction_isolation into read committed](https://docs.gitlab.com/omnibus/settings/database.html#set-default_transaction_isolation-into-read-committed): - Errors like this in the `production/sidekiq` log; see: [Set default_transaction_isolation into read committed](https://docs.gitlab.com/omnibus/settings/database.html#set-default_transaction_isolation-into-read-committed):
......
...@@ -473,9 +473,9 @@ Since we're adding our SSL certificate at the load balancer, we do not need GitL ...@@ -473,9 +473,9 @@ Since we're adding our SSL certificate at the load balancer, we do not need GitL
sudo gitlab-ctl reconfigure sudo gitlab-ctl reconfigure
``` ```
#### Install the `pg_trgm` extension for PostgreSQL #### Install the required extensions for PostgreSQL
From your GitLab instance, connect to the RDS instance to verify access and to install the required `pg_trgm` extension. From your GitLab instance, connect to the RDS instance to verify access and to install the required `pg_trgm` and `btree_gist` extensions.
To find the host or endpoint, navigate to **Amazon RDS > Databases** and click on the database you created earlier. Look for the endpoint under the **Connectivity & security** tab. To find the host or endpoint, navigate to **Amazon RDS > Databases** and click on the database you created earlier. Look for the endpoint under the **Connectivity & security** tab.
...@@ -492,6 +492,7 @@ psql (10.9) ...@@ -492,6 +492,7 @@ psql (10.9)
Type "help" for help. Type "help" for help.
gitlab=# CREATE EXTENSION pg_trgm; gitlab=# CREATE EXTENSION pg_trgm;
gitlab=# CREATE EXTENSION btree_gist;
gitlab=# \q gitlab=# \q
``` ```
......
...@@ -339,6 +339,12 @@ Starting from GitLab 12.1, only PostgreSQL is supported. Since GitLab 13.0, we r ...@@ -339,6 +339,12 @@ Starting from GitLab 12.1, only PostgreSQL is supported. Since GitLab 13.0, we r
sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;"
``` ```
1. Create the `btree_gist` extension (required for GitLab 13.1+):
```shell
sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS btree_gist;"
```
1. Create the GitLab production database and grant all privileges on the database: 1. Create the GitLab production database and grant all privileges on the database:
```shell ```shell
...@@ -369,6 +375,24 @@ Starting from GitLab 12.1, only PostgreSQL is supported. Since GitLab 13.0, we r ...@@ -369,6 +375,24 @@ Starting from GitLab 12.1, only PostgreSQL is supported. Since GitLab 13.0, we r
(1 row) (1 row)
``` ```
1. Check if the `btree_gist` extension is enabled:
```sql
SELECT true AS enabled
FROM pg_available_extensions
WHERE name = 'btree_gist'
AND installed_version IS NOT NULL;
```
If the extension is enabled this will produce the following output:
```plaintext
enabled
---------
t
(1 row)
```
1. Quit the database session: 1. Quit the database session:
```shell ```shell
......
...@@ -140,8 +140,8 @@ GitLab version | Minimum PostgreSQL version ...@@ -140,8 +140,8 @@ GitLab version | Minimum PostgreSQL version
12.10 | 11 12.10 | 11
13.0 | 11 13.0 | 11
You must also ensure the `pg_trgm` extension is loaded into every You must also ensure the `pg_trgm` and `btree_gist` extensions are loaded into every
GitLab database. This extension [can be enabled](https://www.postgresql.org/docs/11/sql-createextension.html) using a PostgreSQL super user. GitLab database. These extensions [can be enabled](https://www.postgresql.org/docs/11/sql-createextension.html) using a PostgreSQL super user.
On some systems you may need to install an additional package (for example, On some systems you may need to install an additional package (for example,
`postgresql-contrib`) for this extension to become available. `postgresql-contrib`) for this extension to become available.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment