vue 侦听器侦听对象属性

This article on SQL Server Always On Listeners includes an overview and various connection configurations for specifying MultiSubnetFailover including SSMS, ODBC, ADO.NET, as well as MultiSubnetFailover limitations and how to connect to all IP addresses via RegisterAllProvidersIP.

有关SQL Server始终在侦听器上的文章包括概述和各种连接配置,用于指定MultiSubnetFailover,包括SSMS,ODBC,ADO.NET,以及MultiSubnetFailover限制以及如何通过RegisterAllProvidersIP连接到所有IP地址。

SQL Server Always On Availability Groups provides a HADR (high availability and disaster recovery) solution with multiple replicas. We can create multiple secondary replicas with a combination of synchronous and asynchronous data commit.

SQL Server Always On可用性组提供了具有多个副本的HADR(高可用性和灾难恢复)解决方案。 我们可以结合同步和异步数据提交来创建多个辅助副本。

SQL Server Always On侦听器概述 (Overview of SQL Server Always On Listeners)

Suppose we have two replicas using synchronous data commit mode. We can do read-write operations on the primary replica only. In the application configuration, we can use the Primary replica instance name. It has a drawback in that if failover happens and the secondary replica takes over the role as primary, all user connections need to repoint to the new primary replica after failover. It is not an ideal scenario to change the application connection string each time after a failover.

假设我们有两个使用同步数据提交模式的副本。 我们只能在主副本上执行读写操作。 在应用程序配置中,我们可以使用主副本实例名称。 这样做的缺点是,如果发生故障转移并且辅助副本接管了主要角色,则所有用户连接都需要在故障转移后指向新的主副本。 每次故障转移后都更改应用程序连接字符串不是理想的情况。

In SQL Server Always On, we can define a SQL Server Always On Availability listener for all user connections. A virtual network name always points to the primary replica. The client application does not need to know the underlying configuration of Always On replica.

在SQL Server Always On中,我们可以为所有用户连接定义一个SQL Server Always On可用性侦听器。 虚拟网络名称始终指向主副本。 客户端应用程序不需要知道Always On副本的基础配置。

In the following screenshot, we configured a SQL listener on a three node replica.

在以下屏幕截图中,我们在三节点副本上配置了SQL侦听器。

To configure a Listener in SQL Server Always on Availability Group, expand the Availability Group Listener node in SSMS. Then click on Add Listener.

若要在SQL Server始终可用组中配置侦听器,请在SSMS中展开“ 可用性组侦听器”节点。 然后单击“ 添加侦听器”

Provide the following information in the Add Listener wizard.

在“添加侦听器”向导中提供以下信息。

  • Unique virtual network name in DNS DNS中的唯一虚拟网络名称
  • Port for SQL Listener. We can use the default SQL port 1433 as well; however, we need to ensure that no other services, on the cluster node, should use this port as it can cause a port conflict. Ideally, we should use a different port for SQL listener. Applications need to use this port in their connection string. In the following screenshot, we can see port 5123 is configured SQL侦听器的端口。 我们也可以使用默认SQL端口1433。 但是,我们需要确保群集节点上的任何其他服务都不应使用此端口,因为它可能导致端口冲突。 理想情况下,我们应该对SQL侦听器使用其他端口。 应用程序需要在其连接字符串中使用此端口。 在以下屏幕截图中,我们可以看到已配置端口5123

Once we configure a SQL listener in a SQL Server Always On Availability Group, it also becomes a cluster resource. You can open the failover cluster manager and view Roles. In the Roles, you can see a virtual network name (listener name) along with virtual IP.

一旦在SQL Server始终可用组中配置了SQL侦听器,它还将成为群集资源。 您可以打开故障转移群集管理器并查看“角色”。 在“角色”中,您可以看到虚拟网络名称(侦听器名称)以及虚拟IP。

多子网SQL Server始终在线可用性组 (Multi-Subnet SQL Server Always On Availability Groups)

Let’s consider the case of multi-subnet Always On Availability Groups. In the case of a multi-subnet, we need to use multiple IPs for the SQL listener. We need to configure one virtual IP for each subnet. Therefore, if we have a configuration for DC-DR Always on replicas, we can have one virtual IP for DC and one virtual IP for DR.

让我们考虑多子网Always On可用性组的情况。 对于多子网,我们需要对SQL侦听器使用多个IP。 我们需要为每个子网配置一个虚拟IP。 因此,如果我们为副本上的DC-DR始终配置,我们可以为DC提供一个虚拟IP,为DR提供一个虚拟IP。

Once a client connects via DNS to resolve the virtual network name, it returns all available IP addresses. It tries to connect with each IP address and connect to the available (DC or DR) IP address.

客户端通过DNS连接以解析虚拟网络名称后,它将返回所有可用的IP地址。 它尝试连接每个IP地址并连接到可用的(DC或DR)IP地址。

Let’s say you have configured SQL Listener with two IP address, one for DC and another for DR subnet. Suddenly due to some network issues, the Availability group fails over to the Secondary replica in DR. Previously in the failover cluster manager, the DC Listener IP address was online but after failover the DR Listener IP address came online. The application tries to connect the primary replica using the Listener. It connects with DNS to resolve its virtual network name and gets a list of multiple IP addresses in return. The application tries to connect with the first IP address and could not connect to it. Once it gets a timeout issue, it checks for another IP address, and the connection is established. It is a trial and error approach. If we have multiple subnets, the application connection might get delayed further.

假设您已经为SQL侦听器配置了两个IP地址,一个用于DC,另一个用于DR子网。 突然由于某些网络问题,可用性组故障转移到灾难恢复中的辅助副本。 以前在故障转移群集管理器中,DC侦听器IP地址处于联机状态,但是在故障转移之后,DR侦听器IP地址已联机。 应用程序尝试使用侦听器连接主副本。 它与DNS连接以解析其虚拟网络名称,并获取多个IP地址的列表作为回报。 该应用程序尝试使用第一个IP地址进行连接,但无法与其连接。 一旦遇到超时问题,它将检查另一个IP地址,并建立连接。 这是一种反复试验的方法。 如果我们有多个子网,则应用程序连接可能会进一步延迟。

We can use the configuration MultiSubnetFailover=True, in the connection string, to resolve this issue. Once we enable this parameter, the Application tries to connect both IP address simultaneously. Whichever IP address connection is successful, the application connects with the Primary replica using that IP address and routes read-write queries on that replica.

我们可以在连接字符串中使用配置MultiSubnetFailover = True来解决此问题。 启用此参数后,应用程序将尝试同时连接两个IP地址。 无论成功的IP地址连接如何,应用程序都使用该IP地址与主副本连接,并在该副本上路由读写查询。

Let’s graphically understand MultiSubnetFailover in SQL Server Always On Availability Groups. In the following image, we have a straightforward two-node SQL Server Always on Cluster. We have both the nodes in a different subnet. In SQL Listener, we have two virtual IP address mapped with a SQL Listener name.

让我们以图形方式了解SQL Server Always On可用性组中的MultiSubnetFailover。 在下图中,我们有一个简单的两节点SQL Server Always on Cluster。 我们两个节点都位于不同的子网中。 在SQL侦听器中,我们有两个虚拟IP地址与一个SQL侦听器名称映射。

  • Step 1: Once the application tries to connect to the database using a SQL listener, it connects with DNS and asks for the IP address of it. 步骤1:一旦应用程序尝试使用SQL侦听器连接到数据库,它就会与DNS连接并询问其IP地址。

  • Step 2: DNS gives all virtual IP address mapped with the SQL Listener. In this example, DNS returns two IP addresses 步骤2: DNS提供与SQL侦听器映射的所有虚拟IP地址。 在此示例中,DNS返回两个IP地址
  • Step 3 and 4: Only one virtual IP is online at any given time. The application tries to connect with IP Address 1, but it couldn’t connect to the Primary replica because the IP address 1 is offline 步骤3和4:在任何给定时间,只有一个虚拟IP处于联机状态。 该应用程序尝试使用IP地址1连接,但由于IP地址1处于脱机状态,因此无法连接到主副本
  • Step 5: Once a connection timeout (default 12 seconds) occurs, the same process happens with IP Address 2. IP Address 2 points to the primary replica and database connection are successful 步骤5:一旦发生连接超时(默认为12秒),IP地址2就会发生相同的过程。IP地址2指向主副本,数据库连接成功

Now let’s view this example again with MultiSubnetFailover= True in the Connection string. If you want to connect the database with SSMS, go to Additional Connection parameters and specify MultiSubnetFailover= True.

现在,让我们再次使用Connection字符串中的MultiSubnetFailover = True来查看此示例。 如果要将数据库与SSMS连接,请转到 其他连接参数,并指定MultiSubnetFailover = True。

在SSMS连接中指定MultiSubnetFailover (Specifying MultiSubnetFailover in SSMS Connection)

在ODBC连接中指定MultiSubnetFailover (Specifying MultiSubnetFailover in ODBC Connection)

We can also specify specifying MultiSubnetFailover in the ODBC Connection as well as shown in the following screenshot. By default, this option is not turned on.

我们还可以在ODBC连接中指定MultiSubnetFailover ,如以下屏幕快照所示。 默认情况下,此选项未打开。

在ADO.NET提供程序连接中指定MultiSubnetFailover (Specifying MultiSubnetFailover in ADO.NET provider Connection)

We can specify MultiSubnetFailover in the ADO.Net provider connection string as per following connection string.

我们可以按照以下连接字符串在ADO.Net提供程序连接字符串中指定MultiSubnetFailover

Server=tcp:SQListenerName,Port;Database=TestDB;IntegratedSecurity=SSPI; MultiSubnetFailover=True

服务器= TCP:SQListenerName,端口;数据库= TestDB;集成安全性= SSPI; MultiSubnetFailover =真

We can understand the connection process with MultiSubnetFailover =True using following steps.

我们可以使用以下步骤来了解MultiSubnetFailover = True的连接过程。

  • Step 1: Once the application tries to connect to the database using a SQL listener, it connects with DNS and asks for the IP address of it 步骤1:一旦应用程序尝试使用SQL侦听器连接到数据库,它就会与DNS连接并询问其IP地址。
  • Step 2: DNS gives all virtual IP address mapped with a SQL Listener. In this example, DNS returns two IP addresses 步骤2 :DNS提供与SQL侦听器映射的所有虚拟IP地址。 在此示例中,DNS返回两个IP地址
  • Step 3: In 步骤3:MultiSubnetFailover= True, it tries to connect with all IP addresses returned by DNS in parallel. It does not wait for the timeout to occur from an IP address MultiSubnetFailover = True中 ,它尝试并行连接DNS返回的所有IP地址。 它不等待IP地址发生超时
  • Step 4: Once a connection is established with one IP address, the application can connect to the database 步骤4:使用一个IP地址建立连接后,应用程序即可连接到数据库

We should enable the MultiSubnetFailover for SQL Server Availability Group for a single subnet availability group as well. It helps to facilitate application behavior in case we later expand availability group across multiple subnets.

我们也应该为单个子网可用性组启用SQL Server可用性组的MultiSubnetFailover 。 万一我们稍后在多个子网之间扩展可用性组,它有助于促进应用程序行为。

MultiSubnetFailover的局限性 (Limitations of MultiSubnetFailover)

  • It does not support hostnames with more than 64 IP addresses 它不支持IP地址超过64个的主机名
  • It only supports TCP protocol 它仅支持TCP协议
  • It does not connect to mirrored SQL Server instances 它不连接到镜像SQL Server实例
  • It does not support SQL named instances. We can connect named SQL instances using a SQL listener 它不支持SQL命名实例。 我们可以使用SQL侦听器连接命名SQL实例

SQL Server Always On可用性组中的RegisterAllProvidersIP配置 (RegisterAllProvidersIP configuration in SQL Server Always On Availability Groups)

Most client tools support multi-subnet behavior by providing the option to enable MultiSubnetFailover true. However, by default, the application tries to connect with multiple virtual IP addresses in a serial mode only. We have to explicitly define the multi-subnet method to go with parallel processing of connections.

大多数客户端工具通过提供启用MultiSubnetFailover true的选项来支持多子网行为。 但是,默认情况下,应用程序仅尝试以串行模式连接多个虚拟IP地址。 我们必须显式定义多子网方法以与连接的并行处理一起使用。

Once we configure MultiSubnetFailover in SQL Server cluster, it sets the RegisterAllProvidesIP value to one.

在SQL Server群集中配置MultiSubnetFailover后,它将RegisterAllProvidesIP值设置为1。

If the RegisterAllProvidesIP value is 1, then all IP’s are registered and available for application connectivity. If the application does not support MultiSubnetFailover, we can still avoid connections to all IP addresses.

如果RegisterAllProvidesIP值为1,则将注册所有IP,这些IP可用于应用程序连接。 如果应用程序不支持MultiSubnetFailover,我们仍然可以避免连接到所有IP地址。

To check the existing value of RegisterAllProvidesIP, open PowerShell with administrative permission and run the following command.

要检查 RegisterAllProvidesIP 的现有值,请使用管理权限打开PowerShell,然后运行以下命令。

>Get-ClusterResource "Cluster Resource Name" | Get-ClusterParameter

In the output, check the value of RegisterAllProvidesIP as shown in the following screenshot.

在输出中,检查 RegisterAllProvidesIP 的值,如以下屏幕截图所示。

We can switch the value of RegisterAllProvidesIP to 0. Once it is set, only the IP of the active node is registered. Once application connects to DNS for the listener IP address, it gets the active node IP address, and the connection is successful. It eliminates the timeout issue that we may face in case of multiple IP addresses.

我们可以将RegisterAllProvidesIP的值切换为0。一旦设置,就仅注册活动节点的IP。 一旦应用程序连接到DNS以获取侦听器IP地址,它将获取活动节点IP地址,并且连接成功。 它消除了我们在多个IP地址的情况下可能遇到的超时问题。

To change the RegisterAllProvidesIP, execute the following command in administrative PowerShell.

若要更改RegisterAllProvidesIP,请在管理PowerShell中执行以下命令。

>Get-ClusterResource “Cluster Resource Name”| Set-ClusterParameter RegisterAllProvidersIP 0

If we do not know the Cluster Resource Name, execute the command Get-ClusterResource to get a list of all available cluster resources.

如果我们不知道群集资源名称,请执行命令Get-ClusterResource以获取所有可用群集资源的列表。

Once we execute the command, we need to restart the cluster role. We can either take the cluster role offline and online. We might be using the MultiSubnetfailover=True option in the application level connection string; however, it is recommended to set RegisterAllProvidesIP value to 0 as well.

一旦执行了命令,就需要重新启动集群角色。 我们可以使群集角色脱机和联机。 我们可能在应用程序级别的连接字符串中使用了MultiSubnetfailover = True选项。 但是,建议也将RegisterAllProvidesIP值也设置为0。

结论 (Conclusion)

In this article, we explored Always On listeners in SQL Server Always On Availability Groups along with MultiSubnetFailover and RegisterAllProvidesIP configurations. If you had comments or questions, feel free to leave them in the comments below

在本文中,我们探讨了SQL Server Always On可用性组中的Always On侦听器以及MultiSubnetFailover和RegisterAllProvidesIP配置。 如果您有任何意见或问题,请随时将其留在下面的评论中

翻译自: https://www.sqlshack.com/sql-server-always-on-listeners/

vue 侦听器侦听对象属性

vue 侦听器侦听对象属性_SQL Server始终处于侦听器状态相关推荐

  1. java类向拦截器传值_MyBatis拦截器:给参数对象属性赋值的实例

    该拦截器的作用:在进行增加.修改等操作时,给数据模型的一些通用操作属性(如:创建人.创建时间.修改人.修改时间等)自动赋值. 该实现是在dao层拦截,即存入db前最后一层.后经分析,不是很合理,改为在 ...

  2. Vue中的(computed)计算属性和(watched)侦听属性以及(methods)方法

    1. computed 计算属性可用于快速计算视图中显示的属性. 这些计算将被缓存,并且只在需要时更新. 他的方法不需要在data里面定义 它们完全是同步的. <div class=" ...

  3. 如何使用Vue.js中的set设置对象属性值

    1.问题背景 使用vue初始化一个对象v,并在data中初始化一个空对象obj,然后使用Vue.set()给对象obj添加属性 2.实现源码 <!DOCTYPE html> <htm ...

  4. Vue中使用的el-upload开启multiple属性,但onSuccess部分数据status:uploading状态,影响图片回显

    最近在后管vue项目中有个上传图片使用elementUI的el-upload组件要改为支持多选图片,本来是很简单的一个属性问题,但是在开启multiple多选属性后,发现onSuccess中的resp ...

  5. sql配置管理器服务是空的_Sql Server ReportingServices(SSRS)报表配置

    一: 先安装SqlServer ReportingServices 功能 打开sqlserver安装程序,选择SSRS功能组件,按照安装向导的提示完成安装过程. 二 . 绑定数据库实例 安装SSRS将 ...

  6. Html状态属性,html一些对象属性的介绍

    Form对象 Form对象方法 reset():把表单的所有输入元素重置为它们的默认值. submit():提交表单. Text对象 Text对象属性 disabled:设置或返回文本域是否应被禁用. ...

  7. Python(IT峰)笔记12-装饰器概念,装饰器的原型,装饰器的嵌套,装饰带有参数的函数,装饰器的嵌套,装饰带有多参数的函数,带有参数的装饰器,用类方法装饰函数,用韩式装饰器装饰类,用类装饰器装饰类

    1.装饰器decorator概念 在不改变原有函数代码,且保持原函数调用方法的基础上,给原函数增加新的功能(给类增加属性或方法) 用一个函数或类去装饰一个旧函数(或类)造出一个新函数(或新类) 在原有 ...

  8. vue 侦听器侦听对象属性_Spring中的异步和事务性事件侦听器

    vue 侦听器侦听对象属性 内置的事件发布功能从Spring的早期版本开始存在,并且对于处理同一应用程序上下文中Spring组件之间的基本通信仍然有用. 通常,应用程序可以生成应用程序事件(可以是任意 ...

  9. vue 侦听器侦听对象属性_不删除侦听器–使用ListenerHandles

    vue 侦听器侦听对象属性 听一个可观察的实例并对它的变化做出React很有趣. 做一些必要的事情来打断或结束这种聆听会变得很有趣. 让我们看看问题的根源和解决方法. 总览 这篇文章将首先讨论这种情况 ...

最新文章

  1. 解决Lodop 8443端口找不到CLodopfuncs.js文件问题
  2. Mac卸载mysql并安装mysql升级到8.0.13版本
  3. 网页编程从入门到精通 杨凡_学习计划丨西门子S7200编程从入门到精通
  4. python-03 爬虫相关
  5. 工程图样中粗实线的用途_图纸天天画,粗实线和细实线的线宽比例是多少?2:1还是3:1?...
  6. spring4.0:@Configuration的使用
  7. [古诗十九首] 西北有高楼 —— 无名氏
  8. oracle查询两个分区,oracle下 分区表部分分区查询慢有关问题(2)
  9. 强生CEO加入苹果成为新董事
  10. oracle sql的正则表达式,Oracle SQL 语句中正则表达式的应用
  11. (转)服务器控件三个ID
  12. php 列表收缩展示插件,可展开和收缩的jquery FAQ问答列表特效
  13. 2.Kong入门与实战 基于Nginx和OpenResty的云原生微服务网关 --- Kong 的安装和基本概念
  14. 【图像去噪】基于matlab GUI均值+中值滤波图像去噪【含Matlab源码 372期】
  15. 量化投资理论文献综述
  16. VS2015安装教程及卸载教程
  17. Neo4j【有与无】【N6】Graph数据库内部
  18. 初等变换和阶梯矩阵【】
  19. AI 人工智能学习路线
  20. vb透明控件窗体不透明函数

热门文章

  1. ubuntu安装有道云笔记_建立基于有道云笔记的错题本
  2. DevExpress下拉多选框 CheckComboboxEdit、CheckedListBoxControl
  3. div和img之间的缝隙问题
  4. windows桌面远程工具连接Ubuntu
  5. zoj3802:easy 2048 again(状压dp)
  6. (转载)linux中shell变量
  7. qmake常用语法三
  8. VB.NET写的简单图片缩放处理组件源代码,支持添加半透明效果小图标(转)
  9. 【 Element UI 】—Element UI 的基本使用
  10. 零基础带你学习MySQL—多子句查询(十九)