-
Notifications
You must be signed in to change notification settings - Fork 0
/
read_balancer_demo.sh
executable file
·68 lines (62 loc) · 2.1 KB
/
read_balancer_demo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Colors
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
LIGHTGRAY='\033[0;37m'
DARKGRAY='\033[1;30m'
LIGHTRED='\033[1;31m'
LIGHTGREEN='\033[1;32m'
YELLOW='\033[1;33m'
LIGHTBLUE='\033[1;34m'
LIGHTPURPLE='\033[1;35m'
LIGHTCYAN='\033[1;36m'
WHITE='\033[1;37m'
# Setup variables
re='^[0-8]+$'
i=0
commands=("./bin/ceph -s"
"./bin/ceph osd pool ls detail"
"./bin/ceph osd getmap -o om"
"./bin/osdmaptool om --upmap out.txt"
"./bin/osdmaptool om --vstart --read out.txt --read-pool default.rgw.control"
"cat out.txt"
"./bin/ceph osd set-require-min-compat-client reef"
"source out.txt"
"./bin/ceph osd pool ls detail")
descriptions=("Check ceph status"
"Check pool details for current read balancer scores. We’ll try to improve the score of pool 6, or “default.rgw.control”"
"Get latest copy of your OSD map"
"Run the upmap balancer first to make sure writes are balanced. In this case, the upmap balancer was unable to optimize further."
"Run the read balancer, focusing on “default.rgw.control”:"
"We can check to see what the balancer suggests in the “out.txt” file:"
"Ensure the client is compatible before running the new commands:"
"We can apply the file to a live system if we choose:"
"Notice how the score has improved to 1.00 for “default.rgw.control”, which previously had a score of 1.62:")
echo "Press 'q' to exit"
echo "Cycle through numbers 0-8 for the demo..."
printf "\n"
while [ true ] ;
do
read -n 1 k <&1
clear
if [[ $k = q ]] ; then
printf "\n"
echo "Quitting from the program"
break
elif [[ $k =~ $re ]] ; then
echo -e ${RED} $k. ${descriptions[$k]} ${NOCOLOR}
printf "\n"
echo -e ${LIGHTGREEN}"$" ${commands[$k]} ${NOCOLOR}
printf "\n"
${commands[$k]} 2>&1 | grep -v experimental
printf "\n\n"
else
echo "Incorrect input; enter a number between 0-8"
printf "\n\n"
fi
done