def main(): print "In main()..." env.nyc_sub_path = "/usr/local/virtuoso-opensource/share/virtuoso/vad/3t_backup" one_graph_backup_nyc(env.nyc_virtuoso_user, env.nyc_virtuoso_password, env.nyc_sub_path, env.nyc_isql_path, env.nyc_host, env.nyc_user) nyc_source_dir = env.nyc_sub_path + "/" + env.timestamp + "/*" source_before_dir = env.local_backup_dir + "/source-before/" if not os.path.exists(source_before_dir): os.makedirs(source_before_dir) print "Calling backup_to_local()..." backup_to_local(env.nyc_user, env.nyc_host, nyc_source_dir, source_before_dir) env.aws_sub_path = "/usr/share/virtuoso-opensource-7.1/vad/3t_backup" aws_source_dir = one_graph_backup_aws(env.aws_virtuoso_user, env.aws_virtuoso_password, env.aws_sub_path, env.aws_isql_path, env.aws_host, env.aws_user, env.aws_dev_key_file) aws_source_dir = env.aws_sub_path + "/" + env.timestamp + "/*" target_before_dir = env.local_backup_dir + "/target-before/" if not os.path.exists(target_before_dir): os.makedirs(target_before_dir) print "Calling backup_to_local()..." backup_to_local(env.aws_user, env.aws_host, aws_source_dir, target_before_dir) target_temp_path="/tmp/virtuoso-restore/one_graph/" + env.timestamp print "Calling backup_to_aws()..." backup_to_aws(env.aws_user, env.aws_host, source_before_dir + "*", env.aws_dev_key_file, target_temp_path) print "Calling restore_rw()..." for k, v in dict_ttSettings["virtuoso"]["graphs"]["rw"].items(): graph_name = v["graph_name"] restore_rw(env.aws_user, env.aws_host, env.aws_dev_key_file, graph_name, target_temp_path)
def neo4j_operations(dict_source_ttSettings, dict_target_ttSettings): try: log_dir = swapTimeStampDirPath log_dir_split=log_dir.split("/") timestamp= log_dir_split[len(log_dir_split)-1] print "Timestamp: %s"%timestamp backup_path = swapTimeStampDirPath + "/neo4j_backup" if not os.path.exists(backup_path): os.makedirs(backup_path) source_suffix = dict_source_ttSettings["neo4j"]["users"]["a_dev"]["host"] + "-Before" source_dir_backup=log_dir + "/neo4j_backup/" + source_suffix target_suffix = dict_target_ttSettings["neo4j"]["users"]["vm"]["host"] + "-Before" target_dir_backup=log_dir + "/neo4j_backup/" + target_suffix print "\nStarting backup operations for %s@%s"%(dict_source_ttSettings["neo4j"]["users"]["a_dev"]["username"],dict_source_ttSettings["neo4j"]["users"]["a_dev"]["host"]) tar_source_file=backup_to_local(dict_source_ttSettings["neo4j"]["users"]["a_dev"]["username"], dict_source_ttSettings["neo4j"]["users"]["a_dev"]["host"], dict_source_ttSettings["ec2"]["cert_private_key"], source_dir_backup, log_dir) my_logger.info("Source file (.tar) location: %s"%tar_source_file) print "\nStarting backup operations for %s@%s"%(dict_target_ttSettings["neo4j"]["users"]["vm"]["username"], dict_target_ttSettings["neo4j"]["users"]["vm"]["host"]) tar_target_file=backup_to_local(dict_target_ttSettings["neo4j"]["users"]["vm"]["username"], dict_target_ttSettings["neo4j"]["users"]["vm"]["host"], dict_target_ttSettings["ec2"]["cert_private_key"], target_dir_backup, log_dir) my_logger.info("Target file (.tar) location: %s"%tar_target_file) print "\nStarting clone operations for %s@%s"%(dict_target_ttSettings["neo4j"]["users"]["vm"]["username"], dict_target_ttSettings["neo4j"]["users"]["vm"]["host"]) clone_db(dict_target_ttSettings["neo4j"]["users"]["vm"]["username"], dict_target_ttSettings["neo4j"]["users"]["vm"]["host"], dict_target_ttSettings["ec2"]["cert_private_key"], source_suffix, timestamp) except: my_logger.error("Encountered failure in Neo4j Operations. Exiting!") sys.exit("Encountered failure in Neo4j Operations. Exiting!") my_logger.debug("Neo4j operations() completed successfully. ")
def main(): print "In main()..." """***************************************************************************************************************""" env.nyc_sub_path = "/usr/local/virtuoso-opensource/share/virtuoso/vad/3t_backup" one_graph_backup_nyc(env.nyc_virtuoso_user, env.nyc_virtuoso_password, env.nyc_sub_path, \ env.nyc_isql_path, env.nyc_host, env.nyc_user) source_before_dir = env.local_backup_dir + "/source-before/" if not os.path.exists(source_before_dir): os.makedirs(source_before_dir) nyc_source_dir = env.nyc_sub_path + "/" + env.timestamp + "/*" print "Calling backup_to_local()...before" backup_to_local(env.nyc_user, env.nyc_host, nyc_source_dir, source_before_dir) print "backup_to_local()...before...successful!!!" print "Calling remove_nyc_server_backup()..." remove_nyc_server_backup(env.nyc_sub_path, env.timestamp, env.nyc_host, env.nyc_user) print "remove_nyc_server_backup()...successful!!!" env.aws_sub_path = "/usr/share/virtuoso-opensource-7.1/vad/3t_backup" aws_source_dir = one_graph_backup_aws(env.aws_virtuoso_user, env.aws_virtuoso_password, env.aws_sub_path, \ env.aws_isql_path, env.aws_host, env.aws_user, env.aws_dev_key_file) aws_source_dir = env.aws_sub_path + "/" + env.timestamp + "/*" target_before_dir = env.local_backup_dir + "/target-before/" if not os.path.exists(target_before_dir): os.makedirs(target_before_dir) print "Calling backup_to_local()..." backup_to_local(env.aws_user, env.aws_host, aws_source_dir, target_before_dir) print "Calling remove_aws_server_backup()..." remove_aws_server_backup(env.nyc_sub_path, env.timestamp, env.nyc_host, env.nyc_user, env.aws_dev_key_file) print "remove_aws_server_backup()...successful!!!" target_temp_path="/tmp/virtuoso-restore/one_graph/" + env.timestamp print "Calling backup_to_aws()..." backup_to_aws(env.aws_user, env.aws_host, source_before_dir + "*", env.aws_dev_key_file, target_temp_path) print "Calling restore_rw()..." for k, v in dict_ttSettings["virtuoso"]["graphs"]["rw"].items(): graph_name = v["graph_name"] restore_rw(env.aws_user, env.aws_host, env.aws_dev_key_file, graph_name, target_temp_path) print "remove_temp_restore()..." remove_temp_restore(env.aws_user, env.aws_host, env.aws_dev_key_file, target_temp_path) """***************************************************************************************************************""" one_graph_backup_nyc(env.nyc_virtuoso_user, env.nyc_virtuoso_password, env.nyc_sub_path, \ env.nyc_isql_path, env.nyc_host, env.nyc_user) source_after_dir = env.local_backup_dir + "/source-after/" if not os.path.exists(source_after_dir): os.makedirs(source_after_dir) nyc_source_dir = env.nyc_sub_path + "/" + env.timestamp + "/*" print "Calling backup_to_local()...after" backup_to_local(env.nyc_user, env.nyc_host, nyc_source_dir, source_before_dir) print "backup_to_local()...after..successful!!!" print "Calling remove_nyc_server_backup()..." remove_nyc_server_backup(env.nyc_sub_path, env.timestamp, env.nyc_host, env.nyc_user) print "remove_nyc_server_backup()...successful!!!" env.aws_sub_path = "/usr/share/virtuoso-opensource-7.1/vad/3t_backup" aws_source_dir = one_graph_backup_aws(env.aws_virtuoso_user, env.aws_virtuoso_password, env.aws_sub_path, \ env.aws_isql_path, env.aws_host, env.aws_user, env.aws_dev_key_file) aws_source_dir = env.aws_sub_path + "/" + env.timestamp + "/*" target_before_dir = env.local_backup_dir + "/target-after/" if not os.path.exists(target_before_dir): os.makedirs(target_before_dir) print "Calling backup_to_local()..." backup_to_local(env.aws_user, env.aws_host, aws_source_dir, target_before_dir) print "Calling remove_aws_server_backup()..." remove_aws_server_backup(env.nyc_sub_path, env.timestamp, env.nyc_host, env.nyc_user, env.aws_dev_key_file) print "remove_aws_server_backup()...successful!!!" """***************************************************************************************************************""" print "Clone operations successful!!!"
def main(): print "In main()..." """***************************************************************************************************************""" env.nyc_sub_path = "/usr/local/virtuoso-opensource/share/virtuoso/vad/3t_backup" one_graph_backup_nyc(env.nyc_virtuoso_user, env.nyc_virtuoso_password, env.nyc_sub_path, \ env.nyc_isql_path, env.nyc_host, env.nyc_user) source_before_dir = env.local_backup_dir + "/source-before/" if not os.path.exists(source_before_dir): os.makedirs(source_before_dir) nyc_source_dir = env.nyc_sub_path + "/" + env.timestamp + "/*" print "Calling backup_to_local()...before" backup_to_local(env.nyc_user, env.nyc_host, nyc_source_dir, source_before_dir) print "backup_to_local()...before...successful!!!" print "Calling remove_nyc_server_backup()..." remove_nyc_server_backup(env.nyc_sub_path, env.timestamp, env.nyc_host, env.nyc_user) print "remove_nyc_server_backup()...successful!!!" env.aws_sub_path = "/usr/share/virtuoso-opensource-7.1/vad/3t_backup" aws_source_dir = one_graph_backup_aws(env.aws_virtuoso_user, env.aws_virtuoso_password, env.aws_sub_path, \ env.aws_isql_path, env.aws_host, env.aws_user, env.aws_dev_key_file) aws_source_dir = env.aws_sub_path + "/" + env.timestamp + "/*" target_before_dir = env.local_backup_dir + "/target-before/" if not os.path.exists(target_before_dir): os.makedirs(target_before_dir) print "Calling backup_to_local()..." backup_to_local(env.aws_user, env.aws_host, aws_source_dir, target_before_dir) print "Calling remove_aws_server_backup()..." remove_aws_server_backup(env.nyc_sub_path, env.timestamp, env.nyc_host, env.nyc_user, env.aws_dev_key_file) print "remove_aws_server_backup()...successful!!!" target_temp_path = "/tmp/virtuoso-restore/one_graph/" + env.timestamp print "Calling backup_to_aws()..." backup_to_aws(env.aws_user, env.aws_host, source_before_dir + "*", env.aws_dev_key_file, target_temp_path) print "Calling restore_rw()..." for k, v in dict_ttSettings["virtuoso"]["graphs"]["rw"].items(): graph_name = v["graph_name"] restore_rw(env.aws_user, env.aws_host, env.aws_dev_key_file, graph_name, target_temp_path) print "remove_temp_restore()..." remove_temp_restore(env.aws_user, env.aws_host, env.aws_dev_key_file, target_temp_path) """***************************************************************************************************************""" one_graph_backup_nyc(env.nyc_virtuoso_user, env.nyc_virtuoso_password, env.nyc_sub_path, \ env.nyc_isql_path, env.nyc_host, env.nyc_user) source_after_dir = env.local_backup_dir + "/source-after/" if not os.path.exists(source_after_dir): os.makedirs(source_after_dir) nyc_source_dir = env.nyc_sub_path + "/" + env.timestamp + "/*" print "Calling backup_to_local()...after" backup_to_local(env.nyc_user, env.nyc_host, nyc_source_dir, source_before_dir) print "backup_to_local()...after..successful!!!" print "Calling remove_nyc_server_backup()..." remove_nyc_server_backup(env.nyc_sub_path, env.timestamp, env.nyc_host, env.nyc_user) print "remove_nyc_server_backup()...successful!!!" env.aws_sub_path = "/usr/share/virtuoso-opensource-7.1/vad/3t_backup" aws_source_dir = one_graph_backup_aws(env.aws_virtuoso_user, env.aws_virtuoso_password, env.aws_sub_path, \ env.aws_isql_path, env.aws_host, env.aws_user, env.aws_dev_key_file) aws_source_dir = env.aws_sub_path + "/" + env.timestamp + "/*" target_before_dir = env.local_backup_dir + "/target-after/" if not os.path.exists(target_before_dir): os.makedirs(target_before_dir) print "Calling backup_to_local()..." backup_to_local(env.aws_user, env.aws_host, aws_source_dir, target_before_dir) print "Calling remove_aws_server_backup()..." remove_aws_server_backup(env.nyc_sub_path, env.timestamp, env.nyc_host, env.nyc_user, env.aws_dev_key_file) print "remove_aws_server_backup()...successful!!!" """***************************************************************************************************************""" print "Clone operations successful!!!"