כיצד להפעיל מצב תחזוקה ב- Exchange Server
במאמר זה, נראה לך כיצד להעביר כראוי מארח Exchange Server 2019/2016 למצב תחזוקה. עליך להעביר את קבוצת זמינות מסד הנתונים (DAG) למצב תחזוקה אם בכוונתך להתקין עדכונים במחשב מארח של Exchange Server (עדכוני Windows או Exchange CU) או לתחזק את חומרת השרת שלך. בעת הפעלת מצב תחזוקה, עליך להעביר מסדי נתונים פעילים משרת Exchange ולהעביר את התור לשרתים אחרים.
Exchange Server כולל שני קבצי script מוכללים של PowerShell לניהול מצב תחזוקה:
StartDagServerMaintenance.ps1 - מאפשר להעביר מסדי נתונים פעילים ואת תפקיד מנהל פעיל ראשי (PAM) לשרת אחר, וחוסם את ההעברה לאחור של מסדי נתונים של תיבות דואר עד לסיום התחזוקה;
StopDagServerMaintenance.ps1 - מאפשר לך להוציא את שרת Exchange ממצב תחזוקה על ידי ביצוע הליכים הפוכים.
קבצי Script אלה ממוקמים בתיקייה Scripts (
CD $ExScripts
) של ספריית ההתקנה של Exchange. נעשה שימוש בתחביר הבא:
.\StartDagServerMaintenance.ps1 -ServerName <ServerName> -MoveComment Maintenance -PauseClusterNode
.\StopDagServerMaintenance.ps1 -serverName <ServerName>קבצי script אלה מאפשרים לך להפוך פעולות מסוימות לאוטומטיות. ברוב המקרים, מנהלי Exchange מעדיפים להעביר את השרת באופן ידני למצב תחזוקה.
קיימת דוגמה של קובץ script של PowerShell שבו באפשרותך להשתמש כדי להפוך את מצב התחזוקה עבור שרת Exchange לזמין. הפעל את הפקודות במחשב שבו מעטפת ניהול Exchange ומודול RSAT-Clustering מותקנים:
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn
Import-Module FailoverClustersלחלופין, באפשרותך להתחבר לשרת Exchange מרחוק באמצעות PowerShell:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://munexh01.a-d.site/PowerShell/ -Authentication Kerberos -Credential (Get-Credential)
Import-PSSession $Sessionהגדר את שמות שרתי Exchange שלך:
a server that you want to enable the maintenance mode for
$maintance_srv = "munexh01.a-d.site"
# a target server you want to move mail queues to
$target_srv = "munexh02.a-d.site"
# Disable the HubTransport component of the server and put it into Draining mode
Set-ServerComponentState $maintance_srv -Component HubTransport -State Draining -Requester Maintenance
Restart-Service MSExchangeTransport
# Check that the HubTransport status has changed to Draining
Get-ServerComponentState -Identity $maintance_srv -Component Hubtransportאם אתה רץ
Get-ServerComponentState -Identity $maintance_srvכעת, כל רכיבי Exchange (למעט ניטור ו- RecoveryActionsEnabled) יהיו במצב לא פעיל.
# Move mail queue to another server
Redirect-Message -Server $maintance_srv -Target $target_srv
# Make sure that the mail queue have been cleared:
Get-Queue
# Pause your cluster node. This will move the Primary Active Manager (PAM) role to another DAG host
Suspend-ClusterNode -Name $maintance_srv
# Move all the mounted copies of mailbox databases to other servers
Set-MailboxServer $maintance_srv -DatabaseCopyActivationDisabledAndMoveNow $true
# Prevent a database activation on the server
Set-MailboxServer $maintance_srv -DatabaseCopyAutoActivationPolicy Blockedהמתן עד שמסדי הנתונים של תיבות הדואר יועברו בהצלחה למחשב מארח אחר (פעולה זו תארך מספר דקות). ודא שרשימת מסדי הנתונים הנטענים בשרת ריקה:
Get-MailboxDatabaseCopyStatus -Server $maintance_srv | where {$_.Status -like "Mounted"}
# Put Exchange components into maintenance mode
Set-ServerComponentState $maintance_srv -Component ServerWideOffline -State InActive -Requester Maintenance
# Check if the server is in maintenance mode
Get-ServerComponentState -Identity $maintance_srv -Component ServerWideOffline
Get-MailboxDatabaseCopyStatusכעת באפשרותך להשלים את הליכי התחזוקה עבור מארח Exchange הדרושים לך. לאחר שביצעת הכל בשרת, עליך לבצע את השלבים ההפוכים כדי להוציא את מארח Exchange Server ממצב תחזוקה:
Set-ServerComponentState $maintance_srv -Component ServerWideOffline -State Active -Requester Maintenance
# You may check the status as shown below (it must change to Active):
Get-ServerComponentState $maintance_srv -Component ServerWideOffline
Resume-ClusterNode -Name $maintance_srv
Set-MailboxServer $maintance_srv -DatabaseCopyAutoActivationPolicy Unrestricted
Set-MailboxServer $maintance_srv -DatabaseCopyActivationDisabledAndMoveNow $false
Set-ServerComponentState $maintance_srv -Component HubTransport -State Active -Requester Maintenanceבדוק את מצב שרת Exchange:
Test-ServiceHealth $maintance_srvאיזון מחדש של מסדי הנתונים הפעילים של תיבות הדואר בין מארחי DAG בהתאם להעדפות ההפעלה שתצורתן נקבעה באמצעות RedistributeActiveDatabases.ps1:
cd $exscripts
.\RedistributeActiveDatabases.ps1 -DagName mun-dag -BalanceDbsByActivationPreferenceאם ברצונך להעביר את כל העותקים הפעילים של מסדי נתונים של תיבות דואר משרת אחד לאחר, הפעל את הפקודה הבאה:
Move-ActiveMailboxDatabase -Server $target_srv -ActivateOnServer $maintance_srv -Confirm:$falseבצע בדיקת זמינות MAPI:
Test-MAPIConnectivity -Server $maintance_srvבדוק את מצב מסד הנתונים ושכפול ב- DAG:
Get-MailboxDatabaseCopyStatus
Test-ReplicationHealth -DatabaseAvailabilityGroup
