Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e005020c
Commit
e005020c
authored
Oct 29, 2018
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Standardize Geo role setting
parent
8ded352b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
28 deletions
+28
-28
doc/administration/geo/disaster_recovery/index.md
doc/administration/geo/disaster_recovery/index.md
+3
-3
doc/administration/geo/replication/database.md
doc/administration/geo/replication/database.md
+23
-23
doc/administration/geo/replication/high_availability.md
doc/administration/geo/replication/high_availability.md
+2
-2
No files found.
doc/administration/geo/disaster_recovery/index.md
View file @
e005020c
...
@@ -96,7 +96,7 @@ must disable the primary.
...
@@ -96,7 +96,7 @@ must disable the primary.
```ruby
```ruby
## REMOVE THIS LINE
## REMOVE THIS LINE
geo_secondary_role['enable'] = true
roles ['geo_secondary_role']
```
```
A new secondary should not be added at this time. If you want to add a new
A new secondary should not be added at this time. If you want to add a new
...
@@ -125,7 +125,7 @@ The command above does the following changes:
...
@@ -125,7 +125,7 @@ The command above does the following changes:
-
Executes
`gitlab-ctl reconfigure`
to apply the changes in
`/etc/gitlab/gitlab.rb`
-
Executes
`gitlab-ctl reconfigure`
to apply the changes in
`/etc/gitlab/gitlab.rb`
-
Runs
`gitlab-rake geo:set_secondary_as_primary`
-
Runs
`gitlab-rake geo:set_secondary_as_primary`
You need to make sure all the affected machines no longer have
`
geo_secondary_role['enable'] = true
`
in
You need to make sure all the affected machines no longer have
`
roles ['geo_secondary_role']
`
in
`/etc/gitlab/gitlab.rb`
, that you execute the database promotion on the required database nodes
`/etc/gitlab/gitlab.rb`
, that you execute the database promotion on the required database nodes
and you execute the
`gitlab-rake geo:set_secondary_as_primary`
in a machine running the application server.
and you execute the
`gitlab-rake geo:set_secondary_as_primary`
in a machine running the application server.
...
@@ -198,7 +198,7 @@ and after that you also need two extra steps.
...
@@ -198,7 +198,7 @@ and after that you also need two extra steps.
```ruby
```ruby
## Enable a Geo Primary role (if you haven't yet)
## Enable a Geo Primary role (if you haven't yet)
geo_primary_role['enable'] = true
roles ['geo_primary_role']
##
##
# Primary and Secondary addresses
# Primary and Secondary addresses
...
...
doc/administration/geo/replication/database.md
View file @
e005020c
...
@@ -101,10 +101,10 @@ The following guide assumes that:
...
@@ -101,10 +101,10 @@ The following guide assumes that:
This command will also read the `postgresql['sql_replication_user']` Omnibus
This command will also read the `postgresql['sql_replication_user']` Omnibus
setting in case you have changed `gitlab_replicator` username to something
setting in case you have changed `gitlab_replicator` username to something
else.
else.
If you are using an external database not managed by Omnibus GitLab, you need
If you are using an external database not managed by Omnibus GitLab, you need
to create the replicator user and define a password to it manually.
to create the replicator user and define a password to it manually.
Check [How to create replication user][database-source-primary] documentation.
Check [How to create replication user][database-source-primary] documentation.
1.
Configure PostgreSQL to listen on network interfaces
1.
Configure PostgreSQL to listen on network interfaces
...
@@ -161,14 +161,14 @@ The following guide assumes that:
...
@@ -161,14 +161,14 @@ The following guide assumes that:
## Geo Primary role
## Geo Primary role
## - configure dependent flags automatically to enable Geo
## - configure dependent flags automatically to enable Geo
##
##
geo_primary_role['enable'] = true
roles ['geo_primary_role']
##
##
## Primary address
## Primary address
## - replace '1.2.3.4' with the primary public or VPC address
## - replace '1.2.3.4' with the primary public or VPC address
##
##
postgresql['listen_address'] = '1.2.3.4'
postgresql['listen_address'] = '1.2.3.4'
##
##
# Primary and Secondary addresses
# Primary and Secondary addresses
# - replace '1.2.3.4' with the primary public or VPC address
# - replace '1.2.3.4' with the primary public or VPC address
...
@@ -263,8 +263,8 @@ The following guide assumes that:
...
@@ -263,8 +263,8 @@ The following guide assumes that:
gitlab-ctl stop sidekiq
gitlab-ctl stop sidekiq
```
```
NOTE: **Note**:
NOTE: **Note**:
This step is important so we don't try to execute anything before the node is fully configured.
This step is important so we don't try to execute anything before the node is fully configured.
1.
[
Check TCP connectivity
][
rake-maintenance
]
to the primary's PostgreSQL server:
1.
[
Check TCP connectivity
][
rake-maintenance
]
to the primary's PostgreSQL server:
...
@@ -272,7 +272,7 @@ The following guide assumes that:
...
@@ -272,7 +272,7 @@ The following guide assumes that:
gitlab-rake gitlab:tcp_check[1.2.3.4,5432]
gitlab-rake gitlab:tcp_check[1.2.3.4,5432]
```
```
NOTE: **Note**:
NOTE: **Note**:
If this step fails, you may be using the wrong IP address, or a firewall may
If this step fails, you may be using the wrong IP address, or a firewall may
be preventing access to the server. Check the IP address, paying close
be preventing access to the server. Check the IP address, paying close
attention to the difference between public and private addresses and ensure
attention to the difference between public and private addresses and ensure
...
@@ -325,8 +325,8 @@ The following guide assumes that:
...
@@ -325,8 +325,8 @@ The following guide assumes that:
## Geo Secondary role
## Geo Secondary role
## - configure dependent flags automatically to enable Geo
## - configure dependent flags automatically to enable Geo
##
##
geo_secondary_role['enable'] = true
roles ['geo_secondary_role']
##
##
## Secondary address
## Secondary address
## - replace '5.6.7.8' with the secondary public or VPC address
## - replace '5.6.7.8' with the secondary public or VPC address
...
@@ -336,7 +336,7 @@ The following guide assumes that:
...
@@ -336,7 +336,7 @@ The following guide assumes that:
##
##
## Database credentials password (defined previously in primary node)
## Database credentials password (defined previously in primary node)
## - replicate same values here as defined in primary node
## - replicate same values here as defined in primary node
##
##
postgresql['sql_user_password'] = 'fca0b89a972d69f00eb3ec98a5838484'
postgresql['sql_user_password'] = 'fca0b89a972d69f00eb3ec98a5838484'
gitlab_rails['db_password'] = 'mypassword'
gitlab_rails['db_password'] = 'mypassword'
...
@@ -348,7 +348,7 @@ The following guide assumes that:
...
@@ -348,7 +348,7 @@ The following guide assumes that:
```
```
For external PostgreSQL instances, [see additional instructions][external postgresql].
For external PostgreSQL instances, [see additional instructions][external postgresql].
If you bring a former primary back online to serve as a secondary then you also need to remove `
geo_primary_role['enable'] = true
`.
If you bring a former primary back online to serve as a secondary then you also need to remove `
roles ['geo_primary_role']
`.
1.
Reconfigure GitLab for the changes to take effect:
1.
Reconfigure GitLab for the changes to take effect:
...
@@ -362,7 +362,7 @@ The following guide assumes that:
...
@@ -362,7 +362,7 @@ The following guide assumes that:
gitlab-ctl restart postgresql
gitlab-ctl restart postgresql
gitlab-ctl reconfigure
gitlab-ctl reconfigure
```
```
This last reconfigure will provision the FDW configuration and enable it.
This last reconfigure will provision the FDW configuration and enable it.
### Step 3. Initiate the replication process
### Step 3. Initiate the replication process
...
@@ -484,7 +484,7 @@ You only need to follow the steps below if you are not using the managed
...
@@ -484,7 +484,7 @@ You only need to follow the steps below if you are not using the managed
PostgreSQL from a Omnibus GitLab package.
PostgreSQL from a Omnibus GitLab package.
Geo secondary nodes use a tracking database to keep track of replication
Geo secondary nodes use a tracking database to keep track of replication
status and recover automatically from some replication issues.
status and recover automatically from some replication issues.
This is a separate PostgreSQL installation that can be configured to use
This is a separate PostgreSQL installation that can be configured to use
FDW to connect with the secondary database for improved performance.
FDW to connect with the secondary database for improved performance.
...
@@ -495,10 +495,10 @@ the instructions below:
...
@@ -495,10 +495,10 @@ the instructions below:
1.
Edit
`/etc/gitlab/gitlab.rb`
with the connection params and credentials
1.
Edit
`/etc/gitlab/gitlab.rb`
with the connection params and credentials
```ruby
```ruby
# note this is shared between both databases,
# note this is shared between both databases,
# make sure you define the same password in both
# make sure you define the same password in both
gitlab_rails['db_password'] = 'mypassword'
gitlab_rails['db_password'] = 'mypassword'
geo_secondary['db_host'] = '2.3.4.5' # change to the correct public IP
geo_secondary['db_host'] = '2.3.4.5' # change to the correct public IP
geo_secondary['db_port'] = 5431 # change to the correct port
geo_secondary['db_port'] = 5431 # change to the correct port
geo_secondary['db_fdw'] = true # enable FDW
geo_secondary['db_fdw'] = true # enable FDW
...
@@ -510,7 +510,7 @@ the instructions below:
...
@@ -510,7 +510,7 @@ the instructions below:
```bash
```bash
gitlab-ctl reconfigure
gitlab-ctl reconfigure
```
```
1.
Run the tracking database migrations:
1.
Run the tracking database migrations:
```bash
```bash
...
@@ -521,36 +521,36 @@ the instructions below:
...
@@ -521,36 +521,36 @@ the instructions below:
Save the script below in a file, ex. `/tmp/geo_fdw.sh` and modify the connection
Save the script below in a file, ex. `/tmp/geo_fdw.sh` and modify the connection
params to match your environment. Execute it to set up the FDW connection.
params to match your environment. Execute it to set up the FDW connection.
```bash
```bash
#!/bin/bash
#!/bin/bash
# Secondary Database connection params:
# Secondary Database connection params:
DB_HOST="5.6.7.8" # change to the public IP or VPC private IP
DB_HOST="5.6.7.8" # change to the public IP or VPC private IP
DB_NAME="gitlabhq_production"
DB_NAME="gitlabhq_production"
DB_USER="gitlab"
DB_USER="gitlab"
DB_PORT="5432"
DB_PORT="5432"
# Tracking Database connection params:
# Tracking Database connection params:
GEO_DB_HOST="2.3.4.5" # change to the public IP or VPC private IP
GEO_DB_HOST="2.3.4.5" # change to the public IP or VPC private IP
GEO_DB_NAME="gitlabhq_geo_production"
GEO_DB_NAME="gitlabhq_geo_production"
GEO_DB_USER="gitlab_geo"
GEO_DB_USER="gitlab_geo"
GEO_DB_PORT="5432"
GEO_DB_PORT="5432"
query_exec () {
query_exec () {
gitlab-psql -h $GEO_DB_HOST -d $GEO_DB_NAME -p $GEO_DB_PORT -c "${1}"
gitlab-psql -h $GEO_DB_HOST -d $GEO_DB_NAME -p $GEO_DB_PORT -c "${1}"
}
}
query_exec "CREATE EXTENSION postgres_fdw;"
query_exec "CREATE EXTENSION postgres_fdw;"
query_exec "CREATE SERVER gitlab_secondary FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host '${DB_HOST}', dbname '${DB_NAME}', port '${DB_PORT}');"
query_exec "CREATE SERVER gitlab_secondary FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host '${DB_HOST}', dbname '${DB_NAME}', port '${DB_PORT}');"
query_exec "CREATE USER MAPPING FOR ${GEO_DB_USER} SERVER gitlab_secondary OPTIONS (user '${DB_USER}');"
query_exec "CREATE USER MAPPING FOR ${GEO_DB_USER} SERVER gitlab_secondary OPTIONS (user '${DB_USER}');"
query_exec "CREATE SCHEMA gitlab_secondary;"
query_exec "CREATE SCHEMA gitlab_secondary;"
query_exec "GRANT USAGE ON FOREIGN SERVER gitlab_secondary TO ${GEO_DB_USER};"
query_exec "GRANT USAGE ON FOREIGN SERVER gitlab_secondary TO ${GEO_DB_USER};"
```
```
NOTE: **Note:** The script template above uses `gitlab-psql` as it's intended to be executed from the Geo machine,
NOTE: **Note:** The script template above uses `gitlab-psql` as it's intended to be executed from the Geo machine,
but you can change it to `psql` and run it from any machine that has access to the database.
but you can change it to `psql` and run it from any machine that has access to the database.
1.
Restart GitLab
1.
Restart GitLab
```bash
```bash
...
...
doc/administration/geo/replication/high_availability.md
View file @
e005020c
...
@@ -51,7 +51,7 @@ This cluster will serve as the Geo Primary. Use the
...
@@ -51,7 +51,7 @@ This cluster will serve as the Geo Primary. Use the
##
##
## Enable the Geo primary role
## Enable the Geo primary role
##
##
geo_primary_role['enable'] = true
roles ['geo_primary_role']
##
##
## Disable automatic migrations
## Disable automatic migrations
...
@@ -119,7 +119,7 @@ be specified.
...
@@ -119,7 +119,7 @@ be specified.
##
##
## Enable the Geo secondary role
## Enable the Geo secondary role
##
##
geo_secondary_role['enable'] = true
roles ['geo_secondary_role']
##
##
## Disable automatic migrations
## Disable automatic migrations
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment