代码改变世界

SQLServer AlwaysON修改可用性组的监听端口

2022-05-18 19:28  abce  阅读(366)  评论(0编辑  收藏  举报

1.使用图形工具进行修改

 

在主节点登录


登录SQL Server Management Studio


---->对象资源管理器(object explorer)


---->AlwaysON高可用性组(always on high availability)


---->可用性组(Availability Groups)


---->可用性组侦听器(Availability group Listeners)


---->右击已有的监听器


---->点击属性(Properties)


---->编辑port


---->确定(ok)

 

2.使用命令修改

(1).修改端口

alter endpoint [<endpoint name>]
state = started
as tcp (listener_port = 1233, listener_ip = (10.x.x.x))
for data_mirroring (role = all, authentication = windows negotiate, encryption = required algorithm aes)
go

简单点可以这样:

alter endpoint [<endpoint name>]
state = started
as tcp (listener_port = 1233)
go

(2).修改复制URL

alter availability group [<ag name>]
modify replica on 'mynode1' with (endpoint_url = 'tcp://mynode1.mydomain.com:1233')
go

  

3.启停

master库:
启动端口:

use [master]
ALTER ENDPOINT [MyEndpoint] STATE = STARTED;

  

停止端口:

use [master]
ALTER ENDPOINT [MyEndpoint] STATE = STOPPED;