技术领域technical field
本申请实施例涉及计算机技术领域,具体涉及互联网技术领域,尤其涉及用于切换代理节点的方法及装置。The embodiments of the present application relate to the field of computer technology, specifically to the field of Internet technology, and in particular to a method and device for switching proxy nodes.
背景技术Background technique
云技术(Cloud technology)是基于云计算模式应用的网络技术、信息技术、整合技术、管理平台技术、应用技术等的总称,可以组成资源池,按需所用,灵活便利。通过云技术构建的网络可以成为云网络,接入云网络的设备需要通过虚拟私有网络(VirtualPrivate Network,简称VPN)隧道进行信息的传递。在云网络中,进行信息传递的两个设备之间首先要建立虚拟私有网络隧道,该虚拟私有网络隧道作为这两个设备之间的信息通道,具有较好的安全性。Cloud technology (Cloud technology) is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on cloud computing model applications. It can form a resource pool and be used on demand, which is flexible and convenient. A network constructed through cloud technology can become a cloud network, and devices connected to the cloud network need to transmit information through a virtual private network (Virtual Private Network, VPN for short) tunnel. In the cloud network, a virtual private network tunnel must first be established between two devices for information transmission. The virtual private network tunnel serves as an information channel between the two devices and has better security.
发明内容Contents of the invention
本申请实施例的目的在于提出了用于切换代理节点的方法及装置。The purpose of the embodiments of the present application is to propose a method and device for switching proxy nodes.
第一方面,本申请实施例提供了一种用于切换代理节点的方法,该方法包括:接收第一心跳信息,上述第一心跳信息包括第一工作状态信息和第二工作状态信息,上述第一工作状态信息用于指示备用代理节点的工作状态为正常或停机,上述第二工作状态信息为备用代理节点获取的主代理节点的工作状态信息,用于指示主代理节点的工作状态为正常或停机,上述主代理节点的工作状态和备用代理节点的工作状态受总控制节点监测,其中,上述主代理节点和备用代理节点对应设置;从上述第一心跳信息中提取第一工作状态信息和第二工作状态信息;响应于上述第二工作状态信息为主代理节点的工作状态为停机,则将备用代理节点切换为主代理节点。In the first aspect, the embodiment of the present application provides a method for switching a proxy node, the method includes: receiving first heartbeat information, the first heartbeat information includes first working state information and second working state information, the above first A working status information is used to indicate that the working status of the standby proxy node is normal or shut down, and the above-mentioned second working status information is the working status information of the main proxy node obtained by the standby proxy node, and is used to indicate that the working status of the main proxy node is normal or Shutdown, the working state of the above-mentioned main agent node and the working state of the standby agent node are monitored by the general control node, wherein the above-mentioned main agent node and the standby agent node are set correspondingly; extract the first work state information and the second heartbeat information from the above-mentioned first heartbeat information 2. Working status information; in response to the above second working status information, the working status of the master proxy node is shut down, then switch the backup proxy node to be the master proxy node.
在一些实施例中,上述方法还包括:接收第二心跳信息,上述第二心跳信息包括主代理节点的第三工作状态信息,上述第三工作状态信息用于指示主代理节点的工作状态为正常或停机。In some embodiments, the above method further includes: receiving second heartbeat information, where the second heartbeat information includes third working status information of the main proxy node, and the third working status information is used to indicate that the working status of the main proxy node is normal or shutdown.
在一些实施例中,上述将备用代理节点切换为主代理节点还包括:若在设定时间内没有接收到第二心跳信息,并且接收到了第一心跳信息,则将备用代理节点切换为主代理节点。In some embodiments, switching the standby proxy node to the primary proxy node further includes: if the second heartbeat message is not received within the set time and the first heartbeat message is received, switching the standby proxy node to the primary proxy node node.
在一些实施例中,上述将备用代理节点切换为主代理节点还包括:将上述备用代理节点的地址设置为数据接收地址。In some embodiments, switching the backup proxy node to the master proxy node further includes: setting the address of the backup proxy node as the data receiving address.
第二方面,本申请实施例提供了一种用于切换代理节点的方法,该方法包括:获取第一工作状态信息和第二工作状态信息,上述第一工作状态信息用于指示备用代理节点的工作状态为正常或停机,上述第二工作状态信息为备用代理节点采集的主代理节点的工作状态信息,用于指示主代理节点的工作状态为正常或停机,上述主代理节点的工作状态和备用代理节点的工作状态受总控制节点监测;将上述第一工作状态信息和第二工作状态信息封装成第一心跳信息,并发送上述第一心跳信息。In the second aspect, the embodiment of the present application provides a method for switching proxy nodes, the method includes: acquiring first working status information and second working status information, the above-mentioned first working status information is used to indicate the standby proxy node The working state is normal or shut down, and the above-mentioned second working state information is the working state information of the main agent node collected by the standby agent node, which is used to indicate that the working state of the main agent node is normal or shut down, the working state of the above-mentioned main agent node and the standby agent node The working status of the proxy node is monitored by the general control node; the first working status information and the second working status information are encapsulated into first heartbeat information, and the first heartbeat information is sent.
在一些实施例中,上述第一心跳信息按照第一设定时间周期发送。In some embodiments, the above-mentioned first heartbeat information is sent according to a first set time period.
在一些实施例中,上述获取第二工作状态信息包括:向主代理节点发送查询心跳信息,上述查询心跳信息用于查询主代理节点的工作状态,上述查询心跳信息按照第二设定时间周期发送;接收主代理节点发来的对应上述查询心跳信息的第二工作状态信息。In some embodiments, the acquisition of the second working state information includes: sending query heartbeat information to the main proxy node, the above query heartbeat information is used to query the working status of the main proxy node, and the above query heartbeat information is sent according to the second set time period ; Receive the second working status information corresponding to the above query heartbeat information sent by the main proxy node.
在一些实施例中,上述获取第二工作状态信息还包括:响应于在设定时间内没有接收到主代理节点发来的第二工作状态信息,则再次向主代理节点发送查询心跳信息。In some embodiments, the acquisition of the second working status information further includes: in response to not receiving the second working status information from the main proxy node within a set time, sending query heartbeat information to the main proxy node again.
在一些实施例中,上述获取第二工作状态信息还包括:响应于连续发送设定次数的查询心跳信息均未接收到第二工作状态信息,则生成内容为主代理节点的工作状态为停机的第二工作状态信息。In some embodiments, the acquisition of the second working status information above also includes: in response to the query heartbeat information sent continuously for a set number of times without receiving the second working status information, the generated content is that the working status of the master agent node is shutdown Second working status information.
在一些实施例中,上述查询心跳信息对应的第二设定时间周期小于上述第一设定时间周期。In some embodiments, the second set time period corresponding to the aforementioned query of heartbeat information is shorter than the aforementioned first set time period.
第三方面,本申请实施例提供了一种用于切换代理节点的装置,该装置包括:第一心跳信息接收单元,用于接收第一心跳信息,上述第一心跳信息包括第一工作状态信息和第二工作状态信息,上述第一工作状态信息用于指示备用代理节点的工作状态为正常或停机,上述第二工作状态信息为备用代理节点获取的主代理节点的工作状态信息,用于指示主代理节点的工作状态为正常或停机,其中,上述主代理节点和备用代理节点对应设置,上述主代理节点的工作状态和备用代理节点的工作状态受总控制节点监测;信息提取单元,用于从上述第一心跳信息中提取第一工作状态信息和第二工作状态信息;切换单元,响应于上述第二工作状态信息为主代理节点的工作状态为停机,用于将备用代理节点切换为主代理节点。In a third aspect, the embodiment of the present application provides a device for switching proxy nodes, the device includes: a first heartbeat information receiving unit, configured to receive first heartbeat information, the first heartbeat information includes first working status information and the second working state information, the above-mentioned first working state information is used to indicate that the working state of the backup agent node is normal or shut down, and the above-mentioned second working state information is the working state information of the main agent node acquired by the standby agent node, and is used to indicate The working state of the main agent node is normal or shutdown, wherein, the above-mentioned main agent node and the standby agent node are correspondingly set, and the working state of the above-mentioned main agent node and the working state of the standby agent node are monitored by the general control node; the information extraction unit is used for Extract the first working state information and the second working state information from the above-mentioned first heartbeat information; the switching unit responds to the above-mentioned second working state information that the working state of the main agent node is shut down, and is used to switch the standby agent node as the main agent node.
在一些实施例中,上述装置还包括:第二心跳信息接收单元,用于接收第二心跳信息,上述第二心跳信息包括主代理节点的第三工作状态信息,上述第三工作状态信息用于指示主代理节点的工作状态为正常或停机。In some embodiments, the above device further includes: a second heartbeat information receiving unit, configured to receive second heartbeat information, the second heartbeat information includes third working status information of the master proxy node, and the third working status information is used for Indicates the working status of the master agent node as normal or down.
在一些实施例中,上述切换单元还包括:若在设定时间内没有接收到第二心跳信息,并且接收到了第一心跳信息,则将备用代理节点切换为主代理节点。In some embodiments, the above-mentioned switching unit further includes: if the second heartbeat information is not received within a set time and the first heartbeat information is received, switching the standby proxy node to the primary proxy node.
在一些实施例中,上述切换单元还包括:将上述备用代理节点的地址设置为数据接收地址。In some embodiments, the switching unit further includes: setting the address of the backup proxy node as the data receiving address.
第四方面,本申请实施例提供了一种用于切换代理节点的装置,该装置包括:信息获取单元,用于获取第一工作状态信息和第二工作状态信息,上述第一工作状态信息用于指示备用代理节点的工作状态为正常或停机,上述第二工作状态信息为备用代理节点采集的主代理节点的工作状态信息,用于指示主代理节点的工作状态为正常或停机,上述主代理节点的工作状态和备用代理节点的工作状态受总控制节点监测;第一心跳信息发送单元,用于将上述第一工作状态信息和第二工作状态信息封装成第一心跳信息,并发送上述第一心跳信息。In a fourth aspect, the embodiment of the present application provides a device for switching proxy nodes, the device includes: an information acquisition unit, configured to acquire first working status information and second working status information, the first working status information is used In order to indicate that the working state of the standby agent node is normal or down, the above-mentioned second working state information is the working state information of the main agent node collected by the standby agent node, and is used to indicate that the working state of the main agent node is normal or down, and the above-mentioned main agent The working status of the node and the working status of the standby agent node are monitored by the general control node; the first heartbeat information sending unit is used to encapsulate the above-mentioned first working status information and second working status information into first heartbeat information, and send the above-mentioned first heartbeat information A heartbeat message.
在一些实施例中,上述第一心跳信息按照第一设定时间周期发送。In some embodiments, the above-mentioned first heartbeat information is sent according to a first set time period.
在一些实施例中,上述信息获取单元包括:查询心跳信息发送子单元,用于向主代理节点发送查询心跳信息,上述查询心跳信息用于查询主代理节点的工作状态,上述查询心跳信息按照第二设定时间周期发送;第二工作状态信息接收子单元,用于接收主代理节点发来的对应上述查询心跳信息的第二工作状态信息。In some embodiments, the information acquisition unit includes: a query heartbeat information sending subunit, configured to send query heartbeat information to the main agent node, the above query heartbeat information is used to query the working status of the main agent node, and the above query heartbeat information is in accordance with the first 2. Sending at a set time period; the second working status information receiving subunit is used to receive the second working status information corresponding to the above query heartbeat information sent by the master proxy node.
在一些实施例中,上述信息获取单元还包括:响应于在设定时间内没有接收到主代理节点发来的第二工作状态信息,则再次向主代理节点发送查询心跳信息。In some embodiments, the information obtaining unit further includes: in response to not receiving the second working status information from the master proxy node within a set time, sending query heartbeat information to the master proxy node again.
在一些实施例中,上述信息获取单元还包括:响应于连续发送设定次数的查询心跳信息均未接收到第二工作状态信息,则生成内容为主代理节点的工作状态为停机的第二工作状态信息。In some embodiments, the above-mentioned information acquisition unit further includes: in response to receiving no second working status information in response to sending the query heartbeat information for a set number of times continuously, generating a second working status whose working status as the master agent node is shut down status information.
在一些实施例中,上述查询心跳信息对应的第二设定时间周期小于上述第一设定时间周期。In some embodiments, the second set time period corresponding to the aforementioned query of heartbeat information is shorter than the aforementioned first set time period.
第五方面,本申请实施例提供了一种终端设备,包括:一个或多个处理器;存储器,用于存储一个或多个程序,当上述一个或多个程序被上述一个或多个处理器执行时,使得上述一个或多个处理器执行上述第一方面的用于切换代理节点的方法或第二方面的用于切换代理节点的方法。In the fifth aspect, the embodiment of the present application provides a terminal device, including: one or more processors; memory for storing one or more programs, when the above one or more programs are executed by the above one or more processors When executed, the above-mentioned one or more processors are made to execute the method for switching proxy nodes in the first aspect or the method for switching proxy nodes in the second aspect.
第六方面,本申请实施例提供了一种计算机可读介质,其上存储有计算机程序,其特征在于,该程序被处理器执行时实现上述第一方面的用于切换代理节点的方法或第二方面的用于切换代理节点的方法。In the sixth aspect, the embodiment of the present application provides a computer-readable medium on which a computer program is stored, which is characterized in that, when the program is executed by a processor, the method for switching proxy nodes or the first aspect of the above-mentioned Two methods for switching proxy nodes.
本申请实施例提供的用于切换代理节点的方法及装置,从接收的第一心跳信息中提取第一工作状态信息和第二工作状态信息;当第二工作状态信息为主代理节点的工作状态为停机,则将备用代理节点切换为主代理节点。提高了获取主代理节点的状态信息的及时性,进一步提高了将备用代理节点切换为主代理节点的及时性和准确性,提高了虚拟私有网络上数据处理的稳定性。The method and device for switching proxy nodes provided by the embodiments of the present application extract the first working status information and the second working status information from the received first heartbeat information; when the second working status information is the working status of the main proxy node If the shutdown occurs, the standby proxy node will be switched to the primary proxy node. The timeliness of obtaining the state information of the main agent node is improved, the timeliness and accuracy of switching the standby agent node to the main agent node are further improved, and the stability of data processing on the virtual private network is improved.
附图说明Description of drawings
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other characteristics, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:
图1是本申请可以应用于其中的示例性系统架构图;FIG. 1 is an exemplary system architecture diagram to which the present application can be applied;
图2是根据本申请的用于切换代理节点的方法的一个实施例的流程图;Fig. 2 is a flowchart of an embodiment of the method for switching proxy nodes according to the present application;
图3是根据本申请的用于切换代理节点的方法的另一个实施例的流程图;Fig. 3 is a flow chart of another embodiment of the method for switching proxy nodes according to the present application;
图4是根据本申请的用于切换代理节点的方法的一个应用场景的示意图;FIG. 4 is a schematic diagram of an application scenario of a method for switching proxy nodes according to the present application;
图5是根据本申请的用于切换代理节点的装置的一个实施例的结构示意图;FIG. 5 is a schematic structural diagram of an embodiment of a device for switching a proxy node according to the present application;
图6是根据本申请的用于切换代理节点的装置的另一个实施例的结构示意图;FIG. 6 is a schematic structural diagram of another embodiment of a device for switching a proxy node according to the present application;
图7是适于用来实现本申请实施例的终端设备的系统结构示意图。Fig. 7 is a schematic diagram of a system structure of a terminal device suitable for implementing the embodiment of the present application.
具体实施方式Detailed ways
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与有关发明相关的部分。The application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain related inventions, rather than to limit the invention. It should also be noted that, for the convenience of description, only the parts related to the related invention are shown in the drawings.
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and embodiments.
图1示出了可以应用本申请的用于切换代理节点的方法或用于切换代理节点的装置的实施例的示例性系统架构100。Fig. 1 shows an exemplary system architecture 100 to which embodiments of the method for switching a proxy node or the device for switching a proxy node of the present application can be applied.
如图1所示,系统架构100可以包括终端设备101、102、103,网络104和服务器105。网络104用以在终端设备101、102、103和服务器105之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in FIG. 1 , a system architecture 100 may include terminal devices 101 , 102 , 103 , a network 104 and a server 105 . The network 104 is used as a medium for providing communication links between the terminal devices 101 , 102 , 103 and the server 105 . Network 104 may include various connection types, such as wires, wireless communication links, or fiber optic cables, among others.
用户可以使用终端设备101、102、103通过网络104与服务器105交互,以接收或发送消息等。终端设备101、102、103上可以安装有各种信息处理应用,例如网页浏览器应用、信息查询类应用、即时通信工具、邮箱客户端、社交平台软件等。Users can use terminal devices 101 , 102 , 103 to interact with server 105 via network 104 to receive or send messages and the like. Various information processing applications can be installed on the terminal devices 101 , 102 , and 103 , such as web browser applications, information query applications, instant messaging tools, email clients, social platform software, and the like.
终端设备101、102、103可以是具有显示屏并且支持信息传输的各种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。The terminal devices 101, 102, 103 may be various electronic devices with display screens and supporting information transmission, including but not limited to smart phones, tablet computers, laptop computers, desktop computers and the like.
服务器105可以是提供各种服务的服务器,例如通过虚拟私有网络向终端设备101、102、103发送心跳信息,以监测终端设备101、102、103上的主代理节点和备用代理节点的工作状态的服务器。服务器105可以向终端设备101、102、103上对应目标地址的主代理节点和备用代理节点发送心跳信息,并根据主代理节点和备用代理节点返回的状态信息确定主代理节点和备用代理节点的工作状态。The server 105 can be a server that provides various services, such as sending heartbeat information to the terminal equipment 101, 102, 103 through a virtual private network, to monitor the working status of the main agent node and the standby agent node on the terminal equipment 101, 102, 103 server. The server 105 can send heartbeat information to the main agent node and the standby agent node corresponding to the target address on the terminal equipment 101, 102, 103, and determine the working status of the main agent node and the standby agent node according to the state information returned by the main agent node and the standby agent node. state.
需要说明的是,本申请实施例所提供的用于切换代理节点的方法可以由终端设备101、102、103单独执行,或者也可以由终端设备101、102、103和服务器105共同执行。相应地,用于切换代理节点的装置可以设置于终端设备101、102、103中,也可以设置于服务器105中。It should be noted that the method for switching the proxy node provided by the embodiment of the present application may be executed solely by the terminal devices 101 , 102 , 103 , or jointly executed by the terminal devices 101 , 102 , 103 and the server 105 . Correspondingly, the device for switching the proxy node can be set in the terminal equipment 101 , 102 , 103 or in the server 105 .
应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the numbers of terminal devices, networks and servers in Fig. 1 are only illustrative. According to the implementation needs, there can be any number of terminal devices, networks and servers.
继续参考图2,示出了根据本申请的用于切换代理节点的方法的一个实施例的流程200。该用于切换代理节点的方法包括以下步骤:Continuing to refer to FIG. 2 , a flow 200 of an embodiment of the method for switching proxy nodes according to the present application is shown. The method for switching proxy nodes includes the following steps:
步骤201,接收第一心跳信息。Step 201, receiving first heartbeat information.
在本实施例中,用于切换代理节点的方法运行于其上的电子设备(例如图1所示的服务器105)可以通过有线连接方式或者无线连接方式接收终端设备101、102、103上的主代理节点和/或备用代理节点发来的心跳信息。其中,上述第一心跳信息包括第一工作状态信息和第二工作状态信息,上述第一工作状态信息用于指示备用代理节点的工作状态为正常或停机,上述第二工作状态信息为备用代理节点获取的主代理节点的工作状态信息,用于指示主代理节点的工作状态为正常或停机。需要指出的是,上述无线连接方式可以包括但不限于3G/4G连接、WiFi连接、蓝牙连接、WiMAX连接、Zigbee连接、UWB(ultra wideband)连接、以及其他现在已知或将来开发的无线连接方式。In this embodiment, the electronic device (for example, the server 105 shown in FIG. 1 ) on which the method for switching proxy nodes runs can receive the host information on the terminal devices 101, 102, 103 through a wired connection or a wireless connection. Heartbeat messages from agent nodes and/or standby agent nodes. Wherein, the above-mentioned first heartbeat information includes the first working state information and the second working state information, the above-mentioned first working state information is used to indicate that the working state of the backup agent node is normal or shut down, and the above-mentioned second working state information is the standby agent node The acquired working status information of the main proxy node is used to indicate that the working status of the main proxy node is normal or shut down. It should be pointed out that the above wireless connection methods may include but not limited to 3G/4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods known or developed in the future .
服务器105可以与终端设备101、102、103建立虚拟私有网络。服务器105上可以设置有虚拟私有网络的总控制节点。总控制节点用于监测终端设备101、102、103上连接虚拟私有网络的主代理节点和备用代理节点的工作状态。终端设备101、102、103上可以设置有虚拟私有网络的主代理节点和备用代理节点。其中,主代理节点可以用于终端设备101、102、103处理与虚拟私有网络相关的数据;备用代理节点在主代理节点工作正常时自身不工作。当主代理节点出现故障时,备用代理节点可以替换掉出故障的主代理节点成为主代理节点继续处理数据(即将备用代理节点切换为主代理节点),出故障的主代理节点可以作为备用代理节点停止处理数据。可见,主代理节点和备用代理节点是对应设置的,需要设置在相同的终端设备上的(或相同的数据区域)。通常情况下,主代理节点和备用代理节点都按照设定时间周期向总控制节点发送心跳信息,以告知总控制节点自身的工作状态。现有的心跳信息发送的时间周期较长,在该时间周期内,主代理节点可能已经停机较长时间,导致总控制节点不能及时发现,进而降低了虚拟私有网络的信息传输效率;如果该时间周期设置的过短,则容易由于网络延时、主代理节点数据处理量较大等原因造成心跳信息没有在该时间周期及时到达总控制节点,进而导致总控制节点对主代理节点进行误切换,降低了虚拟私有网络上数据处理的稳定性。The server 105 can establish a virtual private network with the terminal devices 101 , 102 , 103 . The general control node of the virtual private network may be set on the server 105 . The general control node is used to monitor the working status of the main agent node and the standby agent node connected to the virtual private network on the terminal equipment 101 , 102 , 103 . The main proxy node and backup proxy node of the virtual private network may be set on the terminal devices 101, 102, 103. Wherein, the main agent node can be used for the terminal equipment 101, 102, 103 to process data related to the virtual private network; the standby agent node does not work when the main agent node works normally. When the main proxy node fails, the standby proxy node can replace the failed primary proxy node to become the primary proxy node to continue processing data (that is, switch the standby proxy node to the primary proxy node), and the failed primary proxy node can be used as a backup proxy node to stop Data processing. It can be seen that the main agent node and the standby agent node are set correspondingly, and need to be set on the same terminal device (or the same data area). Usually, both the main agent node and the standby agent node send heartbeat information to the general control node according to the set time period, so as to inform the general control node of its own working status. The time period for sending the existing heartbeat information is relatively long. During this time period, the main proxy node may have been shut down for a long time, causing the master control node to fail to find out in time, thereby reducing the information transmission efficiency of the virtual private network; if the time period If the period is set too short, it is easy to cause the heartbeat information to fail to reach the general control node in time due to network delay, large data processing volume of the main agent node, etc., which will cause the general control node to switch to the main agent node by mistake. Reduced stability of data processing on virtual private networks.
由上述描述可知,本实施例的终端设备101、102、103上虚拟私有网络相关的数据主要由主代理节点处理,备用代理节点大多数时间的数据处理量很小。因此,本申请实施例由备用代理节点向总控制节点发送第一心跳信息。It can be known from the above description that the data related to the virtual private network on the terminal devices 101, 102, and 103 in this embodiment is mainly processed by the main agent node, and the data processing amount of the standby agent node is very small most of the time. Therefore, in the embodiment of the present application, the standby proxy node sends the first heartbeat information to the general control node.
步骤202,从上述第一心跳信息中提取第一工作状态信息和第二工作状态信息。Step 202, extracting the first working state information and the second working state information from the first heartbeat information.
总控制节点接收到第一心跳信息后,可以从第一心跳信息中提取第一工作状态信息和第二工作状态信息。其中,第一工作状态信息用于指示备用代理节点的工作状态为正常或停机。由上述描述可知,第一心跳信息是备用代理节点发送给总控制节点的,第一工作状态信息就是备用代理节点通过自身的状态信息构建的。第二工作状态信息为备用代理节点获取的主代理节点的工作状态信息,用于指示主代理节点的工作状态为正常或停机。备用代理节点除了将自身的状态信息构建成第一工作状态信息外,还可以监测主代理节点的工作状态,并通过主代理节点的状态信息构建第二工作状态信息。即,备用代理节点发送的第一心跳信息比现有的心跳信息多了第二工作状态信息。After receiving the first heartbeat information, the general control node may extract the first working state information and the second working state information from the first heartbeat information. Wherein, the first working state information is used to indicate that the working state of the standby proxy node is normal or shut down. It can be seen from the above description that the first heartbeat information is sent by the standby proxy node to the general control node, and the first working status information is constructed by the standby proxy node through its own status information. The second working status information is the working status information of the main proxy node acquired by the standby proxy node, and is used to indicate that the working status of the main proxy node is normal or shut down. In addition to building its own state information into the first working state information, the standby agent node can also monitor the working state of the main agent node, and construct the second working state information through the state information of the main agent node. That is, the first heartbeat information sent by the standby agent node has more second working state information than the existing heartbeat information.
步骤203,响应于上述第二工作状态信息为主代理节点的工作状态为停机,则将备用代理节点切换为主代理节点。Step 203, in response to the second working status information that the working status of the main proxy node is shut down, switch the standby proxy node to the main proxy node.
通常情况下,终端设备101、102、103上虚拟私有网络相关的数据主要由主代理节点处理,因此,备用代理节点通常不发生故障,即总控制节点通常能够按设定的时间周期接收到第一心跳信息。当第一心跳信息包含的第二工作状态信息为主代理节点的工作状态为停机时,可以认为主代理节点出现了故障或停机。这是因为,主代理节点和备用代理节点是对应设置的,即主代理节点和备用代理节点通常设置在相同的终端设备上,主代理节点和备用代理节点之间的数据传输稳定而快速。备用代理节点可以准确而快速地确认主代理节点的工作状态。当主代理节点在处理虚拟私有网络相关数据时出现停机等故障时,备用代理节点可以及时获取到主代理节点的工作状态,并将包含主代理节点的工作状态的第二工作状态信息封装成第一心跳信息发送给总控制节点。当第二工作状态信息为主代理节点的工作状态为停机时,总控制节点可以及时将备用代理节点切换为主代理节点,以提高虚拟私有网络上数据处理的稳定性。将备用代理节点切换为主代理节点时,总控制节点可以向终端设备101、102、103发送切换指令,终端设备101、102、103根据该切换指令将备用代理节点切换为主代理节点;总控制节点还可以直接向备用代理节点发送指令,使得备用代理节点处理虚拟私有网络上的数据。将备用代理节点切换为主代理节点的切换方式还可以是其他方式,此处不再一一赘述。Usually, the data related to the virtual private network on the terminal equipment 101, 102, 103 is mainly processed by the main agent node, therefore, the standby agent node usually does not fail, that is, the general control node can usually receive the first A heartbeat message. When the second working status information contained in the first heartbeat information is the downtime of the main proxy node, it can be considered that the main proxy node is faulty or down. This is because the main proxy node and the standby proxy node are set correspondingly, that is, the primary proxy node and the standby proxy node are usually set on the same terminal device, and the data transmission between the primary proxy node and the standby proxy node is stable and fast. The standby proxy node can accurately and quickly confirm the working status of the primary proxy node. When the main agent node has a failure such as downtime when processing virtual private network related data, the standby agent node can obtain the working status of the main agent node in time, and encapsulate the second working status information containing the working status of the main agent node into the first The heartbeat information is sent to the general control node. When the second working status information indicates that the working status of the master proxy node is shut down, the general control node can switch the backup proxy node to the master proxy node in time, so as to improve the stability of data processing on the virtual private network. When the standby proxy node is switched to the main proxy node, the general control node can send switching instructions to the terminal equipment 101, 102, 103, and the terminal equipment 101, 102, 103 will switch the standby proxy node to the main proxy node according to the switching instructions; The node can also directly send instructions to the standby proxy node, so that the standby proxy node processes data on the virtual private network. There may also be other ways to switch the standby agent node to the master agent node, which will not be repeated here.
在本实施例的一些可选的实现方式中,上述方法还可以包括:接收第二心跳信息。In some optional implementation manners of this embodiment, the foregoing method may further include: receiving second heartbeat information.
正常情况下,总控制节点除了收到备用代理节点发来的第一心跳信息外,还会收到主代理节点发来的第二心跳信息。第二心跳信息是主代理节点通过自身的工作状态信息构建的,上述第二心跳信息包括主代理节点的第三工作状态信息,上述第三工作状态信息可以用于指示主代理节点的工作状态为正常或停机。通常,第一心跳信息和第二心跳信息按照设定的时间周期发送到总控制节点。Under normal circumstances, in addition to receiving the first heartbeat information sent by the standby agent node, the master control node will also receive the second heartbeat information sent by the main agent node. The second heartbeat information is constructed by the master agent node through its own work status information. The second heartbeat information includes the third work status information of the master agent node. The third work status information can be used to indicate that the work status of the master agent node is normal or down. Usually, the first heartbeat information and the second heartbeat information are sent to the general control node according to a set time period.
在本实施例的一些可选的实现方式中,上述将备用代理节点切换为主代理节点还可以包括:若在设定时间内没有接收到第二心跳信息,并且接收到了第一心跳信息,则将备用代理节点切换为主代理节点。In some optional implementations of this embodiment, switching the standby proxy node to the primary proxy node may also include: if the second heartbeat information is not received within the set time and the first heartbeat information is received, then Switch the standby proxy node to the primary proxy node.
实际中,主代理节点可能由于处理的数据量大等原因,不能按照对应的时间周期发送到总控制节点。如果总控制节点在设定时间内没有接收到第二心跳信息,但又能准时收到第一心跳信息,则有理由认为主代理节点出现了故障或停机。此时,总控制节点可以将备用代理节点切换为主代理节点。In practice, the main proxy node may not be able to send it to the master control node according to the corresponding time period due to reasons such as a large amount of data to be processed. If the master control node does not receive the second heartbeat message within the set time, but can receive the first heartbeat message on time, it is reasonable to think that the master agent node is faulty or shut down. At this time, the general control node can switch the standby agent node to be the main agent node.
在本实施例的一些可选的实现方式中,上述将备用代理节点切换为主代理节点包括可以:将上述备用代理节点的地址设置为数据接收地址。In some optional implementation manners of this embodiment, switching the standby proxy node to the primary proxy node may include: setting the address of the standby proxy node as the data receiving address.
总控制节点所在的服务器105上可以记录主代理节点和备用代理节点的地址信息。当需要将备用代理节点切换为主代理节点时,可以在服务器105上将虚拟私有网络上数据的接收地址修改为备用代理节点的地址。The server 105 where the general control node is located can record the address information of the main agent node and the standby agent node. When the standby proxy node needs to be switched to the primary proxy node, the address for receiving data on the virtual private network can be changed to the address of the standby proxy node on the server 105 .
继续参考图3,示出了根据本申请的用于切换代理节点的方法的一个实施例的流程300。该用于切换代理节点的方法包括以下步骤:Continuing to refer to FIG. 3 , a flow 300 of an embodiment of the method for switching proxy nodes according to the present application is shown. The method for switching proxy nodes includes the following steps:
步骤301,获取第一工作状态信息和第二工作状态信息。Step 301, acquiring first working status information and second working status information.
在本实施例中,用于切换代理节点的方法运行于其上的电子设备(例如图1所示的终端设备101、102、103)可以通过有线连接方式或者无线连接方式向服务器105上的总控制节点发送的心跳信息。需要指出的是,上述无线连接方式可以包括但不限于3G/4G连接、WiFi连接、蓝牙连接、WiMAX连接、Zigbee连接、UWB(ultra wideband)连接、以及其他现在已知或将来开发的无线连接方式。In this embodiment, the electronic device on which the method for switching proxy nodes runs (such as the terminal devices 101, 102, and 103 shown in FIG. Heartbeat information sent by the control node. It should be pointed out that the above wireless connection methods may include but not limited to 3G/4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods known or developed in the future .
本实施例中,终端设备101、102、103上的备用代理节点处理可以获取自身的第一工作状态信息外,还可以用于监测主代理节点的工作状态,并获取对应主代理节点的第二工作状态信息。其中,上述第一工作状态信息用于指示备用代理节点的工作状态为正常或停机,上述第二工作状态信息为备用代理节点采集的主代理节点的工作状态信息,用于指示主代理节点的工作状态为正常或停机。备用代理节点获取的第二工作状态信息,可以是主代理节点主动向备用代理节点发送的方式,还可以是备用代理节点主动读取主代理节点的第二工作状态信息的方式等,此处不再一一赘述。In this embodiment, the standby proxy nodes on the terminal devices 101, 102, 103 can obtain their own first working status information, and can also be used to monitor the working status of the main proxy node, and obtain the second status of the corresponding main proxy node. Job status information. Wherein, the above-mentioned first working state information is used to indicate that the working state of the standby agent node is normal or shut down, and the above-mentioned second working state information is the working state information of the main agent node collected by the standby agent node, and is used to indicate the working state of the main agent node. Status is Normal or Down. The second working status information acquired by the standby proxy node may be the way the main proxy node actively sends the standby proxy node, or the way the standby proxy node actively reads the second working status information of the primary proxy node, etc. Let me repeat them one by one.
在本实施例的一些可选的实现方式中,上述获取第二工作状态信息可以包括以下步骤:In some optional implementations of this embodiment, the acquisition of the second working state information may include the following steps:
第一步,向主代理节点发送查询心跳信息。The first step is to send query heartbeat information to the master proxy node.
主代理节点自身需要处理的数据量很大,而备用代理节点处理的数据量则很小。因此,本实施例的备用代理节点可以主动向主代理节点发送查询心跳信息。其中,上述查询心跳信息用于查询主代理节点的工作状态。并且,上述查询心跳信息可以按照第二设定时间周期发送。The main agent node itself needs to process a large amount of data, while the amount of data processed by the standby agent node is very small. Therefore, the standby agent node in this embodiment can actively send query heartbeat information to the main agent node. Wherein, the above query heartbeat information is used to query the working status of the main proxy node. Moreover, the above query heartbeat information may be sent according to a second set time period.
第二步,接收主代理节点发来的对应上述查询心跳信息的第二工作状态信息。The second step is to receive the second working status information corresponding to the above query heartbeat information sent by the main proxy node.
主代理节点接收到备用代理节点发来的查询心跳信息后,可以将主代理节点自身的第二工作状态信息发送给备用代理节点。After receiving the query heartbeat information sent by the standby proxy node, the main proxy node may send the second working status information of the main proxy node itself to the standby proxy node.
在本实施例的一些可选的实现方式中,上述获取第二工作状态信息还可以包括:响应于在设定时间内没有接收到主代理节点发来的第二工作状态信息,则再次向主代理节点发送查询心跳信息。In some optional implementations of this embodiment, the acquisition of the second working status information may also include: in response to not receiving the second working status information sent by the master agent node within the set time, then sending the master proxy node again Agent nodes send query heartbeat information.
由上述描述可知,主代理节点的数据处理量很大。当发送查询心跳信息后,备用代理节点可能没有在设定时间内没有接收到主代理节点发来的第二工作状态信息。此时,备用代理节点可以再次向主代理节点发送查询心跳信息。It can be seen from the above description that the data processing volume of the main agent node is very large. After sending the query heartbeat information, the standby agent node may not receive the second working status information sent by the main agent node within a set time. At this point, the standby proxy node can send query heartbeat information to the primary proxy node again.
在本实施例的一些可选的实现方式中,上述获取第二工作状态信息还可以包括:响应于连续发送设定次数的查询心跳信息均未接收到第二工作状态信息,则生成内容为主代理节点的工作状态为停机的第二工作状态信息。In some optional implementations of this embodiment, the acquisition of the second working status information above may also include: in response to no second working status information is received in response to the query heartbeat information sent for a set number of times continuously, the generated content is mainly The working status of the agent node is the second working status information of downtime.
当备用代理节点连续设定次发送查询心跳信息后,均没有收到主代理节点发来的第二工作状态信息,可以认为主代理节点出现了停机。此时,备用代理节点可以自己生成内容为主代理节点的工作状态为停机的第二工作状态信息。When the standby proxy node does not receive the second working status information from the primary proxy node after sending the query heartbeat information for a set number of consecutive times, it can be considered that the primary proxy node is down. At this time, the standby proxy node may generate the second working status information that the working status of the primary proxy node is shutdown.
步骤302,将上述第一工作状态信息和第二工作状态信息封装成第一心跳信息,并发送上述第一心跳信息。Step 302: Encapsulate the above-mentioned first working state information and the second working state information into first heartbeat information, and send the above-mentioned first heartbeat information.
得到第一工作状态信息和第二工作状态信息后,备用代理节点可以将第一工作状态信息和第二工作状态信息封装成第一心跳信息,并按照第一设定时间周期发送第一心跳信息。After obtaining the first working status information and the second working status information, the standby proxy node can encapsulate the first working status information and the second working status information into first heartbeat information, and send the first heartbeat information according to the first set time period .
在本实施例的一些可选的实现方式中,上述查询心跳信息对应的第二设定时间周期小于上述第一设定时间周期。In some optional implementation manners of this embodiment, the second set time period corresponding to the aforementioned query of heartbeat information is shorter than the aforementioned first set time period.
为了能够及时告知总控制节点关于主代理节点的工作状态,本实施例查询心跳信息对应的第二设定时间周期要小于上述第一设定时间周期。由于主代理节点和备用代理节点处于相同的位置,因此可以保证备用代理节点能够将查询心跳信息快速有效地发送给主代理节点,主代理节点也可以快速有效地将第二工作状态信息发送给备用代理节点。并且,由于备用代理节点处理的数据量小,通过备用代理节点发送第二工作状态信息能够避免主代理节点因为处理数据量大而出现的信息发送延时和停机等故障,提高了总控制节点获取主代理节点的状态信息的及时性,进一步提高了总控制节点将备用代理节点切换为主代理节点的及时性和准确性,提高了虚拟私有网络上数据处理的稳定性。第二设定时间周期越小,说明备用代理节点能够更频繁地获取主代理节点的状态信息。根据实际需要,第二设定时间周期可以设置的远小于第一设定时间周期,使得备用代理节点能够及时监测到主代理节点的状态信息。In order to be able to inform the general control node about the working status of the main agent node in time, the second set time period corresponding to the query of heartbeat information in this embodiment is shorter than the above-mentioned first set time period. Since the main agent node and the standby agent node are at the same location, it can be guaranteed that the standby agent node can quickly and effectively send the query heartbeat information to the main agent node, and the main agent node can also quickly and effectively send the second working status information to the standby agent node. agent node. Moreover, since the amount of data processed by the standby proxy node is small, sending the second working status information through the standby proxy node can avoid failures such as information transmission delay and shutdown caused by the large amount of data processed by the main proxy node, and improve the overall control node acquisition. The timeliness of the state information of the main agent node further improves the timeliness and accuracy of the general control node switching the standby agent node to the main agent node, and improves the stability of data processing on the virtual private network. The smaller the second set time period, it means that the standby proxy node can obtain the status information of the main proxy node more frequently. According to actual needs, the second set time period can be set much shorter than the first set time period, so that the standby proxy node can monitor the state information of the main proxy node in time.
继续参见图4,图4是根据本实施例的用于切换代理节点的方法的应用场景的一个示意图。在图4的应用场景中,服务器105上的总控制节点接收到终端设备103上备用代理节点的第一心跳信息后,从第一心跳信息中提取到第一工作状态信息和第二工作状态信息;如果第二工作状态信息为主代理节点的工作状态为停机,则将终端设备103上的备用代理节点切换为主代理节点。Continuing to refer to FIG. 4 , FIG. 4 is a schematic diagram of an application scenario of the method for switching proxy nodes according to this embodiment. In the application scenario of Fig. 4, after the general control node on the server 105 receives the first heartbeat information of the backup agent node on the terminal device 103, it extracts the first working status information and the second working status information from the first heartbeat information ; If the second working status information indicates that the working status of the master proxy node is shut down, switch the standby proxy node on the terminal device 103 to be the master proxy node.
本申请的上述实施例提供的方法从接收的第一心跳信息中提取第一工作状态信息和第二工作状态信息;当第二工作状态信息为主代理节点的工作状态为停机,则将备用代理节点切换为主代理节点。提高了获取主代理节点的状态信息的及时性,进一步提高了将备用代理节点切换为主代理节点的及时性和准确性,提高了虚拟私有网络上数据处理的稳定性。The method provided by the above-mentioned embodiments of the present application extracts the first working state information and the second working state information from the received first heartbeat information; The node switches to the master proxy node. The timeliness of obtaining the state information of the main agent node is improved, the timeliness and accuracy of switching the standby agent node to the main agent node are further improved, and the stability of data processing on the virtual private network is improved.
进一步参考图5,作为对上述各图所示方法的实现,本申请提供了一种用于切换代理节点的装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。Further referring to FIG. 5 , as an implementation of the methods shown in the above figures, the present application provides an embodiment of a device for switching proxy nodes, which corresponds to the method embodiment shown in FIG. 2 , The device can be specifically applied to various electronic devices.
如图5所示,本实施例的用于切换代理节点的装置500可以包括:第一心跳信息接收单元501、信息提取单元502和切换单元503。其中,第一心跳信息接收单元501用于接收第一心跳信息,上述第一心跳信息包括第一工作状态信息和第二工作状态信息,上述第一工作状态信息用于指示备用代理节点的工作状态为正常或停机,上述第二工作状态信息为备用代理节点获取的主代理节点的工作状态信息,用于指示主代理节点的工作状态为正常或停机;信息提取单元502用于从上述第一心跳信息中提取第一工作状态信息和第二工作状态信息;切换单元503响应于上述第二工作状态信息为主代理节点的工作状态为停机,用于将备用代理节点切换为主代理节点。As shown in FIG. 5 , the apparatus 500 for switching proxy nodes in this embodiment may include: a first heartbeat information receiving unit 501 , an information extracting unit 502 and a switching unit 503 . Wherein, the first heartbeat information receiving unit 501 is used to receive the first heartbeat information, the above-mentioned first heartbeat information includes the first working state information and the second working state information, and the above-mentioned first working state information is used to indicate the working state of the standby proxy node For normal or downtime, the above-mentioned second working status information is the working status information of the main proxy node obtained by the standby proxy node, which is used to indicate that the working status of the main proxy node is normal or downtime; Extract the first working status information and the second working status information from the information; the switching unit 503 is used to switch the backup proxy node to the main proxy node in response to the above second working status information that the working status of the master proxy node is shutdown.
在本实施例的一些可选的实现方式中,用于切换代理节点的装置500还可以包括:第二心跳信息接收单元(图中未示出),用于接收第二心跳信息,上述第二心跳信息包括主代理节点的第三工作状态信息,上述第三工作状态信息用于指示主代理节点的工作状态为正常或停机。In some optional implementations of this embodiment, the device 500 for switching proxy nodes may further include: a second heartbeat information receiving unit (not shown in the figure), configured to receive second heartbeat information, the above-mentioned second The heartbeat information includes the third working status information of the main proxy node, and the third working status information is used to indicate that the working status of the main proxy node is normal or shut down.
在本实施例的一些可选的实现方式中,上述切换单元503还可以包括:若在设定时间内没有接收到第二心跳信息,并且接收到了第一心跳信息,则将备用代理节点切换为主代理节点。In some optional implementations of this embodiment, the switching unit 503 may further include: if the second heartbeat information is not received within the set time and the first heartbeat information is received, switching the standby proxy node to Master agent node.
在本实施例的一些可选的实现方式中,上述切换单元503还可以包括:将上述备用代理节点的地址设置为数据接收地址。In some optional implementation manners of this embodiment, the switching unit 503 may further include: setting the address of the standby proxy node as the data receiving address.
进一步参考图6,作为对上述各图所示方法的实现,本申请提供了一种用于切换代理节点的装置的一个实施例,该装置实施例与图3所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。Further referring to FIG. 6 , as an implementation of the methods shown in the above figures, the present application provides an embodiment of a device for switching proxy nodes, which corresponds to the method embodiment shown in FIG. 3 , The device can be specifically applied to various electronic devices.
如图6所示,本实施例的用于切换代理节点的装置600可以包括:信息获取单元601和第一心跳信息发送单元602。其中,信息获取单元601用于获取第一工作状态信息和第二工作状态信息,上述第一工作状态信息用于指示备用代理节点的工作状态为正常或停机,上述第二工作状态信息为备用代理节点采集的主代理节点的工作状态信息,用于指示主代理节点的工作状态为正常或停机;第一心跳信息发送单元602用于将上述第一工作状态信息和第二工作状态信息封装成第一心跳信息,并发送上述第一心跳信息。As shown in FIG. 6 , the apparatus 600 for switching proxy nodes in this embodiment may include: an information acquiring unit 601 and a first heartbeat information sending unit 602 . Wherein, the information acquisition unit 601 is used to acquire the first working state information and the second working state information, the above-mentioned first working state information is used to indicate that the working state of the backup agent node is normal or down, and the above-mentioned second working state information is the standby agent node The working state information of the main agent node collected by the node is used to indicate that the working state of the main agent node is normal or shut down; the first heartbeat information sending unit 602 is used to encapsulate the above-mentioned first working state information and second working state information into a second A heartbeat message, and send the above-mentioned first heartbeat message.
在本实施例的一些可选的实现方式中,上述第一心跳信息按照第一设定时间周期发送。In some optional implementation manners of this embodiment, the above-mentioned first heartbeat information is sent according to a first set time period.
在本实施例的一些可选的实现方式中,上述信息获取单元601可以包括:查询心跳信息发送子单元(图中未示出)和第二工作状态信息接收子单元(图中未示出)。其中,查询心跳信息发送子单元用于向主代理节点发送查询心跳信息,上述查询心跳信息用于查询主代理节点的工作状态,上述查询心跳信息按照第二设定时间周期发送;第二工作状态信息接收子单元用于接收主代理节点发来的对应上述查询心跳信息的第二工作状态信息。In some optional implementations of this embodiment, the information acquiring unit 601 may include: a query heartbeat information sending subunit (not shown in the figure) and a second working status information receiving subunit (not shown in the figure) . Wherein, the query heartbeat information sending subunit is used to send query heartbeat information to the main proxy node, the above query heartbeat information is used to query the working status of the main proxy node, and the above query heartbeat information is sent according to the second set time period; the second working status The information receiving subunit is configured to receive the second working status information corresponding to the above query heartbeat information sent by the main proxy node.
在本实施例的一些可选的实现方式中,上述信息获取单元601还可以包括:响应于在设定时间内没有接收到主代理节点发来的第二工作状态信息,则再次向主代理节点发送查询心跳信息。In some optional implementations of this embodiment, the above-mentioned information obtaining unit 601 may also include: in response to not receiving the second working status information sent by the main agent node within the set time, then send the main agent node again Send query heartbeat information.
在本实施例的一些可选的实现方式中,上述信息获取单元601还可以包括:In some optional implementation manners of this embodiment, the information acquiring unit 601 may further include:
响应于连续发送设定次数的查询心跳信息均未接收到第二工作状态信息,则生成内容为主代理节点的工作状态为停机的第二工作状态信息。In response to the fact that no second working state information is received after the query heartbeat information is continuously sent for a set number of times, the second working state information that the working state of the master agent node is shut down is generated.
在本实施例的一些可选的实现方式中,上述查询心跳信息对应的第二设定时间周期小于上述第一设定时间周期。In some optional implementation manners of this embodiment, the second set time period corresponding to the aforementioned query of heartbeat information is shorter than the aforementioned first set time period.
本实施例还提供了一种终端设备,包括:一个或多个处理器;存储器,用于存储一个或多个程序,当上述一个或多个程序被上述一个或多个处理器执行时,使得上述一个或多个处理器执行上述的用于切换代理节点的方法。This embodiment also provides a terminal device, including: one or more processors; memory, used to store one or more programs, when the one or more programs are executed by the one or more processors, so that The above-mentioned one or more processors execute the above-mentioned method for switching the proxy node.
本实施例还提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理器执行时实现上述的用于切换代理节点的方法。This embodiment also provides a computer-readable medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned method for switching an agent node is realized.
下面参考图7,其示出了适于用来实现本申请实施例的终端设备的计算机系统700的结构示意图。图7示出的终端设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。Referring now to FIG. 7 , it shows a schematic structural diagram of a computer system 700 suitable for implementing a terminal device according to an embodiment of the present application. The terminal device shown in FIG. 7 is only an example, and should not limit the functions and scope of use of this embodiment of the present application.
如图7所示,计算机系统700包括中央处理单元(CPU)701,其可以根据存储在只读存储器(ROM)702中的程序或者从存储部分708加载到随机访问存储器(RAM)703中的程序而执行各种适当的动作和处理。在RAM 703中,还存储有系统700操作所需的各种程序和数据。CPU 701、ROM 702以及RAM 703通过总线704彼此相连。输入/输出(I/O)接口705也连接至总线704。As shown in FIG. 7 , a computer system 700 includes a central processing unit (CPU) 701 that can be programmed according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage section 708 into a random access memory (RAM) 703 Instead, various appropriate actions and processes are performed. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701 , ROM 702 , and RAM 703 are connected to each other via a bus 704 . An input/output (I/O) interface 705 is also connected to the bus 704 .
以下部件连接至I/O接口705:包括键盘、鼠标等的输入部分706;包括诸如液晶显示器(LCD)等以及扬声器等的输出部分707;包括硬盘等的存储部分708;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分709。通信部分709经由诸如因特网的网络执行通信处理。驱动器710也根据需要连接至I/O接口705。可拆卸介质711,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器710上,以便于从其上读出的计算机程序根据需要被安装入存储部分708。The following components are connected to the I/O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a liquid crystal display (LCD) etc., a speaker, etc.; a storage section 708 including a hard disk, etc.; Communication section 709 of a network interface card such as a modem. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, optical disk, magneto-optical disk, semiconductor memory, etc. is mounted on the drive 710 as necessary so that a computer program read therefrom is installed into the storage section 708 as necessary.
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分709从网络上被下载和安装,和/或从可拆卸介质711被安装。在该计算机程序被中央处理单元(CPU)701执行时,执行本申请的方法中限定的上述功能。In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, where the computer program includes program codes for executing the methods shown in the flowcharts. In such an embodiment, the computer program may be downloaded and installed from a network via communication portion 709 and/or installed from removable media 711 . When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the method of the present application are performed.
需要说明的是,本申请上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本申请中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本申请中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、RF等等,或者上述的任意合适的组合。It should be noted that the computer-readable medium mentioned above in this application may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two. A computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to, electrical connections with one or more wires, portable computer diskettes, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, in which computer-readable program codes are carried. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. . Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
附图中的流程图和框图,图示了按照本申请各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved. It should also be noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
描述于本申请实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括第一心跳信息接收单元、信息提取单元和切换单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,切换单元还可以被描述为“用于将备用代理节点切换为主代理节点的单元”。The units involved in the embodiments described in the present application may be implemented by means of software or by means of hardware. The described units may also be set in a processor, for example, it may be described as: a processor includes a first heartbeat information receiving unit, an information extracting unit, and a switching unit. Wherein, the names of these units do not limit the unit itself under certain circumstances, for example, the switching unit may also be described as "a unit for switching the standby proxy node to the primary proxy node".
作为另一方面,本申请还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的装置中所包含的;也可以是单独存在,而未装配入该装置中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该装置执行时,使得该装置:接收第一心跳信息,上述第一心跳信息包括第一工作状态信息和第二工作状态信息,上述第一工作状态信息用于指示备用代理节点的工作状态为正常或停机,上述第二工作状态信息为备用代理节点获取的主代理节点的工作状态信息,用于指示主代理节点的工作状态为正常或停机;从上述第一心跳信息中提取第一工作状态信息和第二工作状态信息;响应于上述第二工作状态信息为主代理节点的工作状态为停机,则将备用代理节点切换为主代理节点。As another aspect, the present application also provides a computer-readable medium. The computer-readable medium may be included in the device described in the above embodiments, or it may exist independently without being assembled into the device. The above-mentioned computer-readable medium carries one or more programs, and when the one or more programs are executed by the device, the device: receives first heartbeat information, and the first heartbeat information includes the first working status information and the second Working status information, the above-mentioned first working status information is used to indicate that the working status of the standby proxy node is normal or shut down, and the above-mentioned second working status information is the working status information of the main proxy node obtained by the standby proxy node, and is used to indicate that the main proxy node The working state of the node is normal or shut down; the first working state information and the second working state information are extracted from the above-mentioned first heartbeat information; in response to the above-mentioned second working state information, the working state of the main agent node is shut down, then the standby agent The node switches to the master proxy node.
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述发明构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a preferred embodiment of the present application and an illustration of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solution formed by the specific combination of the above-mentioned technical features, and should also cover the technical solutions formed by the above-mentioned technical features or without departing from the above-mentioned inventive concept. Other technical solutions formed by any combination of equivalent features. For example, a technical solution formed by replacing the above-mentioned features with technical features with similar functions disclosed in (but not limited to) this application.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810121337.6ACN108092858B (en) | 2018-02-07 | 2018-02-07 | Method and device for switching proxy nodes |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810121337.6ACN108092858B (en) | 2018-02-07 | 2018-02-07 | Method and device for switching proxy nodes |
| Publication Number | Publication Date |
|---|---|
| CN108092858A CN108092858A (en) | 2018-05-29 |
| CN108092858Btrue CN108092858B (en) | 2019-10-18 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201810121337.6AActiveCN108092858B (en) | 2018-02-07 | 2018-02-07 | Method and device for switching proxy nodes |
| Country | Link |
|---|---|
| CN (1) | CN108092858B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111064609A (en)* | 2019-12-11 | 2020-04-24 | 北京奇艺世纪科技有限公司 | Master-slave switching method and device of message system, electronic equipment and storage medium |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101262479A (en)* | 2008-04-25 | 2008-09-10 | 华为技术有限公司 | A network file sharing method, server and network file sharing system |
| CN101877714A (en)* | 2009-11-30 | 2010-11-03 | 英业达股份有限公司 | Integrated server |
| CN102487342A (en)* | 2010-12-03 | 2012-06-06 | 阿里巴巴集团控股有限公司 | Device and method for controlling virtual internet protocol address binding |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7536581B2 (en)* | 2006-05-16 | 2009-05-19 | Bea Systems, Inc. | Automatic migratable services |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101262479A (en)* | 2008-04-25 | 2008-09-10 | 华为技术有限公司 | A network file sharing method, server and network file sharing system |
| CN101877714A (en)* | 2009-11-30 | 2010-11-03 | 英业达股份有限公司 | Integrated server |
| CN102487342A (en)* | 2010-12-03 | 2012-06-06 | 阿里巴巴集团控股有限公司 | Device and method for controlling virtual internet protocol address binding |
| Publication number | Publication date |
|---|---|
| CN108092858A (en) | 2018-05-29 |
| Publication | Publication Date | Title |
|---|---|---|
| EP3575975B1 (en) | Method and apparatus for operating smart network interface card | |
| US20150026237A1 (en) | Push notification via file sharing service synchronization | |
| CN105071976A (en) | Data transmission method and device | |
| CN109002366A (en) | A remote debugging method and device for mobile web pages | |
| WO2020207454A1 (en) | Information pushing method and device | |
| CN108280020B (en) | Monitoring method and device of computer equipment, terminal and computer storage medium | |
| CN114089974B (en) | Cloud code development system, method, device, equipment and storage medium | |
| CN113722007B (en) | Configuration method, device and system of VPN branch equipment | |
| CN109828830B (en) | Method and apparatus for managing containers | |
| JP2024534289A (en) | System and method for retrieving RAN information - Patents.com | |
| CN115987965A (en) | File uploading method, device, equipment and storage medium | |
| JP5880315B2 (en) | System management apparatus, system management method, and system management program | |
| US10261937B2 (en) | Method and system for communication of device information | |
| CN114222001B (en) | Edge device, edge device method, edge device system, electronic device and storage medium | |
| CN108092858B (en) | Method and device for switching proxy nodes | |
| US11366613B2 (en) | Method and apparatus for writing data | |
| CN111124874A (en) | Method for debugging webpage, debugging server and main control device | |
| CN109271310B (en) | Development testing method and device for network function of mobile application program | |
| CN113407229B (en) | Method and device for generating offline scripts | |
| CN112882741A (en) | Application management system and method | |
| CN110011767B (en) | Method and apparatus for TCP connection backup | |
| CN110764932A (en) | Data processing method, system, medium and computing device | |
| CN112583614B (en) | Host cluster management method, device and computer readable medium | |
| CN112311833A (en) | Data updating method and device | |
| CN114791996B (en) | Information processing method, device, system, electronic device and storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |