def recover_region_server(args, ip): package_root = deploy_utils.get_hbase_package_root( args.hbase_config.cluster.version) Log.print_info("Recover region server: " + ip); host = socket.gethostbyaddr(ip)[0] args.command = ["ruby", "%s/bin/region_mover.rb" % package_root, "load", host] if run_shell(args) != 0: Log.print_critical("Load host %s failed." % host);
def balance_switch(args, flag): fd, filename = tempfile.mkstemp() f = os.fdopen(fd, 'w+') if flag: Log.print_info("balance_switch on for cluster: %s" % args.cluster) print >> f, 'balance_switch true' else: Log.print_info("balance_switch off for cluster: %s" % args.cluster) print >> f, 'balance_switch false' print >> f, 'exit' f.close() args.command = ["shell", filename] ret = run_shell(args) os.remove(filename) if ret != 0: Log.print_critical("balance_switch off for cluster: %s failed!" % args.cluster);
def rolling_update(args): get_zk_service_config(args) job_name = "zookeeper" if not args.skip_confirm: deploy_utils.confirm_action(args, "rolling_update") Log.print_info("Rolling updating %s" % job_name) hosts = args.zookeeper_config.jobs[job_name].hosts wait_time = 0 for id in hosts.iterkeys(): deploy_utils.confirm_rolling_update(id, wait_time) stop_job(args, hosts[id], job_name) deploy_utils.wait_for_job_stopping("zookeeper", args.zookeeper_config.cluster.name, job_name, hosts[id]) start_job(args, hosts[id], job_name) deploy_utils.wait_for_job_starting("zookeeper", args.zookeeper_config.cluster.name, job_name, hosts[id]) wait_time = args.time_interval Log.print_success("Rolling updating %s success" % job_name)
def rolling_update(args): if not args.job: Log.print_critical("You must specify the job name to do rolling update") if not args.skip_confirm: deploy_utils.confirm_action(args, "rolling_update") get_hbase_service_config(args) job_name = args.job[0] if job_name != 'regionserver': args.vacate_rs = False if args.vacate_rs: balance_switch(args, False) Log.print_info("Rolling updating %s" % job_name) hosts = args.hbase_config.jobs[job_name].hosts wait_time = 0 for id in hosts.iterkeys(): if not args.skip_confirm: deploy_utils.confirm_rolling_update(id, wait_time) if args.vacate_rs: vacate_region_server(args, hosts[id]) stop_job(args, hosts[id], job_name) deploy_utils.wait_for_job_stopping("hbase", args.hbase_config.cluster.name, job_name, hosts[id]) start_job(args, hosts[id], job_name) deploy_utils.wait_for_job_starting("hbase", args.hbase_config.cluster.name, job_name, hosts[id]) if args.vacate_rs: recover_region_server(args, hosts[id]) wait_time = args.time_interval if args.vacate_rs: balance_switch(args, True) Log.print_success("Rolling updating %s success" % job_name)
def rolling_update(args): if not args.job: Log.print_critical("You must specify the job name to do rolling update") get_yarn_service_config(args) job_name = args.job[0] if not args.skip_confirm: deploy_utils.confirm_action(args, "rolling_update") Log.print_info("Rolling updating %s" % job_name) hosts = args.yarn_config.jobs[job_name].hosts wait_time = 0 for id in hosts.iterkeys(): deploy_utils.confirm_rolling_update(id, wait_time) stop_job(args, hosts[id], job_name) deploy_utils.wait_for_job_stopping("yarn", args.yarn_config.cluster.name, job_name, hosts[id]) start_job(args, hosts[id], job_name) deploy_utils.wait_for_job_starting("yarn", args.yarn_config.cluster.name, job_name, hosts[id]) wait_time = args.time_interval Log.print_success("Rolling updating %s success" % job_name)