---参考这个文档配置故障转移、安装数据库https://blog.csdn.net/xiaoxionglove/article/details/113844839
---双app可以利用Windowsserver2019故障转移实现高可用
---后面有效果图
---数据库配置语句
节点1:主数据库
USE master;
GO
--创建主密钥
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'Kingdee@2019';
--创建证书 这里有两个"CERT1",建议每台机器都改成不同的名称以作区分
CREATE CERTIFICATE CERT1 WITH SUBJECT = 'CERT1', START_DATE = '2017-01-01',EXPIRY_DATE = '2099-12-30';
--把刚才创建的证书备份到文件 这里也有两个CERT1要改
BACKUP CERTIFICATE CERT1 TO FILE = 'C:\data\CERT1.cer';
--创建终结点,设为证书验证 这里第二行有1个CERT1要改
CREATE ENDPOINT [group0_endpoint] AUTHORIZATION [sa] STATE=STARTED AS TCP (LISTENER_PORT = 5022, LISTENER_IP = ALL)
FOR DATA_MIRRORING (ROLE = ALL,AUTHENTICATION = CERTIFICATE CERT1, ENCRYPTION = REQUIRED ALGORITHM AES)
GO
--在主数据库执行--证书相互拷贝完后执行
create certificate cert2 from FILE = 'C:\data\CERT2.cer';
节点2:备数据库
USE master;
GO
--创建主密钥
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'Kingdee@2019';
--创建证书 这里有两个"CERT1",建议每台机器都改成不同的名称以作区分
CREATE CERTIFICATE CERT2 WITH SUBJECT = 'CERT2', START_DATE = '2017-01-01',EXPIRY_DATE = '2099-12-30';
--把刚才创建的证书备份到文件 这里也有两个CERT1要改
BACKUP CERTIFICATE CERT2 TO FILE = 'C:\data\CERT2.cer';
--创建终结点,设为证书验证 这里第二行有1个CERT1要改
CREATE ENDPOINT [group0_endpoint] AUTHORIZATION [sa] STATE=STARTED AS TCP (LISTENER_PORT = 5022, LISTENER_IP = ALL)
FOR DATA_MIRRORING (ROLE = ALL,AUTHENTICATION = CERTIFICATE CERT2, ENCRYPTION = REQUIRED ALGORITHM AES)
GO
--在备数据库执行--证书相互拷贝完后执行
create certificate cert1 from FILE = 'C:\data\CERT1.cer';
推荐阅读