Configure sentinel password for go-redis
What does this MR do and why?
This MR adds SentinelPassword
into the Redis config struct to be used in goredis
package. This resolves #422820 (closed).
This will not be used by self-managed as we have not released goredis
as the default redis client.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Set up a Redis Sentinel with different passwords for Redis Server and Redis Sentinel (you could try out https://gitlab.com/schin1/redis-sentinel-setup/-/blob/main/start.sh). Update workhorse/config.toml
to something like the following:
[redis]
Password = "password123"
SentinelMaster = "mymaster"
SentinelPassword = "password456"
Sentinel = [
"redis://127.0.0.1:26480",
"redis://127.0.0.1:26481",
"redis://127.0.0.1:26482",
]
Use gdk tail gitlab-workhorse
to verify connectivity. The logs should be something like:
2023-09-12_07:54:14.59079 gitlab-workhorse : {"level":"info","msg":"Using redis/go-redis","time":"2023-09-12T15:54:14+08:00"}
2023-09-12_07:54:14.59080 gitlab-workhorse : {"level":"info","msg":"keywatcher: starting process loop","time":"2023-09-12T15:54:14+08:00"}
2023-09-12_07:54:14.59348 gitlab-workhorse : {"address":"gdk.test:3000","level":"info","msg":"Running upstream server","network":"tcp","time":"2023-09-12T15:54:14+08:00"}
2023-09-12_07:54:14.59740 gitlab-workhorse : redis: 2023/09/12 15:54:14 sentinel.go:688: sentinel: new master="mymaster" addr="127.0.0.1:6480"
If the sentinel password is missing (use master branch), gdk tail gitlab-workhorse
would give sentinel errors
2023-09-12_07:56:39.53127 gitlab-workhorse : redis: 2023/09/12 15:56:39 sentinel.go:540: sentinel: GetMasterAddrByName master="mymaster" failed: NOAUTH Authentication required.
2023-09-12_07:56:40.65833 gitlab-workhorse : redis: 2023/09/12 15:56:40 sentinel.go:540: sentinel: GetMasterAddrByName master="mymaster" failed: NOAUTH Authentication required.
2023-09-12_07:56:40.66016 gitlab-workhorse : redis: 2023/09/12 15:56:40 sentinel.go:540: sentinel: GetMasterAddrByName master="mymaster" failed: NOAUTH Authentication required.
2023-09-12_07:56:40.66242 gitlab-workhorse : redis: 2023/09/12 15:56:40 sentinel.go:540: sentinel: GetMasterAddrByName master="mymaster" failed: NOAUTH Authentication required.
2023-09-12_07:56:41.01848 gitlab-workhorse : {"error":"keywatcher: redis: all sentinels specified in configuration are unreachable","level":"error","msg":"","time":"2023-09-12T15:56:41+08:00"}
2023-09-12_07:56:41.84868 gitlab-workhorse : redis: 2023/09/12 15:56:41 sentinel.go:540: sentinel: GetMasterAddrByName master="mymaster" failed: NOAUTH Authentication required.
2023-09-12_07:56:41.85371 gitlab-workhorse : redis: 2023/09/12 15:56:41 sentinel.go:540: sentinel: GetMasterAddrByName master="mymaster" failed: NOAUTH Authentication required.
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.