Redis sentinel no longer used
This commit is contained in:
parent
6a1895d48e
commit
3712e6228c
|
@ -68,16 +68,6 @@ def main() -> int:
|
||||||
apikey_test = "<%= @apikey_test %>"
|
apikey_test = "<%= @apikey_test %>"
|
||||||
apikey_prod = "<%= @apikey_prod %>"
|
apikey_prod = "<%= @apikey_prod %>"
|
||||||
|
|
||||||
first_fqdn = build_fqdn(customer, environment, 1, "node")
|
|
||||||
last_fqdn = build_fqdn(customer, environment, 3, "node")
|
|
||||||
|
|
||||||
def set_redis_master_to(node: str = "last"):
|
|
||||||
script_fqdn = build_fqdn(customer, environment, 1, "script")
|
|
||||||
new_master = last_fqdn
|
|
||||||
if node == "first":
|
|
||||||
new_master = first_fqdn
|
|
||||||
run_command(["/root/tasks/switch_redis_master_to.sh", new_master])
|
|
||||||
|
|
||||||
cosmos_command = ['sudo run-cosmos']
|
cosmos_command = ['sudo run-cosmos']
|
||||||
nc_upgrade_command = 'sudo /usr/local/bin/occ upgrade'
|
nc_upgrade_command = 'sudo /usr/local/bin/occ upgrade'
|
||||||
repair_command = 'sudo /usr/local/bin/occ maintenance:repair'
|
repair_command = 'sudo /usr/local/bin/occ maintenance:repair'
|
||||||
|
@ -89,8 +79,6 @@ def main() -> int:
|
||||||
|
|
||||||
for number in reversed(range(1, 4)):
|
for number in reversed(range(1, 4)):
|
||||||
fqdn = build_fqdn(customer, environment, number, server_type)
|
fqdn = build_fqdn(customer, environment, number, server_type)
|
||||||
if number == 1:
|
|
||||||
set_redis_master_to("last")
|
|
||||||
add_downtime(fqdn, apikey_test)
|
add_downtime(fqdn, apikey_test)
|
||||||
add_downtime(fqdn, apikey_prod, monitor_host="monitor.drive.sunet.se")
|
add_downtime(fqdn, apikey_prod, monitor_host="monitor.drive.sunet.se")
|
||||||
print("Upgrading: {}".format(fqdn))
|
print("Upgrading: {}".format(fqdn))
|
||||||
|
@ -118,8 +106,6 @@ def main() -> int:
|
||||||
apikey_prod,
|
apikey_prod,
|
||||||
monitor_host="monitor.drive.sunet.se")
|
monitor_host="monitor.drive.sunet.se")
|
||||||
if success:
|
if success:
|
||||||
if number == 1:
|
|
||||||
set_redis_master_to("first")
|
|
||||||
print("Upgrade cycle succeeded on {} ".format(fqdn))
|
print("Upgrade cycle succeeded on {} ".format(fqdn))
|
||||||
else:
|
else:
|
||||||
print("Smoketest failed on {} after server reboot command".format(
|
print("Smoketest failed on {} after server reboot command".format(
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
new_master=${1}
|
|
||||||
|
|
||||||
if ! [[ ${new_master} =~ sunet\.se$ ]]; then
|
|
||||||
new_master="${new_master}.$(hostname -d)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
new_master_ip=$(host -t A "${new_master}" | awk '{print $NF}')
|
|
||||||
|
|
||||||
if [[ ${?} -ne 0 ]] || [[ "x${new_master_ip}" == "x" ]]; then
|
|
||||||
echo "usage: ${0} <fqdn of new redis master>"
|
|
||||||
echo "example: ${0} node3.sunet.drive.test.sunet.se"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
ssh_command="ssh -q -t -o StrictHostKeyChecking=off -l script -i /root/.ssh/id_script"
|
|
||||||
declare -a all_nodes
|
|
||||||
#<% @config['app'].each do |node| %>
|
|
||||||
all_nodes+=('<%= node %>')
|
|
||||||
#<% end %>
|
|
||||||
declare -a slave_nodes
|
|
||||||
for node in "${all_nodes[@]}"; do
|
|
||||||
if [[ "${node}" != "${new_master_ip}" ]]; then
|
|
||||||
slave_nodes+=("${node}")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
for node in "${slave_nodes[@]}" ${new_master}; do
|
|
||||||
${ssh_command} "${node}" "sudo /home/script/bin/stop_sentinel.sh stop_cosmos"
|
|
||||||
done
|
|
||||||
|
|
||||||
${ssh_command} "${new_master}" "sudo /usr/local/bin/redis-cli slaveof no one"
|
|
||||||
|
|
||||||
for node in "${slave_nodes[@]}"; do
|
|
||||||
${ssh_command} "${node}" "sudo /usr/local/bin/redis-cli slaveof ${new_master_ip} 6379"
|
|
||||||
done
|
|
||||||
|
|
||||||
for node in "${slave_nodes[@]}" ${new_master}; do
|
|
||||||
${ssh_command} "${node}" "sudo /home/script/bin/start_sentinel.sh clear_cosmos"
|
|
||||||
done
|
|
Loading…
Reference in a new issue