From 3712e6228ca4496d30c97421c1d35a93b70afbdf Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Thu, 23 Feb 2023 15:44:55 +0100 Subject: [PATCH] Redis sentinel no longer used --- templates/script/restart-nextcloud-farm.erb | 14 ------- .../script/switch_redis_master_to.erb.sh | 40 ------------------- 2 files changed, 54 deletions(-) delete mode 100644 templates/script/switch_redis_master_to.erb.sh diff --git a/templates/script/restart-nextcloud-farm.erb b/templates/script/restart-nextcloud-farm.erb index c24346a..a984b2a 100755 --- a/templates/script/restart-nextcloud-farm.erb +++ b/templates/script/restart-nextcloud-farm.erb @@ -68,16 +68,6 @@ def main() -> int: apikey_test = "<%= @apikey_test %>" 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'] nc_upgrade_command = 'sudo /usr/local/bin/occ upgrade' repair_command = 'sudo /usr/local/bin/occ maintenance:repair' @@ -89,8 +79,6 @@ def main() -> int: for number in reversed(range(1, 4)): 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_prod, monitor_host="monitor.drive.sunet.se") print("Upgrading: {}".format(fqdn)) @@ -118,8 +106,6 @@ def main() -> int: apikey_prod, monitor_host="monitor.drive.sunet.se") if success: - if number == 1: - set_redis_master_to("first") print("Upgrade cycle succeeded on {} ".format(fqdn)) else: print("Smoketest failed on {} after server reboot command".format( diff --git a/templates/script/switch_redis_master_to.erb.sh b/templates/script/switch_redis_master_to.erb.sh deleted file mode 100644 index 3462a13..0000000 --- a/templates/script/switch_redis_master_to.erb.sh +++ /dev/null @@ -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} " - 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