Learning about Protecting the SnapCenter Repository

For an enterprise NetApp SnapCenter deployment, following best practice and backing up the SnapCenter MySQL repository and knowing how to restore it is essential. The backup path must be on NetApp storage, and iSCSI LUN or VMDK (if VMDK you’ll need to have access to the vCenter which owns the datastore where the VMDK sits.) If you want to use iSCSI LUNs for application based storage (databases) but don’t have your iSCSI network setup, the repository could be moved from VMDK on a datastore (NFS/FC/iSCSI) to a dedicated iSCSI LUN at a later date (**don’t take my word for this, double-check as it’s just a strong hunch at the time of writing this document**) but you would need to reconfigure the repository backup.

Image: Protecting SnapCenter Repository

In this scenario the SnapCenter Repository is on VMDK but I don’t have access the correct vCenter, so I’ll be unable to backup the repository, but still there’s some useful lessons/stuff learned here.

Firstly I try to connect to SnapCtr from a remote host (which has the SnapCenter PowerShell module), but I forget to specify port 8146.


PS> Open-SmConnection -SMSbaseUrl https://SnapCtr.demo.corp.com

cmdlet Open-SmConnection at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
Credential
Open-SmConnection : Unable to connect to the remote serverNo connection could be made because the target machine actively refused it 192.168.0.75:443
At line:1 char:1
+ Open-SmConnection -SMSbaseUrl https://SnapCtr.demo.corp.com
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (SmPSSnapin.PSAddSmSession:PSAddSmSession) [Open-SmConnection], Exception
    + FullyQualifiedErrorId : Operation failed,SmPSSnapin.PSAddSmSession


Note: Use 'netstat -anb' to see listening ports on the SnapCenter server, and you'll see nothing listening on 443.

The next attempt is semi-succesful but the credentials I specified were incorrect.


PS> Open-SmConnection -SMSbaseUrl https://SnapCtr.demo.corp.com:8146

cmdlet Open-SmConnection at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
Credential
Open-SmConnection : The user you are trying to login does not belong to any roles. Please contact your administrator.
At line:1 char:1
+ Open-SmConnection -SMSbaseUrl https://SnapCtr.demo.corp.com:8146
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (SmPSSnapin.PSAddSmSession:PSAddSmSession) [Open-SmConnection], Exception
    + FullyQualifiedErrorId : Operation failed,SmPSSnapin.PSAddSmSession


So I check the RunAs credentials and see what credentials I should be using.


PS> Get-SmRunAs

Id                             : 1
RunAsName                      : SCAdmin
AuthMode                       : Windows
UserName                       : DEMO\Administrator
Passpharse                     :
OwnerId                        :
HostName                       :
InstanceName                   :
CheckforAdministratorPrivilage : False
TargetURL                      :
IsSudoEnabled                  : False


Then I use Open-SmConnection again and it works!


PS> Open-SmConnection -SMSbaseUrl https://SnapCtr.demo.netapp.com:8146


When I run the Protect-SmRepository it tells me the SnapCenter hosts needs to be registered with itself.


PS> Protect-SmRepository -HostName $HostName -Path C:\BACKUPS -RetentionCount 7 -Schedule @{"ScheduleType"="hourly";"StartTime"="1/15/2019 10:33 AM"}
Protect-SmRepository : Host [SnapCtr.demo.corp.com] is required to be registered with SnapCenter to protect the repository database
At line:1 char:1
+ Protect-SmRepository -HostName $HostName -Path C:\BACKUPS -RetentionCount 7 -Sch ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (SmPSSnapin.ProtectSmRepository:ProtectSmRepository) [Protect-SmRepository], Exception
    + FullyQualifiedErrorId : Protect-SmRepository failed,SmPSSnapin.ProtectSmRepository


So I do the Add-SmHost.


PS> Add-SmHost -HostName $HostName -OSType Windows -DiscoverPlugins -RunAsName SCAdmin

OsInfo                 : SMCoreContracts.SmOperatingSystemInfo
HostName               : SnapCtr.demo.corp.com
IP                     : ::1,192.168.0.75
Description            :
HostId                 : 3
DomainName             : demo.corp.com
Version                :
Port                   : 8145
ClusterHost            : False
ClusterName            :
Members                : {}
HostStatus             : eHostUp
HostPluginInfos        : {}
ColoHost               : True
HostConfiguration      : SMCoreContracts.SmConfiguration
DiscoverPlugin         : False
HostUUID               :
HostBIOSID             :
HostMaintenanceStatus  : Production
IsNLBEnabled           : False
VerificationServers    :
HypervisorType         :
IsHypervisorConfigured : False
Preference             : 0
OverallStatus          : SMCoreContracts.SmHostOverallStatusInfo
IsCatalogHost          : False
Name                   :
Type                   :
Id                     :
Host                   :
UserName               :
Passphrase             :
Deleted                : False
Auth                   : SMCoreContracts.SmAuth
IsClone                : False
CloneLevel             : 0
Hosts                  : {}
StorageName            :
ResourceGroupNames     :
PolicyNames            :
Key                    : 0
NsmObjectID            : 0


Finally I tried the Protect-SmRepository and it fails because SnapCenter isn’t plugged into the vCenter and Storage on which the VMDK exists.


PS> Protect-SmRepository -HostName $HostName -Path C:\BACKUPS -RetentionCount 7 -Schedule @{"ScheduleType"="hourly";"StartTime"="1/15/2019 10:33 AM"}
Protect-SmRepository : Repository protection operation failed because "C:\BACKUPS\" path is not available on the NetApp storage system or the path is not discovered in SnapCenter Server. You must
discover the file system resources from SnapCenter Server "SnapCtr.demo.corp.com" and retry repository protection.
At line:1 char:1
+ Protect-SmRepository -HostName $HostName -Path C:\BACKUPS -RetentionCount 7 -Sch ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidResult: (SmPSSnapin.ProtectSmRepository:ProtectSmRepository) [Protect-SmRepository], Exception
    + FullyQualifiedErrorId : Protect-SmRepository failed,SmPSSnapin.ProtectSmRepository


Lesson learned, SnapCenter must be on storage which it knows about.

SmRepository PowerShell CLI

Get-SmRepositoryBackups
Get-SmRepositoryConfig
Protect-SmRepository
Remove-SmRepositoryProtection
Restore-SmRepositoryBackup
Set-SmRepositoryConfig

HELP

NAME: Get-SmRepositoryBackups
SYNOPSIS: Gets the backup and saves the metadata to the active file system (AFS).
SYNTAX: Get-SmRepositoryBackups [[-Hostname] {String}] [[-SMSbaseUrl] {String}] [{CommonParameters}]
DESCRIPTION: Gets the backup and saves the metadata to the active file system (AFS).

NAME: Get-SmRepositoryConfig
SYNOPSIS: Displays the repository configuration information.
SYNTAX: Get-SmRepositoryConfig [[-SMSbaseUrl] {String}] [{CommonParameters}]
DESCRIPTION: Displays the repository configuration information.

NAME: Protect-SmRepository
SYNOPSIS: Sets the configuration that is required to create a backup of the SnapCenter database.
SYNTAX: Protect-SmRepository [-HostName] {String} [-Path] {String} [-Schedule] {Hashtable} [[-RetentionCount] {Int32}] [[-CatalogBackupPath] {String}] [{CommonParameters}]
DESCRIPTION: Sets the configuration that is required to create a backup of the SnapCenter database.

NAME: Remove-SmRepositoryProtection
SYNTAX: Remove-SmRepositoryProtection [{CommonParameters}]

NAME: Restore-SmRepositoryBackup
SYNOPSIS: Restores the SnapCenter database.
SYNTAX: Restore-SmRepositoryBackup [-HostName] {String} [[-SMSbaseUrl] {String}] [-BackupPath {String}] -BackupName {String} [-RestoreFileSystem] [-CatalogBackupPath {String}] [{CommonParameters}]

NAME: Set-SmRepositoryConfig
SYNOPSIS: Enables you to rebuild the slave repository from the master repository and enables you to fail over the repository to the specified node.
SYNTAX:
Set-SmRepositoryConfig [-ServerToRebuild] {String} [{CommonParameters}]
Set-SmRepositoryConfig [-RebuildSlave] [{CommonParameters}]
Set-SmRepositoryConfig [-ActiveMaster] {String} [[-Force]] [[-Credential] {PSCredential}] [[-SMSbaseUrl] {String}] [{CommonParameters}]
DESCRIPTION: Enables you to rebuild the slave repository from the master repository and enables you to fail over the repository to the specified node.

Other Resources

If you look in the SnapCenter 4.1 Documentation Center –
- and search for “Managing the SnapCenter Server repository”, you will see these pages:

- Prerequisites for protecting the SnapCenter repository
- Backing up the SnapCenter repository
- Viewing backups of the SnapCenter repository
- Restoring a SnapCenter database repository backup
- Migrating the SnapCenter repository

Comments