首先向圣诞前夜还在因CVE-2019-19781之祸而努力奋斗的Citrix NetScaler ADC/GW等各级工友们致敬!
之前提过,有时候需要把单DB转成集群DB,这里更极端,是把Express DB移植到DB集群,本次环境基于以下介质:
Citrix_Virtual_Apps_and_Desktops_7_1912.iso
cn_sql_server_2016_enterprise_with_service_pack_1_x64_dvd_9538279.iso
cn_windows_server_2019_x64_dvd_2d80e042.iso
ADDS:2012 R2
CVAD 1912自带的是SQL Server 2017 Express CU16,如果你没有SQLServer 2017 Enterprise的ISO文件(貌似不太好找cn_sql_server_2017_enterprise_x64_dvd_11293608.iso),这里以低版本SQL2016为例,SQL 2019倒是很流行(cn_sql_server_2019_enterprise_x64_dvd_2bfe815a.iso)。
SQL高版本还原到低版本不可直接用传统备份/还原方式,会报版本不匹配错误。可以通过执行生成的SQL文件来完成数据库还原,再去构建AlwaysOn集群。
数据类型选择架构和数据
服务器版本选择2016
sql文件大写取决于你的POC环境复杂程度,需要耐心加载和执行,执行后的报错可忽略!
DB一侧完工后,剩下就是回到DDC上借助PowerShell各种神操作了!
解除现有的DB连接
Load the Citrix snap-ins
asnp Citrix.*
Disable configuration logging for the XD site:
Set-LogSite -State Disabled
Clear the current Delivery Controller database connections
Note: AdminDBConnection must be the last command
Set-ConfigDBConnection -DBConnection $null
Set-AcctDBConnection -DBConnection $null
Set-AnalyticsDBConnection -DBConnection $null # for 7.6 and newer
Set-AppLibDBConnection -DBConnection $null # for 7.8 and newer
Set-OrchDBConnection -DBConnection $null # for 7.11 and newer
Set-TrustDBConnection -DBConnection $null # for 7.11 and newer
Set-HypDBConnection -DBConnection $null
Set-ProvDBConnection -DBConnection $null
Set-BrokerDBConnection -DBConnection $null
Set-EnvTestDBConnection -DBConnection $null
Set-SfDBConnection -DBConnection $null
Set-MonitorDBConnection -DataStore Monitor -DBConnection $null
Set-MonitorDBConnection -DBConnection $null
Set-LogDBConnection -DataStore Logging -DBConnection $null
Set-LogDBConnection -DBConnection $null
Set-AdminDBConnection -DBConnection $null -force
充分参考 https://docs.citrix.com/en-us/advanced-concepts/implementation-guides/database-connection-strings.html
建立新的DB连接
$ServerName = “CVADlis”
$SiteDBName = “cvadPOC”
$LogDBName = “ cvadPOC “
$MonitorDBName = “ cvadPOC “
$csSite = “Server=$ServerName;Initial Catalog=$SiteDBName;Integrated Security=True”
$csLogging = “Server=$ServerName;Initial Catalog=$LogDBName;Integrated Security=True”
$csMonitoring = “Server=$ServerName;Initial Catalog=$MonitorDBName;Integrated Security=True”
Set-AdminDBConnection -DBConnection $csSite
Set-ConfigDBConnection -DBConnection $csSite
Set-AcctDBConnection -DBConnection $csSite
Set-AnalyticsDBConnection -DBConnection $csSite # for 7.6 and newer
Set-HypDBConnection -DBConnection $csSite
Set-ProvDBConnection -DBConnection $csSite
Set-AppLibDBConnection –DBConnection $csSite # for 7.8 and newer
Set-OrchDBConnection –DBConnection $csSite # for 7.11 and newer
Set-TrustDBConnection –DBConnection $csSite # for 7.11 and newer
Set-BrokerDBConnection -DBConnection $csSite
Set-EnvTestDBConnection -DBConnection $csSite
Set-SfDBConnection -DBConnection $csSite
Set-LogDBConnection -DBConnection $csSite
Set-LogDBConnection -DataStore Logging -DBConnection $csLogging
Set-MonitorDBConnection -DBConnection $csSite
Set-MonitorDBConnection -DataStore Monitor -DBConnection $csMonitoring
切换数据库,查看ARP输出的MAC地址来验证DDC工作情况!此外还可以在DDC上执行站点检测,如果出现警告信息,可以放心忽略!
用PS来检测db连接情况:
Load the Citrix snap-ins
asnp citrix.*
$ServerName = ” CVADlis “
$SiteDBName = ” cvadPOC “
$LogDBName = ” cvadPOC “
$MonitorDBName = ” cvadPOC “
$csSite = “Server=$ServerName;Initial Catalog=$SiteDBName;Integrated Security=True”
$csLogging = “Server=$ServerName;Initial Catalog=$LogDBName;Integrated Security=True”
$csMonitoring = “Server=$ServerName;Initial Catalog=$MonitorDBName;Integrated Security=True”
Test-AcctDBConnection -DBConnection $csSite
Test-AdminDBConnection -DBConnection $csSite
Test-AnalyticsDBConnection -DBConnection $csSite # for 7.6 and newer
Test-AppLibDBConnection -DBConnection $csSite # for 7.8 and newer
Test-BrokerDBConnection -DBConnection $csSite
Test-ConfigDBConnection -DBConnection $csSite
Test-EnvTestDBConnection -DBConnection $csSite
Test-HypDBConnection -DBConnection $csSite
Test-LogDBConnection -DBConnection $csSite
Test-LogDBConnection -DataStore Logging -DBConnection $csLogging
Test-MonitorDBConnection -DBConnection $csSite
Test-MonitorDBConnection -Datastore Monitor -DBConnection $csMonitoring
Test-OrchDBConnection -DBConnection $csSite # for 7.11 and newer
Test-ProvDBConnection -DBConnection $csSite
Test-SfDBConnection -DBConnection $csSite
Test-TrustDBConnection -DBConnection $csSite # for 7.11 and newer
以上是完整的视频操作过程。
2019-12-24