USE [master] GO CREATE LOGIN [pacemakerLogin] with PASSWORD= N'<Your Password>' ALTER SERVER ROLE [sysadmin] ADD MEMBER [pacemakerLogin]
也可以不给sysadmin权限,给上如下足够的权限即可:
GRANT ALTER, CONTROL, VIEW DEFINITION ON AVAILABILITY GROUP::UbuntuAG TO pacemakerLogin
c) 在所有节点上,保存SQL Server Login的信息:
echo 'pacemakerLogin' >> ~/pacemaker-passwd echo '<Your Password>' >> ~/pacemaker-passwd sudo mv ~/pacemaker-passwd /var/opt/mssql/secrets/passwd sudo chown root:root /var/opt/mssql/secrets/passwd sudo chmod 400 /var/opt/mssql/secrets/passwd # Only readable by root
d) 在Cluster中Primary节点上创建AG的资源:
sudo pcs resource create ag_cluster ocf:mssql:ag ag_name=UbuntuAG --master meta notify=true
e) 在Cluster中Primary节点上创建虚拟IP资源:
sudo pcs resource create virtualip ocf:heartbeat:IPaddr2 ip=**<10.2.38.204>**
f) 配置Cluster资源的依赖关系和启动顺序:
sudo pcs constraint colocation add virtualip ag_cluster-master INFINITY with-rsc-role=Master sudo pcs constraint order promote ag_cluster-master then start virtualip
g) 最后查看Cluster状态如下:
sudo pcs status
可以用虚拟IP(10.2.38.204)访问这个AG:
至此,Ubuntu上的Cluster管理的SQL Server Always On Availability Group就搭建完成了。