mysql 主從伺服器 切換,mysql主從

來源:互聯網
上載者:User

mysql 主從伺服器 切換,mysql主從
mysql 從伺服器切換為主伺服器:


步驟如下:


1 確認從伺服器已經完成所有同步操作:


 
stop slave io_thread  
show processlist 
 
直到看到狀態都為:xxx has read all relay log 表示更新都執行完畢


2 停止從伺服器slave服務


stop slave


3 將從伺服器切換為主伺服器:


 
reset master 


完成切換。


PS: 如果從伺服器設定了 read only 選項,則需要將這個參數去掉並重新啟動資料庫。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.