You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
From f1c2249ef5e8524ddb986f0df879d5f18e935da3 Mon Sep 17 00:00:00 2001 |
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com> |
|
Date: Fri, 20 Jan 2017 09:17:15 +0100 |
|
Subject: [PATCH] redis: use "CLIENT KILL type normal" to notify clients of |
|
master being demoted |
|
|
|
--- |
|
heartbeat/redis | 11 +++++++++++ |
|
1 file changed, 11 insertions(+) |
|
|
|
diff --git a/heartbeat/redis b/heartbeat/redis |
|
index 1ea0025..d08e57a 100755 |
|
--- a/heartbeat/redis |
|
+++ b/heartbeat/redis |
|
@@ -436,6 +436,11 @@ function demote() { |
|
local master_host |
|
local master_port |
|
|
|
+ # client kill is only supported in Redis 2.8.12 or greater |
|
+ version=$(redis_client -v | awk '{print $NF}') |
|
+ ocf_version_cmp "$version" "2.8.11" |
|
+ client_kill=$? |
|
+ |
|
CHECK_SLAVE_STATE=1 |
|
monitor |
|
status=$? |
|
@@ -478,9 +483,15 @@ function demote() { |
|
while true; do |
|
# Wait infinite if replication is syncing |
|
# Then start/demote operation timeout determines timeout |
|
+ if [ "$client_kill" -eq 2 ]; then |
|
+ redis_client CLIENT PAUSE 2000 |
|
+ fi |
|
monitor |
|
status=$? |
|
if (( status == OCF_SUCCESS )); then |
|
+ if [ "$client_kill" -eq 2 ]; then |
|
+ redis_client CLIENT KILL type normal |
|
+ fi |
|
return $OCF_SUCCESS |
|
fi |
|
|
|
|