Authored by qinchao

qcloudOnly:mysql主从同步校验

@@ -93,6 +93,8 @@ @@ -93,6 +93,8 @@
93 <h4 style="display: inline">切换流程</h4> 93 <h4 style="display: inline">切换流程</h4>
94 </div> 94 </div>
95 <div class="panel-body"> 95 <div class="panel-body">
  96 + <button class="btn btn-large" id="dbstatus_check-btn">数据库状态检查</button>
  97 + ===》
96 <button class="btn btn-large" id="switch_mysql-btn">mysql</button> 98 <button class="btn btn-large" id="switch_mysql-btn">mysql</button>
97 ===》 99 ===》
98 <button class="btn btn-large" id="switch_redis-btn">redis(目标DC)</button> 100 <button class="btn btn-large" id="switch_redis-btn">redis(目标DC)</button>
@@ -315,10 +317,50 @@ @@ -315,10 +317,50 @@
315 $("#java_next-btn").removeClass("btn-success"); 317 $("#java_next-btn").removeClass("btn-success");
316 318
317 switchWait = toWait("正在切换(目标DC),请耐心等候..."); 319 switchWait = toWait("正在切换(目标DC),请耐心等候...");
318 - doExe(array, 0, toCloud); 320 + //切换之前先校验db状态
  321 + checkMysqlStatus();
319 } 322 }
320 323
321 var switchWait; 324 var switchWait;
  325 +
  326 + function checkMysqlStatus(){
  327 + $("#dbstatus_check-btn").addClass("btn-warning");
  328 + $.ajax({
  329 + type: 'post',
  330 + url: contextPath + "/centerSwitch/switchMysqlCheckStatus",
  331 + data: {},
  332 + dataType: 'json',
  333 + success: function (resp) {
  334 + if(resp.code == 200){
  335 + $("#dbstatus_check-btn").removeClass("btn-warning");
  336 + $("#dbstatus_check-btn").addClass("btn-success");
  337 + var div = "<div class=\"alert alert-info alert-block\">";
  338 + div = div + "<h4 class=\"alert-heading\">dbstatus_check</h4>";
  339 + div = div + resp.data + "</div>";
  340 + $("#detail-div").append(div);
  341 +
  342 + //开始切换
  343 + doExe(array, 0, toCloud);
  344 + }else{
  345 + var div = "<div class=\"alert alert-warning alert-block\">";
  346 + div = div + "<h4 class=\"alert-heading\">dbstatus_check</h4>";
  347 + div = div + resp.data + "</div>";
  348 + div = div + "发生异常:"+resp.message + "</div>";
  349 + $("#detail-div").append(div);
  350 +
  351 + switchWait.modal('hide');
  352 + }
  353 +
  354 + },
  355 + error: function () {
  356 + var div = "<div>切换(目标DC)请求异常</div>";
  357 + $("#detail-div").append(div);
  358 +
  359 + switchWait.modal('hide');
  360 + }
  361 + });
  362 + }
  363 +
322 //执行切换 364 //执行切换
323 function doExe(array, i,commond) { 365 function doExe(array, i,commond) {
324 var name = array[i]; 366 var name = array[i];