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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
850405b4
Commit
850405b4
authored
Nov 16, 2016
by
Achilleas Pipinellis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge examples of Redis master/slave + Sentinels for source docs
[ci skip]
parent
b6447f30
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
106 additions
and
67 deletions
+106
-67
doc/administration/high_availability/redis_source.md
doc/administration/high_availability/redis_source.md
+106
-67
No files found.
doc/administration/high_availability/redis_source.md
View file @
850405b4
...
@@ -24,14 +24,16 @@ the Omnibus Redis HA documentation.
...
@@ -24,14 +24,16 @@ the Omnibus Redis HA documentation.
**Table of Contents**
**Table of Contents**
-
[
Configuring your own Redis server
](
#configuring-your-own-redis-server
)
-
[
Configuring your own Redis server
](
#configuring-your-own-redis-server
)
-
[
Prerequisites
](
#prerequisites
)
-
[
Step 1. Configuring the master Redis instance
](
#step-1-configuring-the-master-redis-instance
)
-
[
Step 1. Configuring the master Redis instance
](
#step-1-configuring-the-master-redis-instance
)
-
[
Step 2. Configuring the slave Redis instances
](
#step-2-configuring-the-slave-redis-instances
)
-
[
Step 2. Configuring the slave Redis instances
](
#step-2-configuring-the-slave-redis-instances
)
-
[
Step 3. Configuring the Redis Sentinel instances
](
#step-3-configuring-the-redis-sentinel-instances
)
-
[
Step 3. Configuring the Redis Sentinel instances
](
#step-3-configuring-the-redis-sentinel-instances
)
-
[
Step 4. Configuring the GitLab application
](
#step-4-configuring-the-gitlab-application
)
-
[
Step 4. Configuring the GitLab application
](
#step-4-configuring-the-gitlab-application
)
-
[
Example of minimal configuration with 1 master, 2 slaves and 3 Sentinels
](
#example-of-minimal-configuration-with-1-master-2-slaves-and-3-sentinels
)
-
[
Example of minimal configuration with 1 master, 2 slaves and 3 Sentinels
](
#example-of-minimal-configuration-with-1-master-2-slaves-and-3-sentinels
)
-
[
Configuring Redis Master
](
#configuring-redis-master
)
-
[
Example configuration for Redis master and Sentinel 1
](
#example-configuration-for-redis-master-and-sentinel-1
)
-
[
Configuring Redis Slaves
](
#configuring-redis-slaves
)
-
[
Example configuration for Redis slave 1 and Sentinel 2
](
#example-configuration-for-redis-slave-1-and-sentinel-2
)
-
[
Configuring Redis Sentinel
](
#configuring-redis-sentinel
)
-
[
Example configuration for Redis slave 2 and Sentinel 3
](
#example-configuration-for-redis-slave-2-and-sentinel-3
)
-
[
Example configuration of the GitLab application
](
#example-configuration-of-the-gitlab-application
)
-
[
Troubleshooting
](
#troubleshooting
)
-
[
Troubleshooting
](
#troubleshooting
)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
...
@@ -121,8 +123,8 @@ starting with `sentinel` prefix.
...
@@ -121,8 +123,8 @@ starting with `sentinel` prefix.
Assuming that the Redis Sentinel is installed on the same instance as Redis
Assuming that the Redis Sentinel is installed on the same instance as Redis
master with IP
`10.0.0.1`
(some settings might overlap with the master):
master with IP
`10.0.0.1`
(some settings might overlap with the master):
1.
[
Install Redis
](
../../install/installation.md#6-redis
)
1.
[
Install Redis
Sentinel
](
http://redis.io/topics/sentinel
)
1.
Edit
`/etc/redis/
redis
.conf`
:
1.
Edit
`/etc/redis/
sentinel
.conf`
:
```conf
```conf
## Define a `bind` address pointing to a local IP that your other machines
## Define a `bind` address pointing to a local IP that your other machines
...
@@ -191,8 +193,24 @@ which ideally should not have Redis or Sentinels in the same machine for a HA
...
@@ -191,8 +193,24 @@ which ideally should not have Redis or Sentinels in the same machine for a HA
setup:
setup:
1.
Edit
`/home/git/gitlab/config/resque.yml`
following the example in
1.
Edit
`/home/git/gitlab/config/resque.yml`
following the example in
`/home/git/gitlab/config/resque.yml.example`
, and uncomment the sentinels
[
resque.yml.example
][
resque
]
, and uncomment the Sentinel lines, pointing to
lines, pointing to the correct server credentials.
the correct server credentials:
```yaml
# resque.yaml
production:
url: redis://:redi-password-goes-here@gitlab-redis/
sentinels:
-
host: 10.0.0.1
port: 26379 # point to sentinel, not to redis port
-
host: 10.0.0.2
port: 26379 # point to sentinel, not to redis port
-
host: 10.0.0.3
port: 26379 # point to sentinel, not to redis port
```
1.
[
Restart GitLab
][
restart
]
for the changes to take effect.
1.
[
Restart GitLab
][
restart
]
for the changes to take effect.
...
@@ -206,14 +224,16 @@ In a real world usage, you would also setup firewall rules to prevent
...
@@ -206,14 +224,16 @@ In a real world usage, you would also setup firewall rules to prevent
unauthorized access from other machines, and block traffic from the
unauthorized access from other machines, and block traffic from the
outside (
[
Internet
][
it
]
).
outside (
[
Internet
][
it
]
).
We will use the same
`3`
nodes with
**Redis**
+
**Sentinel**
topology
For this example,
**Sentinel 1**
will be configured in the same machine as the
discussed in the
[
Configuring Redis for GitLab HA
](
redis.md
)
documentation.
**Redis Master**
,
**Sentinel 2**
and
**Sentinel 3**
in the same machines as the
**Slave 1**
and
**Slave 2**
respectively.
Here is a list and description of each
**machine**
and the assigned
**IP**
:
Here is a list and description of each
**machine**
and the assigned
**IP**
:
*
`10.0.0.1`
: Redis Master + Sentinel 1
*
`10.0.0.1`
: Redis Master + Sentinel 1
*
`10.0.0.2`
: Redis Slave 1 + Sentinel 2
*
`10.0.0.2`
: Redis Slave 1 + Sentinel 2
*
`10.0.0.3`
: Redis Slave 2 + Sentinel 3
*
`10.0.0.3`
: Redis Slave 2 + Sentinel 3
*
`10.0.0.4`
: GitLab application
Please note that after the initial configuration, if a failover is initiated
Please note that after the initial configuration, if a failover is initiated
by the Sentinel nodes, the Redis nodes will be reconfigured and the
**Master**
by the Sentinel nodes, the Redis nodes will be reconfigured and the
**Master**
...
@@ -224,81 +244,100 @@ The same thing will happen with `sentinel.conf` that will be overridden after th
...
@@ -224,81 +244,100 @@ The same thing will happen with `sentinel.conf` that will be overridden after th
initial execution, after any new sentinel node starts watching the
**Master**
,
initial execution, after any new sentinel node starts watching the
**Master**
,
or a failover promotes a different
**Master**
node.
or a failover promotes a different
**Master**
node.
###
Configuring Redis Master
###
Example configuration for Redis master and Sentinel 1
**Example configation for Redis Master - `redis.conf`:**
1.
In
`/etc/redis/redis.conf`
:
```
conf
```conf
bind
10
.
0
.
0
.
1
bind 10.0.0.1
port
6379
port 6379
requirepass
redis
-
password
-
goes
-
here
requirepass redis-password-goes-here
masterauth
redis
-
password
-
goes
-
here
masterauth redis-password-goes-here
```
```
1.
In
`/etc/redis/sentinel.conf`
:
### Configuring Redis Slaves
```conf
bind 10.0.0.1
port 26379
sentinel auth-pass gitlab-redis redis-password-goes-here
sentinel monitor gitlab-redis 10.0.0.1 6379 2
sentinel down-after-milliseconds gitlab-redis 10000
sentinel failover_timeout 30000
```
**Example configation for Slave 1 - `redis.conf`:**
1.
Restart the Redis service for the changes to take effect.
```
conf
### Example configuration for Redis slave 1 and Sentinel 2
bind
10
.
0
.
0
.
2
port
6379
requirepass
redis
-
password
-
goes
-
here
masterauth
redis
-
password
-
goes
-
here
# IP and port of the master Redis server
1.
In
`/etc/redis/redis.conf`
:
slaveof
10
.
0
.
0
.
1
6379
```
**Example configation for Slave 2 - `redis.conf`:**
```conf
bind 10.0.0.2
port 6379
requirepass redis-password-goes-here
masterauth redis-password-goes-here
slaveof 10.0.0.1 6379
```
```
conf
1.
In
`/etc/redis/sentinel.conf`
:
bind
10
.
0
.
0
.
3
port
6379
requirepass
redis
-
password
-
goes
-
here
masterauth
redis
-
password
-
goes
-
here
# IP and port of the master Redis server
```conf
slaveof
10
.
0
.
0
.
1
6379
bind 10.0.0.2
```
port 26379
sentinel auth-pass gitlab-redis redis-password-goes-here
sentinel monitor gitlab-redis 10.0.0.1 6379 2
sentinel down-after-milliseconds gitlab-redis 10000
sentinel failover_timeout 30000
```
### Configuring Redis Sentinel
1.
Restart the Redis service for the changes to take effect.
For this example,
**Sentinel 1**
will be configured in the same machine as the
### Example configuration for Redis slave 2 and Sentinel 3
**Redis Master**
,
**Sentinel 2**
and
**Sentinel 3**
in the same machines as the
**Slave 1**
and
**Slave 2**
respectively.
**Example configation for Sentinel 1 - `sentinel.conf`:**
1.
In
`/etc/redis/redis.conf`
:
```
conf
```conf
bind
10
.
0
.
0
.
1
bind 10.0.0.3
port
26379
port 6379
sentinel
auth
-
pass
gitlab
-
redis
redis
-
password
-
goes
-
here
requirepass redis-password-goes-here
sentinel
monitor
gitlab
-
redis
10
.
0
.
0
.
1
6379
2
masterauth redis-password-goes-here
sentinel
down
-
after
-
milliseconds
gitlab
-
redis
10000
slaveof 10.0.0.1 6379
sentinel
failover_timeout
30000
```
```
**Example configation for Sentinel 2 - `sentinel.conf`:**
1.
In
`/etc/redis/sentinel.conf`
:
```
conf
```conf
bind
10
.
0
.
0
.
2
bind 10.0.0.3
port
26379
port 26379
sentinel
auth
-
pass
gitlab
-
redis
redis
-
password
-
goes
-
here
sentinel auth-pass gitlab-redis redis-password-goes-here
sentinel
monitor
gitlab
-
redis
10
.
0
.
0
.
1
6379
2
sentinel monitor gitlab-redis 10.0.0.1 6379 2
sentinel
down
-
after
-
milliseconds
gitlab
-
redis
10000
sentinel down-after-milliseconds gitlab-redis 10000
sentinel
failover_timeout
30000
sentinel failover_timeout 30000
```
```
**Example configation for Sentinel 3 - `sentinel.conf`:**
1.
Restart the Redis service for the changes to take effect.
```
conf
### Example configuration of the GitLab application
bind
10
.
0
.
0
.
3
port
26379
1.
Edit
`/home/git/gitlab/config/resque.yml`
:
sentinel
auth
-
pass
gitlab
-
redis
redis
-
password
-
goes
-
here
sentinel
monitor
gitlab
-
redis
10
.
0
.
0
.
1
6379
2
```yaml
sentinel
down
-
after
-
milliseconds
gitlab
-
redis
10000
production:
sentinel
failover_timeout
30000
url: redis://:redi-password-goes-here@gitlab-redis/
```
sentinels:
-
host: 10.0.0.1
port: 26379 # point to sentinel, not to redis port
-
host: 10.0.0.2
port: 26379 # point to sentinel, not to redis port
-
host: 10.0.0.3
port: 26379 # point to sentinel, not to redis port
```
1.
[
Restart GitLab
][
restart
]
for the changes to take effect.
## Troubleshooting
## Troubleshooting
...
...
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