我在我的一个环境中配置了永远在线。
SQL1 = Primary
SQL2 = Slave1 (readonly)
SQL3 = Slave2 (readonly)
我的问题:
我希望我的应用程序将从两个从属服务器读取(例如 SQL2 和 SQL3,以防它们是从属服务器,而 SQL1 是主服务器)。
有可能吗,如果有,我是怎么做的
我已经配置了路由表,例如:
ALTER AVAILABILITY GROUP [AG1]
MODIFY REPLICA ON N'SQL1' WITH
(SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://SQL1.aws.ir:1433'));
GO
ALTER AVAILABILITY GROUP [AG1]
MODIFY REPLICA ON N'SQL2' WITH
(SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://SQL2.aws.ir:1433'));
GO
ALTER AVAILABILITY GROUP [AG1]
MODIFY REPLICA ON N'SQL3' WITH
(SECONDARY_ROLE (READ_ONLY_ROUTING_URL = N'TCP://SQL3.aws.ir:1433'));
GO
ALTER AVAILABILITY GROUP [AG1]
MODIFY REPLICA ON N'SQL1' WITH
(PRIMARY_ROLE(READ_ONLY_ROUTING_LIST = (N'SQL2',N'SQL3')))
GO
ALTER AVAILABILITY GROUP [AG1]
MODIFY REPLICA ON N'SQL2' WITH
(PRIMARY_ROLE(READ_ONLY_ROUTING_LIST = (N'SQL1',N'SQL3')))
GO
ALTER AVAILABILITY GROUP [AG1]
MODIFY REPLICA ON N'SQL3' WITH
(PRIMARY_ROLE(READ_ONLY_ROUTING_LIST = (N'SQL1',N'SQL2')))
GO