溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

SQL Server 2017 AlwaysOn on Linux 配置和維護(14)

發(fā)布時間:2020-08-09 14:55:38 來源:網(wǎng)絡(luò) 閱讀:572 作者:UltraSQL 欄目:關(guān)系型數(shù)據(jù)庫
2.5 操作
2.5.1可用性組升級

在升級之前,可以參考升級AG副本實例的模型和實踐。

升級實例的順序依賴于角色是否為輔助副本和他們是同步或異步副本。首先升級承載異步副本的實例,然后升級承載同步副本的實例。

注意:如果一個AG只有異步副本,為了避免數(shù)據(jù)丟失,修改一個副本為同步,等待直到同步后,然后升級該副本。


以下為AG在Linux上執(zhí)行滾動升級SQL Server實例。


備份每個數(shù)據(jù)庫


停止即將升級的目標(biāo)輔助副本節(jié)點上的資源

pcs constraint location ag_cluster-master avoids nodeName1


在輔助副本上升級SQL Server

sudo yum update mssql-server
sudo yum update mssql-server-ha


移除位置約束

pcs constraint remove location-ag_cluster-master-rhel1--INFINITY


驗證升級后資源啟動、輔助副本已連接并同步

pcs status


在所有輔助副本升級后,手工故障轉(zhuǎn)移到一個同步副本。

對于AG為EXTERNAL類型,使用群集管理工具來故障轉(zhuǎn)移;

對于AG為NONE類型,使用Transact-SQL來故障轉(zhuǎn)移。

sudo pcs resource move ag_cluster-master <targetReplicaName> --master

重要:以下步驟僅適用于AG沒有群集管理器的情況。


如果AG為NONE類型,手動故障轉(zhuǎn)移。按以下順序完成。

1.設(shè)置主副本為輔助

ALTER AVAILABILITY GROUP [ag1] SET (ROLE = SECONDARY);

2.設(shè)置同步輔助副本為主

ALTER AVAILABILITY GROUP [ag1] FAILOVER;


在故障轉(zhuǎn)移后,在舊的主副本上升級SQL Server。

# add constraint for the resource to stop on the upgraded node
# replace 'nodename2' with the name of the cluster node targeted for upgrade
pcs constraint location ag_cluster-master avoids nodeName2
# upgrade mssql-server and mssql-server-ha packages
sudo yum update mssql-server
sudo yum update mssql-server-ha
# remove the constraint; make sure the resource is started and replica is connected and synchronized
pcs constraint remove location-ag_cluster-master-rhel1--INFINITY


對于AG類型為EXTERNAL,清理手動故障轉(zhuǎn)移導(dǎo)致的位置約束

sudo pcs constraint remove cli-prefer-ag_cluster-master


對于新升級的輔助副本(即舊的主副本)恢復(fù)數(shù)據(jù)移動

ALTER DATABASE database_name SET HADR RESUME;


在升級完所有的服務(wù)器后,你可以按需將主副本切換回來。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI