In this blog I show you how to create a complete cluster group of an ASCS instance with PowerShell commands.
This can be necessary in these situations:
- someone deleted the cluster group in Windows Failover Cluster Manager tool
- you create a new cluster and want to create the SAP cluster group yourself (do not use SWPM tool)
- you want to change a network name or a related IP address or any other resource in the SAP cluster group
1. You add a shared disk to Windows Failover Cluster and the disk is available in the "Available Storage" cluster group. That's the build-in cluster group of a Windows cluster, where applications can pick a cluster disk from.
2. You have created a DNS A-record for the SAP related network host name used by the ASCS instance as "SAPGLOBALHOST"
Open a PowerShell with administrative rights. Run the following commands.
Note:
The lines starting with # are just comment lines to understand, what each PowerShell cmdlet is doing in detail.
In this example I use:
SAP-SID = XYZ
Hostname for ASCS instance: sap-ascs-test
IP address of this hostname: 10.17.244.36
Shared disk used for this instance: test-disk
List of PowerShell commands in correct order
# create a new, empty cluster group
add-clustergroup -name "SAP XYZ"
# create IP and network name cluster resources
add-ClusterResource -Name "SAP XYZ IP" -ResourceType "IP Address" -Group "SAP XYZ" | Set-ClusterParameter -Multiple @{"Address" = "10.17.244.36"; "SubnetMask" = "255.255.254.0"; "Network" = "cluster network 1"; "EnableDhcp" = 0}
add-ClusterResource -Name "SAP XYZ NetName" -ResourceType "Network Name" -Group "SAP XYZ" | Set-ClusterParameter -Multiple @{"DnsName" = "sap-ascs-test"; }
# set the dependency
set-ClusterResourceDependency -Resource "SAP XYZ NetName" -Dependency "[SAP XYZ IP]"
# move the existing disk with name "test-disk" to this new cluster group
move-clusterresource -name "test-disk" -group "SAP XYZ"
# add a new cluster File Server resource
add-clusterresource -name "SAP XYZ FileServer" -resourcetype "File Server" -group "sap xyz"
# set the dependencies for the File Server resource (an "and" dependency of disk and hostname)
set-ClusterResourceDependency -Resource "SAP XYZ FileServer" -Dependency "[SAP XYZ NetName]"
add-ClusterResourceDependency -Resource "SAP XYZ FileServer" -provider "test-disk"
# bringt it online! If it is not online, you cannot create a share afterwards
start-clusterresource -name "SAP XYZ FileServer"
# create a new file share
new-SmbShare -name 'sapmnt' -Path "t:\usr\sap\"
# turn of CA feature (enabled by default)
set-SmbShare -name 'sapmnt' -ContinuouslyAvailable 0 -force
# set the file share permissions
grant-SmbShareAccess -Name "sapmnt" -AccountName "domain\sap_XYZ_globaladmin" -AccessRight Full -force
# set security ACLs
$Acl = Get-Acl t:\usr\sap
# add the security object of the SAP_<sid>_GlobalAdmin group
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule("domain\SAP_XYZ_GLOBALADMIN","FullControl", 'ContainerInherit,ObjectInherit', 'None', 'Allow')
$Acl.SetAccessRule($Ar)
# set the security
set-Acl t:\usr\sap $Acl -Verbose
# create SAP cluster resources (for service and instance). Also add the dependencies accordingly.
add-clusterresource -name "SAP XYZ 00 Service" -resourcetype "sap service" -group "sap xyz"
set-ClusterResourceDependency -Resource "SAP XYZ 00 Service" -Dependency "[SAP XYZ Fileserver]"
add-clusterresource -name "SAP XYZ 00 Instance" -resourcetype "sap resource" -group "sap xyz"
set-ClusterResourceDependency -Resource "SAP XYZ 00 Instance" -Dependency "[SAP XYZ 00 Service]"
# set the required parameters for the SAP service and instance resource
(Get-ClusterResource "SAP XYZ 00 Service").SeparateMonitor = 1
(Get-ClusterResource "SAP XYZ 00 Instance").SeparateMonitor = 1
Get-ClusterResource "SAP XYZ 00 Service" | set-clusterparameter ServiceName -value "SAPXYZ_00"
Get-ClusterResource "SAP XYZ 00 Instance" | set-clusterparameter SAPSystemName -value "XYZ"
After this all resources in this cluster group are online, except for SAP Service and SAP Instance resource. Start them and enjoy!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |