Authored by qinchao

qcloudOnly:mysql主从同步校验

... ... @@ -93,6 +93,8 @@
<h4 style="display: inline">切换流程</h4>
</div>
<div class="panel-body">
<button class="btn btn-large" id="dbstatus_check-btn">数据库状态检查</button>
===》
<button class="btn btn-large" id="switch_mysql-btn">mysql</button>
===》
<button class="btn btn-large" id="switch_redis-btn">redis(目标DC)</button>
... ... @@ -315,10 +317,50 @@
$("#java_next-btn").removeClass("btn-success");
switchWait = toWait("正在切换(目标DC),请耐心等候...");
doExe(array, 0, toCloud);
//切换之前先校验db状态
checkMysqlStatus();
}
var switchWait;
function checkMysqlStatus(){
$("#dbstatus_check-btn").addClass("btn-warning");
$.ajax({
type: 'post',
url: contextPath + "/centerSwitch/switchMysqlCheckStatus",
data: {},
dataType: 'json',
success: function (resp) {
if(resp.code == 200){
$("#dbstatus_check-btn").removeClass("btn-warning");
$("#dbstatus_check-btn").addClass("btn-success");
var div = "<div class=\"alert alert-info alert-block\">";
div = div + "<h4 class=\"alert-heading\">dbstatus_check</h4>";
div = div + resp.data + "</div>";
$("#detail-div").append(div);
//开始切换
doExe(array, 0, toCloud);
}else{
var div = "<div class=\"alert alert-warning alert-block\">";
div = div + "<h4 class=\"alert-heading\">dbstatus_check</h4>";
div = div + resp.data + "</div>";
div = div + "发生异常:"+resp.message + "</div>";
$("#detail-div").append(div);
switchWait.modal('hide');
}
},
error: function () {
var div = "<div>切换(目标DC)请求异常</div>";
$("#detail-div").append(div);
switchWait.modal('hide');
}
});
}
//执行切换
function doExe(array, i,commond) {
var name = array[i];
... ...