CN108206779B - A cluster access system, method and device - Google Patents

A cluster access system, method and device Download PDF

Info

Publication number
CN108206779B
CN108206779B CN201611169926.9A CN201611169926A CN108206779B CN 108206779 B CN108206779 B CN 108206779B CN 201611169926 A CN201611169926 A CN 201611169926A CN 108206779 B CN108206779 B CN 108206779B
Authority
CN
China
Prior art keywords
master node
target
cluster
request
identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201611169926.9A
Other languages
Chinese (zh)
Other versions
CN108206779A (en
Inventor
申航
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud Network Technology Co Ltd
Beijing Kingsoft Cloud Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Cloud Network Technology Co Ltd, Beijing Kingsoft Cloud Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN201611169926.9A priority Critical patent/CN108206779B/en
Publication of CN108206779A publication Critical patent/CN108206779A/en
Application granted granted Critical
Publication of CN108206779B publication Critical patent/CN108206779B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/46Cluster building
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • H04L45/04Interdomain routing, e.g. hierarchical routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the invention provides a cluster access system, a cluster access method and a cluster access device, wherein in the method, a proxy server firstly receives a target request which is sent by a target client and used for accessing a target cluster; determining a first main node from all main nodes of a target cluster; sending the target request to the first host node; then receiving feedback information fed back by the first main node; judging whether the feedback information is steering information; if yes, analyzing the feedback information to obtain a node identifier as a first identifier; and sending the target request to the main node corresponding to the first identifier, so that the main node corresponding to the first identifier responds to the target request. In the scheme provided by the embodiment of the invention, the client is in communication connection with the cluster through the proxy server, the interaction between the client and the cluster is completed by the proxy server, the access operation required to be executed by the client is simple and not complicated, and the expansion of the cluster has no influence on the client.

Description

一种集群访问系统、方法及装置A cluster access system, method and device

技术领域technical field

本发明涉及计算机技术领域,特别是涉及一种集群访问系统、方法及装置。The present invention relates to the field of computer technology, and in particular, to a cluster access system, method and device.

背景技术Background technique

集群是一组相互独立的、通过高速网络互联的计算机,它们构成了一个组,并以单一系统的模式加以管理。一个客户端与集群相互作用时,集群像是一个独立的服务器,对外提供统一的服务。集群由多个节点构成,节点包括主节点和从节点,对于无中心主节点的集群,集群中的各个主节点的在整个集群中拥有相同的地位,每个主节点都可以负责处理一部分客户端请求。A cluster is a group of independent computers interconnected by a high-speed network that form a group and are managed as a single system. When a client interacts with the cluster, the cluster acts like an independent server, providing unified services to the outside world. The cluster consists of multiple nodes, including the master node and the slave node. For a cluster without a central master node, each master node in the cluster has the same status in the entire cluster, and each master node can be responsible for processing a part of the client. ask.

现有技术中,集群访问系统通常包括:客户端和集群,其中,对于无中心节点的集群,客户端可以与集群中的所有主节点直接通信连接,即客户端可以直接访问集群中的任意一个主节点;例如常见的redis(一种开源的Key-Value(键值)数据库)集群。In the prior art, a cluster access system usually includes: a client and a cluster, wherein, for a cluster without a central node, the client can directly communicate with all master nodes in the cluster, that is, the client can directly access any one of the clusters. Master node; such as common redis (an open source Key-Value (key-value) database) cluster.

通常情况下,客户端可以应用上述方式成功进行集群访问,然而实际应用中,由于实际需求的变化等原因,集群中所包含的主节点可能不能满足实际需求,需要增加主节点以对集群进行扩展。而对集群进行扩展后可能会对客户端访问集群带来影响,一般需要对客户端进行相应的调整以适应集群的扩展,而能够对集群进行访问的客户端通常数量多、分布广,因此客户端的调整影响面广,增加了对集群进行扩展的难度。Usually, the client can successfully access the cluster by using the above method. However, in practical applications, due to changes in actual requirements, the master nodes contained in the cluster may not meet the actual needs, and it is necessary to increase the master node to expand the cluster. . However, after the cluster is expanded, it may affect the client's access to the cluster. Generally, the client needs to be adjusted accordingly to adapt to the expansion of the cluster. The number of clients that can access the cluster is usually large and widely distributed. Therefore, customers The adjustment of the terminal has a wide range of influence, which increases the difficulty of expanding the cluster.

发明内容SUMMARY OF THE INVENTION

本发明实施例的目的在于提供一种集群访问系统、方法及装置,以避免集群扩展时对客户端产生的影响。具体技术方案如下:The purpose of the embodiments of the present invention is to provide a cluster access system, method and device, so as to avoid the impact on the client when the cluster is expanded. The specific technical solutions are as follows:

为达上述目的,第一方面,本发明实施例提供了一种集群访问系统,所述集群访问系统包括:客户端、代理服务器以及集群,所述代理服务器与客户端、集群中的各个主节点通信连接,In order to achieve the above object, in a first aspect, an embodiment of the present invention provides a cluster access system, the cluster access system includes: a client, a proxy server, and a cluster, the proxy server, the client, and each master node in the cluster communication connection,

所述客户端,用于向所述代理服务器发送用于访问目标集群的目标请求;the client, configured to send a target request for accessing the target cluster to the proxy server;

所述代理服务器,用于接收所述客户端发送的所述目标请求;从所述目标集群的各个主节点中确定第一主节点;将所述目标请求发送至所述第一主节点;接收所述第一主节点反馈的反馈信息;判断所述反馈信息是否为转向信息;如果是,从所述反馈信息中解析获得节点标识,作为第一标识;将所述目标请求发送给第二主节点;其中,所述第二主节点为所述第一标识对应的主节点;the proxy server, configured to receive the target request sent by the client; determine a first master node from each master node of the target cluster; send the target request to the first master node; receive The feedback information fed back by the first master node; determine whether the feedback information is steering information; if so, parse and obtain the node identifier from the feedback information as the first identifier; send the target request to the second master node; wherein, the second master node is the master node corresponding to the first identifier;

所述第一主节点,用于接收所述代理服务器发送的所述目标请求,并针对所述目标请求生成反馈信息;将所述反馈信息发送给所述代理服务器;the first master node, configured to receive the target request sent by the proxy server, and generate feedback information for the target request; send the feedback information to the proxy server;

所述第二主节点,用于接收所述代理服务器发送的所述目标请求,并响应所述目标请求。The second master node is configured to receive the target request sent by the proxy server and respond to the target request.

优选的,所述目标请求包含有目标键值,Preferably, the target request includes a target key value,

所述代理服务器,具体用于:The proxy server is specifically used for:

计算所述目标键值对应的目标哈希值;查询路由表中是否存在所述目标哈希值;如果是,确定所述路由表中所述目标哈希值对应的主节点为第一主节点;如果否,从所述目标集群的各个主节点中,随机确定一个主节点为第一主节点,其中,所述路由表中存储有哈希值与主节点的标识的对应关系。Calculate the target hash value corresponding to the target key value; query whether the target hash value exists in the routing table; if so, determine that the primary node corresponding to the target hash value in the routing table is the first primary node ; if not, randomly determine a master node as the first master node from each master node of the target cluster, wherein the routing table stores the corresponding relationship between the hash value and the identifier of the master node.

优选的,所述代理服务器,还用于:Preferably, the proxy server is also used for:

接收第三主节点反馈的对应于所述目标请求的请求成功信息;生成第二标识与所述目标哈希值的对应关系;将生成的对应关系更新到所述路由表中;其中,所述第三主节点为成功执行所述目标请求对应的请求命令的主节点,所述第二标识为所述第三主节点的标识。receiving the request success information corresponding to the target request fed back by the third master node; generating a corresponding relationship between the second identifier and the target hash value; updating the generated corresponding relationship into the routing table; wherein, the The third master node is the master node that successfully executes the request command corresponding to the target request, and the second identifier is the identifier of the third master node.

优选的,所述代理服务器,还用于:Preferably, the proxy server is also used for:

在所述接收客户端发送的所述目标请求之后,判断所述目标请求是否安全;After receiving the target request sent by the client, determine whether the target request is safe;

若为是,执行所述从所述目标集群的各个主节点中确定第一主节点的步骤。If yes, execute the step of determining the first master node from each master node of the target cluster.

优选的,所述代理服务器,具体用于:Preferably, the proxy server is specifically used for:

确定所述转向信息的类型;若所述转向信息为MOVED信息,直接将所述目标请求发送给第二主节点;若所述转向信息为ASK信息,向第二主节点发送ASKING命令,再将所述目标请求发送给所述第二主节点。Determine the type of the steering information; if the steering information is MOVED information, directly send the target request to the second master node; if the steering information is ASK information, send an ASKING command to the second master node, and then send the ASKING command to the second master node. The target request is sent to the second master node.

第二方面,本发明实施例提供了一种集群访问方法,应用于代理服务器,所述方法包括:In a second aspect, an embodiment of the present invention provides a cluster access method, which is applied to a proxy server, and the method includes:

接收目标客户端发送的用于访问目标集群的目标请求;Receive the target request sent by the target client to access the target cluster;

从所述目标集群的各个主节点中确定第一主节点;determining a first master node from each master node of the target cluster;

将所述目标请求发送至所述第一主节点;sending the target request to the first master node;

接收所述第一主节点反馈的反馈信息;receiving feedback information fed back by the first master node;

判断所述反馈信息是否为转向信息;Determine whether the feedback information is steering information;

如果是,从所述反馈信息中解析获得节点标识,作为第一标识;将所述目标请求发送给第二主节点,以使得所述第二主节点响应所述目标请求;其中,所述第二主节点为所述第一标识对应的主节点。If yes, parse and obtain the node identifier from the feedback information as the first identifier; send the target request to the second master node, so that the second master node responds to the target request; wherein the first The second master node is the master node corresponding to the first identifier.

优选的,所述目标请求包含有目标键值,Preferably, the target request includes a target key value,

所述从所述目标集群的各个主节点中确定第一主节点的步骤,包括:The step of determining the first master node from each master node of the target cluster includes:

计算所述目标键值对应的目标哈希值,Calculate the target hash value corresponding to the target key value,

查询路由表中是否存在所述目标哈希值,其中,所述路由表中存储有哈希值与主节点的标识的对应关系;query whether the target hash value exists in the routing table, wherein the routing table stores the corresponding relationship between the hash value and the identity of the master node;

如果是,确定所述路由表中所述目标哈希值对应的主节点为第一主节点;If yes, determine that the master node corresponding to the target hash value in the routing table is the first master node;

如果否,从所述目标集群的各个主节点中,随机确定一个主节点为第一主节点。If not, randomly determine one master node as the first master node from among the master nodes of the target cluster.

优选的,所述方法还包括:Preferably, the method further includes:

接收第三主节点反馈的对应于所述目标请求的请求成功信息;其中,所述第三主节点为成功执行所述目标请求对应的请求命令的主节点;Receive the request success information corresponding to the target request fed back by the third master node; wherein, the third master node is the master node that successfully executes the request command corresponding to the target request;

生成第二标识与所述目标哈希值的对应关系,其中,所述第二标识为所述第三主节点的标识;generating a correspondence between a second identifier and the target hash value, wherein the second identifier is the identifier of the third master node;

将生成的对应关系更新到所述路由表中。The generated corresponding relationship is updated into the routing table.

优选的,在所述接收目标客户端发送的用于访问目标集群的目标请求的步骤之后,所述方法还包括:Preferably, after the step of receiving the target request sent by the target client for accessing the target cluster, the method further includes:

判断所述目标请求是否安全;Determine whether the target request is safe;

若为是,执行所述从所述目标集群的各个主节点中确定第一主节点的步骤。If yes, execute the step of determining the first master node from each master node of the target cluster.

优选的,所述将所述目标请求发送给第二主节点的步骤,包括:Preferably, the step of sending the target request to the second master node includes:

确定所述转向信息的类型;determining the type of steering information;

若所述转向信息为MOVED信息,直接将所述目标请求发送给第二主节点;If the steering information is MOVED information, directly send the target request to the second master node;

若所述转向信息为ASK信息,向第二主节点发送ASKING命令,再将所述目标请求发送给所述第二主节点。If the steering information is ASK information, send an ASKING command to the second master node, and then send the target request to the second master node.

第三方面,本发明实施例提供了一种集群访问装置,应用于代理服务器,所述装置包括:In a third aspect, an embodiment of the present invention provides a cluster access device, which is applied to a proxy server, and the device includes:

第一接收模块,用于接收目标客户端发送的用于访问目标集群的目标请求;a first receiving module, configured to receive a target request sent by the target client for accessing the target cluster;

确定模块,用于从所述目标集群的各个主节点中确定第一主节点;a determining module, configured to determine the first master node from each master node of the target cluster;

第一发送模块,用于将所述目标请求发送至所述第一主节点;a first sending module, configured to send the target request to the first master node;

第二接收模块,用于接收所述第一主节点反馈的反馈信息;a second receiving module, configured to receive feedback information fed back by the first master node;

第一判断模块,用于判断所述反馈信息是否为转向信息;a first judging module for judging whether the feedback information is steering information;

第二发送模块,用于在所述第一判断模块的判断结果为是的情况下,从所述反馈信息中解析获得节点标识,作为第一标识;将所述目标请求发送给第二主节点,以使得所述第二主节点响应所述目标请求;其中,所述第二主节点为所述第一标识对应的主节点。A second sending module, configured to parse and obtain a node identifier from the feedback information when the determination result of the first determination module is yes, as the first identifier; and send the target request to the second master node , so that the second master node responds to the target request; wherein, the second master node is the master node corresponding to the first identifier.

优选的,所述目标请求包含有目标键值,Preferably, the target request includes a target key value,

所述确定模块,包括:The determining module includes:

计算子模块,用于计算所述目标键值对应的目标哈希值,a calculation sub-module for calculating the target hash value corresponding to the target key value,

查询子模块,用于查询路由表中是否存在所述目标哈希值,其中,所述路由表中存储有哈希值与主节点的标识的对应关系;a query sub-module for querying whether the target hash value exists in the routing table, wherein the routing table stores the corresponding relationship between the hash value and the identity of the master node;

第一确定子模块,用于在所述路由表中存在所述目标哈希值的情况下,确定所述路由表中所述目标哈希值对应的主节点为第一主节点;a first determination submodule, configured to determine the master node corresponding to the target hash value in the routing table as the first master node when the target hash value exists in the routing table;

第二确定子模块,用于在所述路由表中不存在所述目标哈希值的情况下,从所述目标集群的各个主节点中,随机确定一个主节点为第一主节点。The second determination submodule is configured to randomly determine a master node as the first master node from each master node of the target cluster when the target hash value does not exist in the routing table.

优选的,所述装置还包括:Preferably, the device further includes:

第三接收模块,用于接收第三主节点反馈的对应于所述目标请求的请求成功信息;其中,所述第三主节点为成功执行所述目标请求对应的请求命令的主节点;a third receiving module, configured to receive the request success information corresponding to the target request fed back by a third master node; wherein, the third master node is a master node that successfully executes the request command corresponding to the target request;

生成模块,用于生成第二标识与所述目标哈希值的对应关系,其中,所述第二标识为所述第三主节点的标识;a generating module, configured to generate a correspondence between a second identifier and the target hash value, wherein the second identifier is the identifier of the third master node;

更新模块,用于将生成的对应关系更新到所述路由表中。An update module, configured to update the generated corresponding relationship into the routing table.

优选的,所述装置还包括:Preferably, the device further includes:

第二判断模块,用于在所述接收目标客户端发送的用于访问目标集群的目标请求之后,判断所述目标请求是否安全;若为是,触发所述确定模块。The second judging module is configured to judge whether the target request is safe after receiving the target request sent by the target client for accessing the target cluster; if so, trigger the determining module.

优选的,所述第二发送模块,具体用于:Preferably, the second sending module is specifically used for:

在所述第一判断模块的判断结果为是的情况下,从所述反馈信息中解析获得节点标识,作为第一标识;确定所述转向信息的类型;若所述转向信息为MOVED信息,直接将所述目标请求发送给第二主节点;若所述转向信息为ASK信息,向第二主节点发送ASKING命令,再将所述目标请求发送给所述第二主节点。In the case that the judgment result of the first judgment module is yes, analyze and obtain the node identification from the feedback information as the first identification; determine the type of the steering information; if the steering information is MOVED information, directly Send the target request to the second master node; if the steering information is ASK information, send an ASKING command to the second master node, and then send the target request to the second master node.

由以上可见,本发明实施例提供的一种集群访问系统、方法及装置,代理服务器首先接收目标客户端发送的用于访问目标集群的目标请求;从目标集群的各个主节点中确定第一主节点;将该目标请求发送至该第一主节点;然后接收该第一主节点反馈的反馈信息;判断该反馈信息是否为转向信息;如果是,从该反馈信息中解析获得节点标识,作为第一标识;将该目标请求发送给该第一标识对应的主节点,以使得该第一标识对应的主节点响应该目标请求。与现有技术相比,本发明实施例提供的方案中,客户端通过代理服务器与集群通信连接,客户端需要访问集群时,只需将请求发送给代理服务器即可,由代理服务器完成与集群的交互,客户端所需要执行的访问操作简单不繁琐,而且集群的扩展对客户端完全没有影响。It can be seen from the above that in the cluster access system, method and device provided by the embodiments of the present invention, the proxy server first receives the target request sent by the target client for accessing the target cluster; node; send the target request to the first master node; then receive the feedback information fed back by the first master node; determine whether the feedback information is steering information; if so, parse and obtain the node identifier from the feedback information, as the first an identifier; sending the target request to the master node corresponding to the first identifier, so that the master node corresponding to the first identifier responds to the target request. Compared with the prior art, in the solution provided by the embodiment of the present invention, the client terminal communicates with the cluster through the proxy server. When the client needs to access the cluster, it only needs to send the request to the proxy server, and the proxy server completes the communication with the cluster. The interaction that the client needs to perform is simple and not cumbersome, and the expansion of the cluster has no impact on the client at all.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained according to these drawings without creative efforts.

图1为现有技术中的集群访问系统的结构示意图;1 is a schematic structural diagram of a cluster access system in the prior art;

图2为本发明实施例提供的一种集群访问系统的结构示意图;2 is a schematic structural diagram of a cluster access system according to an embodiment of the present invention;

图3为本发明实施例中所述转向信息为MOVED信息时,客户端访问集群的流程示意图;3 is a schematic flowchart of a client accessing a cluster when the steering information described in the embodiment of the present invention is MOVED information;

图4为本发明实施例中所述转向信息为ASK信息时,客户端访问集群的流程示意图;4 is a schematic flowchart of a client accessing a cluster when the steering information in the embodiment of the present invention is ASK information;

图5为本发明实施例提供的一种集群访问方法的第一种流程示意图;FIG. 5 is a first schematic flowchart of a cluster access method provided by an embodiment of the present invention;

图6为本发明实施例提供的一种集群访问方法的第二种流程示意图;FIG. 6 is a second schematic flowchart of a cluster access method provided by an embodiment of the present invention;

图7为本发明实施例提供的一种集群访问方法的第三种流程示意图;FIG. 7 is a third schematic flowchart of a cluster access method provided by an embodiment of the present invention;

图8为本发明实施例提供的一种集群访问方法的第四种流程示意图;FIG. 8 is a fourth schematic flowchart of a cluster access method provided by an embodiment of the present invention;

图9为本发明实施例提供的一种集群访问装置的第一种结构示意图;FIG. 9 is a first structural schematic diagram of a cluster access device according to an embodiment of the present invention;

图10为本发明实施例提供的一种集群访问装置的第二种结构示意图;FIG. 10 is a schematic diagram of a second structure of a cluster access device according to an embodiment of the present invention;

图11为本发明实施例提供的一种集群访问装置的第三种结构示意图;FIG. 11 is a third schematic structural diagram of a cluster access device according to an embodiment of the present invention;

图12为本发明实施例提供的一种集群访问装置的第四种结构示意图。FIG. 12 is a schematic diagram of a fourth structure of a cluster access apparatus according to an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

下面首先对本发明实施例涉及的技术术语进行简单介绍。The following briefly introduces the technical terms involved in the embodiments of the present invention.

集群:如前所述,集群是一组相互独立的、通过高速网络互联的计算机,它们构成了一个组,并以单一系统的模式加以管理。集群由多个节点构成,节点包括主节点和从节点。对于无中心主节点的集群,集群中的各个主节点的在整个集群中拥有相同的地位,每个主节点都可以负责处理一部分客户端请求。Cluster: As mentioned earlier, a cluster is a group of independent computers interconnected by a high-speed network that form a group and are managed as a single system. A cluster consists of multiple nodes, including a master node and a slave node. For a cluster without a central master node, each master node in the cluster has the same status in the entire cluster, and each master node can be responsible for processing a part of client requests.

以redis集群为例,客户端访问集群的请求命令中一定包含有一个键(key)值,可以通过哈希算法获得该键值对应的哈希值,另外,redis集群的键空间被分割为16384个哈希槽(slot),此处的16384个哈希槽分别对应哈希值0~16383,集群中主节点对应的请求,即表示:请求对应的哈希值为为主节点所对应的哈希值范围内。Taking the redis cluster as an example, the client's request command to access the cluster must contain a key value, and the hash value corresponding to the key value can be obtained through the hash algorithm. In addition, the key space of the redis cluster is divided into 16384 The 16384 hash slots here correspond to the hash values of 0 to 16383 respectively. The request corresponding to the master node in the cluster means that the hash value corresponding to the request is the hash value corresponding to the master node. within the value range.

应该说明的是,上述无中心主节点的集群为了保证数据的高可用性,在集群中可以配置有主从模式,即:上述一个主节点对应至少一个从节点,主节点向集群的客户端提供数据存取服务,从节点则是从主节点拉取数据备份,当该主节点宕机后,就会从该主节点对应的从节点中选举一个从节点来作为新的主节点,从而保证集群不会挂掉,即保证此情况下整个集群仍然可以正常工作。It should be noted that, in order to ensure the high availability of data in the above-mentioned cluster without a central master node, a master-slave mode can be configured in the cluster, that is, one of the above-mentioned master nodes corresponds to at least one slave node, and the master node provides data to the clients of the cluster To access services, the slave node pulls data backup from the master node. When the master node goes down, it will elect a slave node from the slave nodes corresponding to the master node as the new master node, so as to ensure that the cluster does not work. It will hang, that is, to ensure that the entire cluster can still work normally in this case.

应该强调的是,本发明实施例中的集群中,主节点的数量不限,可以是一个,亦可以是两个或两个以上。It should be emphasized that, in the cluster in this embodiment of the present invention, the number of master nodes is not limited, and may be one, or two or more.

下面从与现有技术对比的角度对本发明进行简单介绍。The present invention will be briefly introduced below from the perspective of comparison with the prior art.

图1为现有技术中的集群访问系统的结构示意图。FIG. 1 is a schematic structural diagram of a cluster access system in the prior art.

如图1所示,客户端直接与集群中的各个主节点通信连接,即客户端可以直接访问集群中的任意一个主节点,该集群包括主节点1、主节点2、…、主节点N。客户端向集群发送请求时,首先会确定该请求对应的主节点,然后再向该主节点发送该请求。As shown in Figure 1, the client directly communicates with each master node in the cluster, that is, the client can directly access any master node in the cluster, and the cluster includes master node 1, master node 2, ..., master node N. When a client sends a request to the cluster, it first determines the master node corresponding to the request, and then sends the request to the master node.

例如,对于redis集群,每个客户端中可以配置有一个路由表,路由表中记录有每个哈希值与主节点的标识的对应关系,现集群包括主节点a、b和c,客户端的路由表中记录:哈希值0~5000对应主节点a的标识,哈希值5001~10000对应主节点b的标识,哈希值10001~16383对应的主节点c的标识,应该说明,路由表中记录的哈希值与主节点的标识的对应关系,实际体现的是上述哈希槽与主节点的对应关系。For example, for a redis cluster, each client can be configured with a routing table. The routing table records the correspondence between each hash value and the identity of the master node. The current cluster includes master nodes a, b, and c. Records in the routing table: Hash values of 0 to 5000 correspond to the identification of master node a, hash values of 5001 to 10000 correspond to the identification of master node b, and hash values of 10001 to 16383 correspond to the identification of master node c. It should be noted that the routing table The corresponding relationship between the hash value recorded in and the identification of the master node actually reflects the corresponding relationship between the above-mentioned hash slot and the master node.

当客户端需要发送某一请求时,首先会通过哈希算法计算该请求中携带的键(key)值所对应的哈希值,然后从上述路由表中找出该哈希值所对应的主节点,然后将该请求发送给该主节点。When the client needs to send a request, it first calculates the hash value corresponding to the key value carried in the request through the hash algorithm, and then finds the host corresponding to the hash value from the above routing table. node and then send the request to the master node.

然而,如果在集群中增加了主节点,存在一部分主节点所对应的哈希值发生变化,则此时可以调整客户端的路由表中哈希值与主节点的标识的对应关系。由于能够对集群进行访问的客户端通常数量多、分布广,因此客户端的调整影响面广,增加了对集群进行扩展的难度。However, if a master node is added to the cluster, and the hash values corresponding to some master nodes change, the corresponding relationship between the hash value and the identifier of the master node in the routing table of the client can be adjusted at this time. Because the number of clients that can access the cluster is usually large and widely distributed, the adjustment of the client has a wide range of influence, which increases the difficulty of expanding the cluster.

如上例,集群包括主节点a、b和c,哈希值0~5000对应主节点a的标识,哈希值5001~10000对应主节点b的标识,哈希值10001~16383对应的主节点c的标识,现在集群中加入一个新的主节点d,加入主节点d后,哈希值0~14000所分别对应的主节点的标识不变,而哈希值14001~16383对应的主节点的标识变为主节点d的标识。为此,任意一个客户端若要更新本地路由表中的对应关系,需要重启客户端以完成更新路由表的操作。As shown in the above example, the cluster includes master nodes a, b and c. The hash values of 0 to 5000 correspond to the ID of master node a, the hash values of 5001 to 10000 correspond to the ID of master node b, and the hash values of 10001 to 16383 correspond to master node c. Now a new master node d is added to the cluster. After adding master node d, the identifiers of the master nodes corresponding to the hash values 0 to 14000 remain unchanged, while the identifiers of the master nodes corresponding to the hash values 14001 to 16383 remain unchanged. Becomes the identity of the primary node d. For this reason, if any client wants to update the corresponding relationship in the local routing table, it needs to restart the client to complete the operation of updating the routing table.

此处存在一个特例,在现行的redis 3.0版本之前,redis集群中主节点的数量一个,即redis为单数据节点,客户端仅需要通信连接唯一的主节点即可。为了突破单数据节点的容量限制以及性能限制,redis 3.0版本之后的redis对集群进行横向扩容,即增加了集群中主节点的数目,为此,客户端的访问方式可以变为:根据各主节点反馈的路由信息,来选择请求对应的主节点。在实际使用中,即表现为需要更改每个客户端的访问逻辑,即更改客户端的代码。There is a special case here. Before the current redis 3.0 version, the number of master nodes in the redis cluster is one, that is, redis is a single data node, and the client only needs to communicate with the only master node. In order to break through the capacity and performance limitations of a single data node, redis after redis 3.0 expands the cluster horizontally, that is, increases the number of master nodes in the cluster. For this reason, the client's access method can be changed to: according to the feedback of each master node routing information to select the master node corresponding to the request. In actual use, it means that the access logic of each client needs to be changed, that is, the code of the client needs to be changed.

本发明实施例提供的方案中,在集群访问系统中配置了代理服务器,如图2所示,目标集群包含第一主节点、第二主节点、主节点1、主节点2、…、主节点M,客户端通过代理服务器与目标集群中的各个主节点通信连接,代理服务器转发客户端的请求的路由逻辑包括:In the solution provided by the embodiment of the present invention, a proxy server is configured in the cluster access system. As shown in FIG. 2 , the target cluster includes a first master node, a second master node, a master node 1, a master node 2, ..., a master node M, the client communicates with each master node in the target cluster through the proxy server, and the routing logic of the proxy server forwarding the client's request includes:

代理服务器首先接收目标客户端发送的用于访问目标集群的目标请求;从目标集群的各个主节点中确定第一主节点;将该目标请求发送至该第一主节点;然后接收该第一主节点反馈的反馈信息;判断该反馈信息是否为转向信息;如果是,从该反馈信息中解析获得节点标识,作为第一标识;将该目标请求发送给该第一标识对应的主节点,以使得该第一标识对应的主节点响应该目标请求。The proxy server first receives the target request sent by the target client for accessing the target cluster; determines the first master node from each master node of the target cluster; sends the target request to the first master node; and then receives the first master node The feedback information fed back by the node; determine whether the feedback information is steering information; if so, parse and obtain the node identification from the feedback information as the first identification; send the target request to the master node corresponding to the first identification, so that The master node corresponding to the first identifier responds to the target request.

可以理解,本发明实施例中,客户端直接将目标请求发送给代理服务器,集群中增加主节点时,仅会对代理服务器的请求转发逻辑产生影响,对客户端并无影响。It can be understood that, in this embodiment of the present invention, the client directly sends the target request to the proxy server, and when a master node is added to the cluster, it only affects the request forwarding logic of the proxy server, and has no effect on the client.

以上述特例为例,在现行的redis 3.0版本之前,redis为单数据节点,客户端仅需要与代理服务器通信连接,代理服务器再与唯一的主节点通信连接即可。增加集群中主节点的数目前,客户端的访问逻辑是将请求发送给代理服务器,增加集群中主节点的数目后,客户端的访问逻辑依然是将请求发送给代理服务器,由代理服务器向目标集群转发该请求,所以客户端不需要做任何修改就可以实现集群由单数据节点至多数据节点的平滑迁移。Taking the above special case as an example, before the current redis 3.0 version, redis is a single data node, the client only needs to communicate with the proxy server, and the proxy server can communicate with the only master node. Increasing the number of master nodes in the cluster At present, the client's access logic is to send the request to the proxy server. After increasing the number of master nodes in the cluster, the client's access logic is still to send the request to the proxy server, and the proxy server forwards the request to the target cluster This request, so the client does not need to make any modifications to realize the smooth migration of the cluster from a single data node to multiple data nodes.

由以上可见,与现有技术相比,本发明实施例提供的方案中,客户端通过代理服务器与集群通信连接,客户端需要访问集群时,只需将请求发送给代理服务器即可,由代理服务器完成与集群的交互,客户端所需要执行的访问操作简单不繁琐,而且集群的扩展对客户端完全没有影响。It can be seen from the above that, compared with the prior art, in the solution provided by the embodiment of the present invention, the client is connected to the cluster through the proxy server. When the client needs to access the cluster, it only needs to send the request to the proxy server, and the proxy The server completes the interaction with the cluster, the access operations that the client needs to perform are simple and not cumbersome, and the expansion of the cluster has no impact on the client at all.

下面通过具体实施例来对本发明实施例进行详细介绍。The embodiments of the present invention will be described in detail below through specific embodiments.

如图2所示,本发明实施例提供了一种集群访问系统,该集群访问系统包括:客户端、代理服务器以及集群,所述代理服务器与客户端、集群中的各个主节点通信连接。本发明实施例中所述的集群即为上述无中心主节点的集群,如redis集群。As shown in FIG. 2 , an embodiment of the present invention provides a cluster access system. The cluster access system includes: a client, a proxy server, and a cluster. The proxy server is connected to the client and each master node in the cluster in communication. The cluster described in the embodiment of the present invention is the above-mentioned cluster without a central master node, such as a redis cluster.

所述客户端,用于向所述代理服务器发送用于访问目标集群的目标请求。The client is configured to send a target request for accessing the target cluster to the proxy server.

与现有技术不同的是,本发明实施例中,客户端发送的目标请求指向代理服务器,而不是直接发送给目标集群中的主节点。另外,应该说明的是,在实际的应用中,集群对应的客户端的数量是不限的,可以是成千上万的,本发明实施例中,为了清楚起见,以一个客户端访问集群的方式来说明整个集群访问系统。Different from the prior art, in this embodiment of the present invention, the target request sent by the client is directed to the proxy server, rather than directly sent to the master node in the target cluster. In addition, it should be noted that in an actual application, the number of clients corresponding to a cluster is not limited, and may be in the thousands. In this embodiment of the present invention, for the sake of clarity, one client accesses the cluster in a manner to illustrate the entire cluster access system.

所述代理服务器,用于接收所述客户端发送的所述目标请求;从所述目标集群的各个主节点中确定第一主节点;将所述目标请求发送至所述第一主节点;接收所述第一主节点反馈的反馈信息;判断所述反馈信息是否为转向信息;如果是,从所述反馈信息中解析获得节点标识,作为第一标识;将所述目标请求发送给第二主节点;其中,所述第二主节点为所述第一标识对应的主节点。the proxy server, configured to receive the target request sent by the client; determine a first master node from each master node of the target cluster; send the target request to the first master node; receive The feedback information fed back by the first master node; determine whether the feedback information is steering information; if so, parse and obtain the node identifier from the feedback information as the first identifier; send the target request to the second master node; wherein, the second master node is the master node corresponding to the first identifier.

所述第一主节点,用于接收所述代理服务器发送的所述目标请求,并针对所述目标请求生成反馈信息;将所述反馈信息发送给所述代理服务器。The first master node is configured to receive the target request sent by the proxy server, generate feedback information for the target request, and send the feedback information to the proxy server.

所述第二主节点,用于接收所述代理服务器发送的所述目标请求,并响应所述目标请求。The second master node is configured to receive the target request sent by the proxy server and respond to the target request.

应该说明的是,代理服务器可以从该目标集群的各个主节点中随机确定一个主节点,作为第一主节点,例如,当前的目标集群中包含有主节点a、b、c、d和e,代理服务器在接收到目标请求后,随机确定主节点a为第一主节点。It should be noted that the proxy server may randomly determine a master node from each master node of the target cluster as the first master node. For example, the current target cluster includes master nodes a, b, c, d and e. After receiving the target request, the proxy server randomly determines the master node a as the first master node.

可以理解的是,如果第一主节点当前恰好为负责处理该目标请求的主节点,则第一主节点向代理服务器反馈的反馈信息应该为请求成功信息,则整个集群访问过程结束。所以,在实际的应用过程中,应尽可能保证代理服务器确定的第一主节点即为负责处理该目标请求的正确主节点。It can be understood that if the first master node is currently the master node responsible for processing the target request, the feedback information returned by the first master node to the proxy server should be the request success information, and the entire cluster access process ends. Therefore, in the actual application process, it should be ensured as far as possible that the first master node determined by the proxy server is the correct master node responsible for processing the target request.

但是,代理服务器随机确定第一主节点时,随机确定的主节点为该目标请求对应的正确主节点的概率极低,例如,目标集群包含有20个主节点,则随机确定的主节点为该目标请求对应的主节点的概率仅为5%。However, when the proxy server randomly determines the first master node, the probability that the randomly determined master node is the correct master node corresponding to the target request is extremely low. For example, if the target cluster contains 20 master nodes, then the randomly determined master node is the correct master node. The probability of the target request corresponding to the master node is only 5%.

所以,具体的,为了尽可能快地找到该目标请求所对应的主节点,本发明实施例中,还可以在代理服务器中配置路由表,该路由表中记录有哈希值与主节点的标识的对应关系。应该说明的是,此情况下,所述目标请求包含有目标键值,所述代理服务器,可以具体用于:Therefore, specifically, in order to find the master node corresponding to the target request as quickly as possible, in this embodiment of the present invention, a routing table may also be configured in the proxy server, and the routing table records the hash value and the identifier of the master node corresponding relationship. It should be noted that, in this case, the target request contains a target key value, and the proxy server can be specifically used for:

计算所述目标键值对应的目标哈希值;查询路由表中是否存在所述目标哈希值;如果是,确定所述路由表中所述目标哈希值对应的主节点为第一主节点;如果否,从所述目标集群的各个主节点中,随机确定一个主节点为第一主节点,其中,所述路由表中存储有哈希值与主节点的标识的对应关系。Calculate the target hash value corresponding to the target key value; query whether the target hash value exists in the routing table; if so, determine that the primary node corresponding to the target hash value in the routing table is the first primary node ; if not, randomly determine a master node as the first master node from each master node of the target cluster, wherein the routing table stores the corresponding relationship between the hash value and the identifier of the master node.

应该说明,客户端发送的目标请求中都会包含有键(key)值。另外,本领域技术人员公知的是,哈希值的计算公式可以是:It should be noted that the target request sent by the client will contain a key value. In addition, it is well known to those skilled in the art that the calculation formula of the hash value can be:

HASH_SLOT=CRC16(key)mod 16384;HASH_SLOT=CRC16(key)mod 16384;

式中,HASH_SLOT表示哈希值,CRC16()表示现有的CRC16算法,具体的算法过程本发明实施例不做详细介绍,key表示该目标键值,mod表示取模运算。可以理解,计算所得到的哈希值必然为0~16383中的任意一个整数,哈希值0~16383分别对应哈希槽1~16384。In the formula, HASH_SLOT represents the hash value, CRC16() represents the existing CRC16 algorithm, and the specific algorithm process is not described in detail in this embodiment of the present invention, key represents the target key value, and mod represents the modulo operation. It can be understood that the calculated hash value must be any integer from 0 to 16383, and the hash value of 0 to 16383 corresponds to the hash slot 1 to 16384 respectively.

例如,目标集群包括有主节点a、b、c、d、e和f,路由表中记录:For example, the target cluster includes master nodes a, b, c, d, e, and f, and the routing table records:

哈希值0~2730对应主节点a的标识,哈希值2731~5460对应主节点b的标识,哈希值5461~8190对应主节点c的标识,哈希值8191~10920对应主节点d的标识,哈希值10921~13650对应主节点e的标识,哈希值13700~16383对应主节点f的标识。Hash values of 0 to 2730 correspond to the identification of master node a, hash values of 2731 to 5460 correspond to the identification of master node b, hash values of 5461 to 8190 correspond to the identification of master node c, and hash values of 8191 to 10920 correspond to the identification of master node d. ID, the hash values 10921-13650 correspond to the ID of the master node e, and the hash values 13700-16383 correspond to the ID of the master node f.

假设代理服务器从当前接收到的目标请求中,解析出目标键值X,然后通过上述公式计算目标键值X对应的哈希值,即:Assume that the proxy server parses the target key X from the currently received target request, and then calculates the hash value corresponding to the target key X through the above formula, namely:

CRC16(X)mod 16384=5113mod 16384=5113;CRC16(X)mod 16384=5113mod 16384=5113;

由于该路由表中记录:哈希值5113对应的主节点的标识指向主节点b,所以此时确定主节点b为第一主节点。Since it is recorded in the routing table that the identifier of the master node corresponding to the hash value 5113 points to master node b, master node b is determined to be the first master node at this time.

假设代理服务器从当前接收到的目标请求中,解析出目标键值Y,然后通过上述公式计算目标键值Y对应的哈希值,即:Suppose the proxy server parses the target key Y from the target request currently received, and then calculates the hash value corresponding to the target key Y through the above formula, namely:

CRC16(Y)mod 16384=30066mod 16384=13682;CRC16(Y)mod 16384=30066mod 16384=13682;

由于该路由表中未记录哈希值13682所对应的主节点的标识,所以此时代理服务器可以从主节点a、b、c、d、e和f中随机确定一个主节点,作为第一主节点,如随机确定主节点c为第一主节点。Since the identification of the master node corresponding to the hash value 13682 is not recorded in the routing table, the proxy server can randomly determine a master node from master nodes a, b, c, d, e and f as the first master node. For example, the master node c is randomly determined as the first master node.

当然,在本发明实施例中,代理服务器还可以通过其它技术手段加速找到该目标请求所对应的正确主节点,并不限于通过在代理服务器中配置的路由表,加速找到该目标请求所对应的正确主节点。Of course, in this embodiment of the present invention, the proxy server can also speed up finding the correct master node corresponding to the target request through other technical means, and is not limited to speeding up finding the correct master node corresponding to the target request by using the routing table configured in the proxy server Correct primary node.

当上述确定的第一主节点并不是负责处理该目标请求的主节点时,该第一主节点会向代理服务器发送转向信息,又称之为转向错误信息,转向信息中会包含有该目标请求对应的哈希值,以及负责处理该哈希值的主节点的标识,例如,主节点所使用的IP(Internet Protocol,网络之间互连的协议)地址和TCP(Transmission ControlProtocol,传输控制协议)端口号。When the first master node determined above is not the master node responsible for processing the target request, the first master node will send redirection information to the proxy server, also known as redirection error information, and the redirection information will contain the target request The corresponding hash value, and the identity of the master node responsible for processing the hash value, for example, the IP (Internet Protocol) address and TCP (Transmission Control Protocol) used by the master node. The port number.

本领域技术人员公知的是,集群中的各个主节点共享各个主节点的关联信息,该关联信息包括:各个主节点所使用的IP地址和TCP端口号,各个主节点所分别负责处理的哈希槽。所以当某一主节点x并非为负责处理该目标请求的主节点时,该主节点x在接收到目标请求后,会首先计算该目标请求中携带的目标键值对应的哈希值,然后根据上述关联信息确定负责处理该哈希值的主节点;最后,该主节点x会向代理服务器返回转向信息,该转向信息包含有负责处理该哈希值的主节点的标识以及计算获得的哈希值。It is well known to those skilled in the art that each master node in a cluster shares the associated information of each master node, and the associated information includes: the IP address and TCP port number used by each master node, and the hash value processed by each master node. groove. Therefore, when a master node x is not the master node responsible for processing the target request, after the master node x receives the target request, it will first calculate the hash value corresponding to the target key value carried in the target request, and then according to The above association information determines the master node responsible for processing the hash value; finally, the master node x will return the redirection information to the proxy server, and the redirection information includes the identification of the master node responsible for processing the hash value and the calculated hash value. value.

所以在本发明实施例中,第一主节点发送的转向信息中,该转向信息中包含的标识所对应的主节点即为第二主节点。Therefore, in the embodiment of the present invention, in the steering information sent by the first master node, the master node corresponding to the identifier included in the steering information is the second master node.

例如,第一主节点反馈的转向信息包括:标识127.0.0.1:8001,该标识对应的节点为主节点x,则代理服务器将该主节点x确定为第二主节点,然后代理服务器将目标请求发送给主节点x。For example, the redirection information fed back by the first master node includes: the identifier 127.0.0.1:8001, the node corresponding to the identifier is the master node x, the proxy server determines the master node x as the second master node, and then the proxy server sends the target request Sent to master node x.

应该强调的是,集群中各个主节点所分别负责处理的哈希槽可能会发生变化,例如,当集群中的主节点增加时,16384个哈希槽中有一部分哈希槽会重新分配,所以上述路由表中的对应关系需要及时更新,故,本发明实施例中,所述代理服务器还可以用于:It should be emphasized that the hash slots handled by each master node in the cluster may change. For example, when the number of master nodes in the cluster increases, some of the 16384 hash slots will be reassigned, so The corresponding relationship in the above routing table needs to be updated in time. Therefore, in this embodiment of the present invention, the proxy server may also be used for:

接收第三主节点反馈的对应于所述目标请求的请求成功信息;生成第二标识与所述目标哈希值的对应关系;将生成的对应关系更新到所述路由表中;其中,所述第三主节点为成功执行所述目标请求对应的请求命令的主节点,所述第二标识为所述第三主节点的标识。receiving the request success information corresponding to the target request fed back by the third master node; generating a corresponding relationship between the second identifier and the target hash value; updating the generated corresponding relationship into the routing table; wherein, the The third master node is the master node that successfully executes the request command corresponding to the target request, and the second identifier is the identifier of the third master node.

可以理解的是,该第三主节点可以是上述第一主节点,也可以是上述第二主节点,只要是接收到目标请求后,针对该目标请求反馈请求成功信息的主节点即可以确定为第三主节点。It can be understood that the third master node may be the above-mentioned first master node or the above-mentioned second master node. As long as it receives the target request, the master node that feeds back the request success information for the target request can be determined as: The third master node.

当代理服务器接收到请求成功信息时,代理服务器就会生成反馈该请求成功信息的主节点的标识,即上述第二标识,与目标哈希值的对应关系。显然的,如果路由表中已经存在生成的对应关系,则不需要替换该对应关系;但是,当路由表中不存在该生成的对应关系时,如果该路由表中记录有该目标哈希值,则替换路由表中目标哈希值对应的标识为该第二标识,如果该路由表中未记录有该目标哈希值,则在路由表中增加一个目标哈希值与该第二标识的对应关系。When the proxy server receives the request success information, the proxy server will generate the corresponding relationship between the identifier of the master node that feeds back the request success information, that is, the above-mentioned second identifier, and the target hash value. Obviously, if the generated corresponding relationship already exists in the routing table, the corresponding relationship does not need to be replaced; however, when the generated corresponding relationship does not exist in the routing table, if the target hash value is recorded in the routing table, Then the identifier corresponding to the target hash value in the replacement routing table is the second identifier. If the target hash value is not recorded in the routing table, a target hash value corresponding to the second identifier is added to the routing table. relation.

在此情况下,代理服务器中的路由表的更新可以看作是一个自学习的过程,代理服务器根据实际应用过程中的成功访问信息来自动更新路由表。In this case, the updating of the routing table in the proxy server can be regarded as a self-learning process, and the proxy server automatically updates the routing table according to the successful access information in the actual application process.

例如,第三主节点的标识为127.0.0.1:8002,目标哈希值为1500,则生成哈希值1500与标识127.0.0.1:8002的对应关系。如果路由表中记录有哈希值1500与标识127.0.0.1:8002的对应关系,则代理服务器对路由表不做任何操作;但是如果该路由表中记录该哈希值1500对应的标识不是标识127.0.0.1:8002,则替换该路由表中该哈希值1500对应的标识为标识127.0.0.1:8002;如果该路由表中为记录有关于哈希值1500的对应关系,则在该路由表中增加:哈希值1500与标识127.0.0.1:8002的对应关系。For example, if the identifier of the third master node is 127.0.0.1:8002 and the target hash value is 1500, a corresponding relationship between the hash value 1500 and the identifier 127.0.0.1:8002 is generated. If the corresponding relationship between the hash value 1500 and the identifier 127.0.0.1:8002 is recorded in the routing table, the proxy server does nothing to the routing table; but if the identifier corresponding to the hash value 1500 recorded in the routing table is not the identifier 127.0 .0.1:8002, then replace the identifier corresponding to the hash value 1500 in the routing table with the identifier 127.0.0.1:8002; if the routing table records the correspondence about the hash value 1500, then in the routing table Added: The correspondence between the hash value 1500 and the identifier 127.0.0.1:8002.

应该注意的是,在现有技术中,由于客户端与集群中的节点是直接通信连接的,所以客户端可以直接向集群中的主节点发送非法命令请求,从而攻击集群,对集群造成伤害。例如,普通用户通过客户端直接发送操纵配置集群的指令以及其它的一些特权指令。It should be noted that, in the prior art, since the client and the nodes in the cluster are directly connected in communication, the client can directly send an illegal command request to the master node in the cluster, thereby attacking the cluster and causing damage to the cluster. For example, ordinary users directly send commands to manipulate and configure the cluster and other privileged commands through the client.

在本发明实施例中,为了能够排除上述非法命令请求,在上述任一实施例的基础上,所述代理服务器,还可以用于:In this embodiment of the present invention, in order to exclude the above-mentioned illegal command request, on the basis of any of the above-mentioned embodiments, the proxy server can also be used to:

在所述接收客户端发送的所述目标请求之后,判断所述目标请求是否安全;若为是,执行所述从所述目标集群的各个主节点中确定第一主节点的步骤。After receiving the target request sent by the client, determine whether the target request is safe; if so, execute the step of determining the first master node from each master node of the target cluster.

在本发明实施例中,判断目标请求是否安全的具体方法可以是多样的,例如,可以通过设置防火墙,判断该目标请求是否安全;更简单的,可以由代理服务器判断接收到的目标请求是否是具有所允许的请求格式,以redis集群为例,客户端发送的向redis集群中存储数据的请求,此类请求所对应的格式可以为“set…”,如果当前接收到的请求的格式为“assaset…”,则可以判定该目标请求不安全。In this embodiment of the present invention, specific methods for judging whether the target request is safe may be various. For example, a firewall may be set to determine whether the target request is safe; more simply, the proxy server may determine whether the received target request is It has the allowed request format. Taking redis cluster as an example, the client sends a request to store data in the redis cluster. The format corresponding to such a request can be "set...", if the format of the currently received request is " assert...", it can be determined that the target request is not safe.

可以理解,代理服务器配置了一个安全检测机制,即在接收到客户端发送的目标请求后,只有确定了该目标请求安全后,才会将该目标请求发往集群,保证了集群的安全性,而且,仅需要在代理服务器中配置该安全检测机制,安全检测机制的占用的资源少。It can be understood that the proxy server is configured with a security detection mechanism, that is, after receiving the target request sent by the client, it will only send the target request to the cluster after the security of the target request is determined, which ensures the security of the cluster. Moreover, only the security detection mechanism needs to be configured in the proxy server, and the security detection mechanism occupies less resources.

应该说明是的,转向信息可以包括MOVED信息和ASK信息,不同种类的转向信息,对于代理服务器的访问逻辑是不同的,在上述任一实施例的基础上,所述代理服务器,可以具体用于:It should be noted that, the steering information may include MOVED information and ASK information. Different types of steering information have different access logic to the proxy server. On the basis of any of the above embodiments, the proxy server can be specifically used for :

确定所述转向信息的类型;若所述转向信息为MOVED信息,直接将所述目标请求发送给第二主节点;若所述转向信息为ASK信息,向第二主节点发送ASKING命令,再将所述目标请求发送给所述第二主节点。Determine the type of the steering information; if the steering information is MOVED information, directly send the target request to the second master node; if the steering information is ASK information, send an ASKING command to the second master node, and then send the ASKING command to the second master node. The target request is sent to the second master node.

应该说明的是,确定转向信息的类型所采用的方法属于现有技术,所以代理服务器可以通过现有技术确定转向信息的类型;另外,MOVED信息与ASK信息为现有技术中的概念,二者的不同之处可参照现有技术,本发明实施例在此不再详细介绍。本领域技术人员公知的是,在向主节点发送ASK信息前,应该先向该主节点发送ASKING命令。It should be noted that the method used to determine the type of steering information belongs to the prior art, so the proxy server can determine the type of steering information through the prior art; in addition, MOVED information and ASK information are concepts in the prior art, and the two For the differences, reference may be made to the prior art, and the embodiments of the present invention will not be described in detail here. It is well known to those skilled in the art that, before sending ASK information to the master node, an ASKING command should be sent to the master node first.

图3为本发明实施例中所述转向信息为MOVED信息时,客户端访问集群的流程示意图。FIG. 3 is a schematic flowchart of a client accessing a cluster when the steering information is MOVED information in an embodiment of the present invention.

图3中,“set a2 1”为客户端301发送的请求,“-moved 127.0.0.1:7002”表示一MOVED信息,该MOVED信息携带有该请求所对应的主节点的标识,即图中“127.0.0.1:7002”。图中主节点右侧的文字“127.0.0.1:7000”、“127.0.0.1:7001”、“127.0.0.1:7002”、“127.0.0.1:7003”、“127.0.0.1:7004”和“127.0.0.1:7005”分别表示对应的各个主节点303的标识In Figure 3, "set a2 1" is the request sent by the client 301, "-moved 127.0.0.1:7002" represents a MOVED message, and the MOVED message carries the identifier of the master node corresponding to the request, that is, "-moved 127.0.0.1:7002" 127.0.0.1:7002". The words "127.0.0.1:7000", "127.0.0.1:7001", "127.0.0.1:7002", "127.0.0.1:7003", "127.0.0.1:7004" and "127.0" on the right side of the main node in the figure .0.1:7005" respectively represent the identifiers of the corresponding master nodes 303

如图3所示,客户端301首先将请求“set a2 1”发送给代理服务器302,然后,代理服务器将标识为“127.0.0.1:7001”的主节点确定为第一主节点,并将请求“set a2 1”发送给该第一主节点。然后该第一主节点计算出键值“a2”对应的哈希值,发现该哈希值对应的哈希槽由标识为“127.0.0.1:7002”的主节点处理,然后,该第一主节点向代理服务器发送MOVED信息。As shown in Figure 3, the client 301 first sends the request "set a2 1" to the proxy server 302, and then the proxy server determines the master node identified as "127.0.0.1:7001" as the first master node, and sends the request to the proxy server 302. "set a2 1" is sent to the first master node. Then the first master node calculates the hash value corresponding to the key value "a2", and finds that the hash slot corresponding to the hash value is processed by the master node identified as "127.0.0.1:7002", and then the first master node The node sends the MOVED message to the proxy server.

代理服务器接收到该转向信息后,确定转向信息为MOVED信息,解析获得该MOVED信息中携带的主节点的标识,确定标识为“127.0.0.1:7002”的主节点为第二主节点,然后将请求“set a2 1”发送给该第二主节点。第二主节点接收到该请求后,执行该请求,按照该请求对应的请求命令将“a2”置为“1”存储起来,并向代理服务器反馈请求成功信息“OK”。最后,代理服务器在接收到请求成功信息“OK”后,将该请求成功信息发送给客户端。After receiving the steering information, the proxy server determines that the steering information is MOVED information, parses and obtains the identifier of the master node carried in the MOVED information, determines that the master node with the identifier "127.0.0.1:7002" is the second master node, and then The request "set a2 1" is sent to the second master node. After receiving the request, the second master node executes the request, stores "a2" as "1" according to the request command corresponding to the request, and returns the request success information "OK" to the proxy server. Finally, after receiving the request success information "OK", the proxy server sends the request success information to the client.

图4为本发明实施例中所述转向信息为ASK信息时,客户端访问集群的流程示意图。FIG. 4 is a schematic flowchart of a client accessing a cluster when the steering information is ASK information in an embodiment of the present invention.

图4中,“set a2 1”为客户端301发送的请求,“-ask 127.0.0.1:7002”表示一ASK信息,该ASK信息携带有该请求所对应的主节点的标识,即图中“127.0.0.1:7002”。另外,图中主节点右侧的文字“127.0.0.1:7000”、“127.0.0.1:7001”、“127.0.0.1:7002”、“127.0.0.1:7003”、“127.0.0.1:7004”和“127.0.0.1:7005”分别表示对应的各个主节点303的标识。In Figure 4, "set a2 1" is the request sent by the client 301, and "-ask 127.0.0.1:7002" represents an ASK message, which carries the identifier of the master node corresponding to the request, that is, "-ask 127.0.0.1:7002" 127.0.0.1:7002". In addition, the words "127.0.0.1:7000", "127.0.0.1:7001", "127.0.0.1:7002", "127.0.0.1:7003", "127.0.0.1:7004" and "127.0.0.1:7005" respectively represents the identifier of each corresponding master node 303 .

如图4所示,客户端301首先将请求“set a2 1”发送给代理服务器302,然后,代理服务器302将标识为“127.0.0.1:7000”的主节点303确定为第一主节点,并将请求“set a21”发送给该第一主节点。然后该第一主节点计算出键值“a2”对应的哈希值,发现该哈希值对应的哈希槽由标识为“127.0.0.1:7002”的主节点处理,然后,该第一主节点向代理服务器发送ASK信息。As shown in FIG. 4 , the client 301 first sends the request “set a2 1” to the proxy server 302, and then the proxy server 302 determines the master node 303 identified as “127.0.0.1:7000” as the first master node, and The request "set a21" is sent to the first master node. Then the first master node calculates the hash value corresponding to the key value "a2", and finds that the hash slot corresponding to the hash value is processed by the master node identified as "127.0.0.1:7002", and then the first master node The node sends ASK information to the proxy server.

代理服务器接收到该转向信息后,确定该转向信息为ASK信息,解析获得该ASK信息中携带的主节点标识,确定标识为“127.0.0.1:7002”的主节点为第二主节点,代理服务器先向该第二主节点发送一个ASKING命令“asking”,然后代理服务器再将请求“set a2 1”发送给该第二主节点。第二主节点接收到该请求后,执行该请求,按照该请求对应的请求命令将“a2”置为“1”存储起来,并向代理服务器反馈请求成功信息“OK”。最后,代理服务器在接收到请求成功信息“OK”后,将该请求成功信息发送给客户端。After the proxy server receives the redirection information, it determines that the redirection information is ASK information, parses and obtains the master node identifier carried in the ASK information, and determines that the master node with the identifier "127.0.0.1:7002" is the second master node, and the proxy server First send an ASKING command "asking" to the second master node, and then the proxy server sends a request "set a2 1" to the second master node. After receiving the request, the second master node executes the request, stores "a2" as "1" according to the request command corresponding to the request, and returns the request success information "OK" to the proxy server. Finally, after receiving the request success information "OK", the proxy server sends the request success information to the client.

由以上可见,本实施例提供的方案中,代理服务器首先接收目标客户端发送的用于访问目标集群的目标请求;从目标集群的各个主节点中确定第一主节点;将该目标请求发送至该第一主节点;然后接收该第一主节点反馈的反馈信息;判断该反馈信息是否为转向信息;如果是,从该反馈信息中解析获得节点标识,作为第一标识;将该目标请求发送给该第一标识对应的主节点,以使得该第一标识对应的主节点响应该目标请求。与现有技术相比,本实施例提供的方案中,客户端通过代理服务器与集群通信连接,客户端需要访问集群时,只需将请求发送给代理服务器即可,由代理服务器完成与集群的交互,客户端所需要执行的访问操作简单不繁琐,而且集群的扩展对客户端完全没有影响。It can be seen from the above that in the solution provided by this embodiment, the proxy server first receives the target request sent by the target client for accessing the target cluster; determines the first master node from each master node of the target cluster; sends the target request to the target cluster. the first master node; then receive the feedback information fed back by the first master node; determine whether the feedback information is steering information; if so, parse and obtain the node identifier from the feedback information as the first identifier; send the target request The master node corresponding to the first identifier is given, so that the master node corresponding to the first identifier responds to the target request. Compared with the prior art, in the solution provided by this embodiment, the client communicates with the cluster through the proxy server. When the client needs to access the cluster, it only needs to send the request to the proxy server, and the proxy server completes the communication with the cluster. Interaction, the access operations that the client needs to perform are simple and not cumbersome, and the expansion of the cluster has no impact on the client at all.

另外,应该说明的是,集群访问系统中加入了代理服务器后,通过实验发现:代理服务器的加入,并不影响整个集群访问系统的性能。In addition, it should be noted that after adding a proxy server to the cluster access system, it is found through experiments that the addition of the proxy server does not affect the performance of the entire cluster access system.

可以理解,前述实施例中代理服务器确定的第一主节点和第二主节点,仅是为了方便说明具体操作而给定的名称,在实际应用中,根据实际的目标请求,集群中的任何一个主节点都可能被确定为第一主节点,也可能被确定为第二主节点。It can be understood that the names of the first master node and the second master node determined by the proxy server in the foregoing embodiments are only given names for the convenience of explaining specific operations. In practical applications, according to the actual target request, any one of the cluster The master node may be determined as the first master node, and may also be determined as the second master node.

类似的,前述实施例中第一标识、第二标识是为了方便说明具体操作而给定的名称,其仅表示两个不同的标识而已。在实际应用中,针对不同的请求,同一个标识,既可能为第一标识,也可能为上述第二标识。Similarly, the first identifier and the second identifier in the foregoing embodiments are given names for the convenience of describing specific operations, and only represent two different identifiers. In practical applications, for different requests, the same identifier may be either the first identifier or the above-mentioned second identifier.

本申请其他实施例中,也存在与前述类似的为了方便说明具体操作而给定名称的限定,其都是为了表述方便,并不是实质限定某个设备或网络仅具有什么功能。这里不再一一罗列。In other embodiments of the present application, there are also limitations with names similar to those described above for the convenience of describing specific operations, which are all for convenience of expression and do not substantially limit what functions a certain device or network only has. Not listed here.

下面通过一具体实例来对本发明实施例进行简单介绍。The embodiments of the present invention are briefly introduced below through a specific example.

以redis集群为例,客户端通过代理服务器与redis集群中的各个主节点通信连接,且该代理服务器中配置有路由表,路由表中存储有哈希值与主节点的标识的对应关系。Taking the redis cluster as an example, the client communicates with each master node in the redis cluster through a proxy server, and the proxy server is configured with a routing table, and the routing table stores the corresponding relationship between the hash value and the identity of the master node.

某一客户端向代理服务器发送了一个请求X,该请求X中携带有键值y,代理服务器接收到该请求X后,解析出键值y,然后通过哈希算法计算出该键值y对应的哈希值z。然后代理服务器查询路由表,发现该哈希值z对应的主节点的标识为标识m,则代理服务器将请求X发送给对应标识m的主节点。A client sends a request X to the proxy server, and the request X carries the key value y. After the proxy server receives the request X, it parses the key value y, and then calculates the corresponding key value y through the hash algorithm. the hash value z. Then the proxy server queries the routing table and finds that the identifier of the master node corresponding to the hash value z is the identifier m, and the proxy server sends the request X to the master node corresponding to the identifier m.

对应标识m的主节点反馈请求成功信息,则完成集群访问。当然,代理服务器还会将接收到的请求成功信息发送给客户端。If the master node corresponding to the identifier m returns the request success information, the cluster access is completed. Of course, the proxy server will also send the received request success information to the client.

对应于上述系统实施例,本发明实施例还提供了一种集群访问方法,应用于代理服务器,如图5所示,该方法包括:Corresponding to the above system embodiment, the embodiment of the present invention further provides a cluster access method, which is applied to a proxy server. As shown in FIG. 5 , the method includes:

S101:接收目标客户端发送的用于访问目标集群的目标请求;S101: Receive a target request sent by a target client for accessing a target cluster;

S102:从目标集群的各个主节点中确定第一主节点;S102: Determine a first master node from each master node of the target cluster;

S103:将该目标请求发送至该第一主节点;S103: Send the target request to the first master node;

S104:接收该第一主节点反馈的反馈信息;S104: Receive feedback information fed back by the first master node;

S105:判断该反馈信息是否为转向信息;S105: Determine whether the feedback information is steering information;

在该反馈信息为转向信息的情况下,执行步骤S106:从该反馈信息中解析获得节点标识,作为第一标识;将该目标请求发送给第二主节点,以使得该第二主节点响应该目标请求;其中,该第二主节点为该第一标识对应的主节点。In the case that the feedback information is steering information, step S106 is executed: the node identifier is obtained by parsing the feedback information as the first identifier; and the target request is sent to the second master node, so that the second master node responds to the A target request; wherein, the second master node is the master node corresponding to the first identifier.

本发明实施例中,该目标请求包含有目标键值,对应于上述系统实施例,并基于图5所示的方法实施例的基础上,如图6所示,上述从目标集群的各个主节点中确定第一主节点(S102)的步骤,可以包括:In this embodiment of the present invention, the target request includes a target key value, which corresponds to the above-mentioned system embodiment, and is based on the method embodiment shown in FIG. 5 , as shown in FIG. The step of determining the first master node (S102) in step 1 may include:

S1021:计算目标键值对应的目标哈希值,S1021: Calculate the target hash value corresponding to the target key value,

S1022:查询路由表中是否存在该目标哈希值,其中,该路由表中存储有哈希值与主节点的标识的对应关系;S1022: Query whether the target hash value exists in the routing table, wherein the routing table stores the corresponding relationship between the hash value and the identifier of the master node;

在步骤S1022的查询结果为是的情况下,执行步骤S1023:确定该路由表中目标哈希值对应的主节点为第一主节点;In the case that the query result of step S1022 is yes, step S1023 is executed: determine that the master node corresponding to the target hash value in the routing table is the first master node;

在步骤S1022的查询结果为否的情况下,执行步骤S1024:从目标集群的各个主节点中,随机确定一个主节点为第一主节点。If the query result in step S1022 is no, step S1024 is executed: randomly determine one master node as the first master node from each master node of the target cluster.

对应于上述系统实施例,并基于图6所示的方法实施例的基础上,如图7所示,上述方法还可以包括:Corresponding to the foregoing system embodiment and based on the method embodiment shown in FIG. 6 , as shown in FIG. 7 , the foregoing method may further include:

S107:接收第三主节点反馈的对应于该目标请求的请求成功信息;其中,该第三主节点为成功执行该目标请求对应的请求命令的主节点;S107: Receive the request success information corresponding to the target request fed back by the third master node; wherein, the third master node is the master node that successfully executes the request command corresponding to the target request;

S108:生成第二标识与该目标哈希值的对应关系,其中,该第二标识为第三主节点的标识;S108: Generate a correspondence between a second identifier and the target hash value, where the second identifier is the identifier of the third master node;

S109:将生成的对应关系更新到上述路由表中。S109: Update the generated corresponding relationship to the above routing table.

对应于上述系统实施例,在图5~7任一所示的方法实施例的基础上,如图8所示,上述接收目标客户端发送的用于访问目标集群的目标请求(S101)的步骤之后,该方法还可以包括:Corresponding to the above system embodiment, on the basis of any one of the method embodiments shown in FIGS. 5 to 7 , as shown in FIG. 8 , the above step of receiving a target request sent by a target client for accessing a target cluster ( S101 ) After that, the method can also include:

S1010:判断该目标请求是否安全;S1010: Determine whether the target request is safe;

若为是,执行上述从目标集群的各个主节点中确定第一主节点(S102)的步骤。If yes, execute the above step of determining the first master node (S102) from each master node of the target cluster.

对应于上述系统实施例,在图5~7任一所示的方法实施例的基础上,上述将该目标请求发送给第二主节点的步骤,包括:Corresponding to the foregoing system embodiment, on the basis of any of the method embodiments shown in FIGS. 5 to 7 , the foregoing step of sending the target request to the second master node includes:

确定上述转向信息的类型;determine the type of steering information described above;

若该转向信息为MOVED信息,直接将该目标请求发送给第二主节点;If the steering information is MOVED information, directly send the target request to the second master node;

若该转向信息为ASK信息,向第二主节点发送ASKING命令,再将该目标请求发送给该第二主节点。If the steering information is ASK information, send an ASKING command to the second master node, and then send the target request to the second master node.

由以上可见,本实施例提供的方案中,代理服务器首先接收目标客户端发送的用于访问目标集群的目标请求;从目标集群的各个主节点中确定第一主节点;将该目标请求发送至该第一主节点;然后接收该第一主节点反馈的反馈信息;判断该反馈信息是否为转向信息;如果是,从该反馈信息中解析获得节点标识,作为第一标识;将该目标请求发送给该第一标识对应的主节点,以使得该第一标识对应的主节点响应该目标请求。与现有技术相比,本实施例提供的方案中,客户端通过代理服务器与集群通信连接,客户端需要访问集群时,只需将请求发送给代理服务器即可,由代理服务器完成与集群的交互,客户端所需要执行的访问操作简单不繁琐,而且集群的扩展对客户端完全没有影响。It can be seen from the above that in the solution provided by this embodiment, the proxy server first receives the target request sent by the target client for accessing the target cluster; determines the first master node from each master node of the target cluster; sends the target request to the target cluster. the first master node; then receive the feedback information fed back by the first master node; determine whether the feedback information is steering information; if so, parse and obtain the node identifier from the feedback information as the first identifier; send the target request The master node corresponding to the first identifier is given, so that the master node corresponding to the first identifier responds to the target request. Compared with the prior art, in the solution provided by this embodiment, the client communicates with the cluster through the proxy server. When the client needs to access the cluster, it only needs to send the request to the proxy server, and the proxy server completes the communication with the cluster. Interaction, the access operations that the client needs to perform are simple and not cumbersome, and the expansion of the cluster has no impact on the client at all.

相应于图5所示方法实施例,本发明实施例提供的一种集群访问装置,应用于代理服务器,如图9所示,所述装置包括:Corresponding to the method embodiment shown in FIG. 5 , a cluster access apparatus provided by an embodiment of the present invention is applied to a proxy server. As shown in FIG. 9 , the apparatus includes:

第一接收模块110,用于接收目标客户端发送的用于访问目标集群的目标请求;The first receiving module 110 is configured to receive the target request sent by the target client for accessing the target cluster;

确定模块120,用于从所述目标集群的各个主节点中确定第一主节点;a determining module 120, configured to determine a first master node from each master node of the target cluster;

第一发送模块130,用于将所述目标请求发送至所述第一主节点;a first sending module 130, configured to send the target request to the first master node;

第二接收模块140,用于接收所述第一主节点反馈的反馈信息;A second receiving module 140, configured to receive feedback information fed back by the first master node;

第一判断模块150,用于判断所述反馈信息是否为转向信息;The first judgment module 150 is used for judging whether the feedback information is steering information;

第二发送模块160,用于在所述第一判断模块150的判断结果为是的情况下,从所述反馈信息中解析获得节点标识,作为第一标识;将所述目标请求发送给第二主节点,以使得所述第二主节点响应所述目标请求;其中,所述第二主节点为所述第一标识对应的主节点。The second sending module 160 is configured to analyze and obtain the node identifier from the feedback information when the determination result of the first determination module 150 is yes, as the first identifier; and send the target request to the second a master node, so that the second master node responds to the target request; wherein the second master node is the master node corresponding to the first identifier.

本发明实施例中,所述目标请求包含有目标键值,相应于图6所示方法实施例,在图9所示的装置实施例的基础上,如图10所示,所述确定模块120,可以包括:In this embodiment of the present invention, the target request includes a target key value. Corresponding to the method embodiment shown in FIG. 6 , on the basis of the apparatus embodiment shown in FIG. 9 , as shown in FIG. 10 , the determining module 120 , which can include:

计算子模块1201,用于计算所述目标键值对应的目标哈希值,The calculation submodule 1201 is used to calculate the target hash value corresponding to the target key value,

查询子模块1202,用于查询路由表中是否存在所述目标哈希值,其中,所述路由表中存储有哈希值与主节点的标识的对应关系;Inquiry submodule 1202, configured to inquire whether the target hash value exists in the routing table, wherein the routing table stores the corresponding relationship between the hash value and the identification of the master node;

第一确定子模块1203,用于在所述路由表中存在所述目标哈希值的情况下,确定所述路由表中所述目标哈希值对应的主节点为第一主节点;A first determination submodule 1203, configured to determine the primary node corresponding to the target hash value in the routing table as the first primary node when the target hash value exists in the routing table;

第二确定子模块1204,用于在所述路由表中不存在所述目标哈希值的情况下,从所述目标集群的各个主节点中,随机确定一个主节点为第一主节点。The second determining submodule 1204 is configured to randomly determine a master node as the first master node from each master node of the target cluster in the case that the target hash value does not exist in the routing table.

相应于图7所示方法实施例,在图10所示的装置实施例的基础上,如图11所示,所述装置还可以包括:Corresponding to the method embodiment shown in FIG. 7 , on the basis of the apparatus embodiment shown in FIG. 10 , as shown in FIG. 11 , the apparatus may further include:

第三接收模块170,用于接收第三主节点反馈的对应于所述目标请求的请求成功信息;其中,所述第三主节点为成功执行所述目标请求对应的请求命令的主节点;The third receiving module 170 is configured to receive the request success information corresponding to the target request fed back by a third master node; wherein, the third master node is the master node that successfully executes the request command corresponding to the target request;

生成模块180,用于生成第二标识与所述目标哈希值的对应关系,其中,所述第二标识为所述第三主节点的标识;A generating module 180, configured to generate a correspondence between a second identifier and the target hash value, wherein the second identifier is the identifier of the third master node;

更新模块190,用于将生成的对应关系更新到所述路由表中。The updating module 190 is configured to update the generated corresponding relationship into the routing table.

相应于图8所示方法实施例,在图9~11任一所示的装置实施例的基础上,具体的,如图12所示,所述装置还可以包括:Corresponding to the method embodiment shown in FIG. 8 , on the basis of any of the apparatus embodiments shown in FIGS. 9 to 11 , specifically, as shown in FIG. 12 , the apparatus may further include:

第二判断模块1100,用于在所述接收目标客户端发送的用于访问目标集群的目标请求之后,判断所述目标请求是否安全;若为是,触发所述确定模块120。The second judging module 1100 is configured to judge whether the target request is safe after receiving the target request sent by the target client for accessing the target cluster; if so, trigger the determining module 120 .

相应于方法实施例,在图9~11任一所示的装置实施例的基础上,具体的,所述第二发送模块160,可以具体用于:Corresponding to the method embodiment, on the basis of any of the apparatus embodiments shown in FIGS. 9 to 11 , specifically, the second sending module 160 may be specifically used for:

在所述第一判断模块150的判断结果为是的情况下,从所述反馈信息中解析获得节点标识,作为第一标识;确定所述转向信息的类型;若所述转向信息为MOVED信息,直接将所述目标请求发送给第二主节点;若所述转向信息为ASK信息,向第二主节点发送ASKING命令,再将所述目标请求发送给所述第二主节点。In the case that the judgment result of the first judgment module 150 is yes, the node identification is obtained by parsing from the feedback information as the first identification; the type of the steering information is determined; if the steering information is MOVED information, The target request is directly sent to the second master node; if the steering information is ASK information, an ASKING command is sent to the second master node, and then the target request is sent to the second master node.

由以上可见,本实施例提供的方案中,代理服务器首先接收目标客户端发送的用于访问目标集群的目标请求;从目标集群的各个主节点中确定第一主节点;将该目标请求发送至该第一主节点;然后接收该第一主节点反馈的反馈信息;判断该反馈信息是否为转向信息;如果是,从该反馈信息中解析获得节点标识,作为第一标识;将该目标请求发送给该第一标识对应的主节点,以使得该第一标识对应的主节点响应该目标请求。与现有技术相比,本实施例提供的方案中,客户端通过代理服务器与集群通信连接,客户端需要访问集群时,只需将请求发送给代理服务器即可,由代理服务器完成与集群的交互,客户端所需要执行的访问操作简单不繁琐,而且集群的扩展对客户端完全没有影响。It can be seen from the above that in the solution provided by this embodiment, the proxy server first receives the target request sent by the target client for accessing the target cluster; determines the first master node from each master node of the target cluster; sends the target request to the target cluster. the first master node; then receive the feedback information fed back by the first master node; determine whether the feedback information is steering information; if so, parse and obtain the node identifier from the feedback information as the first identifier; send the target request The master node corresponding to the first identifier is given, so that the master node corresponding to the first identifier responds to the target request. Compared with the prior art, in the solution provided by this embodiment, the client communicates with the cluster through the proxy server. When the client needs to access the cluster, it only needs to send the request to the proxy server, and the proxy server completes the communication with the cluster. Interaction, the access operations that the client needs to perform are simple and not cumbersome, and the expansion of the cluster has no impact on the client at all.

对于方法和装置实施例而言,由于其基本相似于集群访问系统对应的系统实施例,所以描述的比较简单,相关之处参见系统实施例的部分说明即可。As for the method and device embodiments, since they are basically similar to the system embodiments corresponding to the cluster access system, the description is relatively simple, and for related parts, please refer to some descriptions of the system embodiments.

需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. any such actual relationship or sequence exists. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.

本说明书中的各个实施例均采用相关的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。Each embodiment in this specification is described in a related manner, and the same and similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, as for the system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and for related parts, please refer to the partial descriptions of the method embodiments.

以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。凡在本发明的精神和原则之内所作的任何修改、等同替换、改进等,均包含在本发明的保护范围内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims (15)

1.一种集群访问系统,其特征在于,所述集群访问系统包括:客户端、代理服务器以及集群,所述代理服务器与客户端、集群中的各个主节点通信连接,所述集群为无中心主节点的集群,1. A cluster access system, characterized in that the cluster access system comprises: a client, a proxy server and a cluster, the proxy server is communicatively connected with each master node in the client and the cluster, and the cluster is a centerless a cluster of master nodes, 所述客户端,用于向所述代理服务器发送用于访问目标集群的目标请求;the client, configured to send a target request for accessing the target cluster to the proxy server; 所述代理服务器,用于接收所述客户端发送的所述目标请求;从所述目标集群的各个主节点中确定第一主节点;将所述目标请求发送至所述第一主节点;接收所述第一主节点反馈的反馈信息;判断所述反馈信息是否为转向信息;如果是,从所述反馈信息中解析获得节点标识,作为第一标识;将所述目标请求发送给第二主节点;其中,所述第二主节点为所述第一标识对应的主节点;the proxy server, configured to receive the target request sent by the client; determine a first master node from each master node of the target cluster; send the target request to the first master node; receive The feedback information fed back by the first master node; determine whether the feedback information is steering information; if so, parse and obtain the node identifier from the feedback information as the first identifier; send the target request to the second master node; wherein, the second master node is the master node corresponding to the first identifier; 所述第一主节点,用于接收所述代理服务器发送的所述目标请求,并针对所述目标请求生成反馈信息;将所述反馈信息发送给所述代理服务器;the first master node, configured to receive the target request sent by the proxy server, and generate feedback information for the target request; send the feedback information to the proxy server; 所述第二主节点,用于接收所述代理服务器发送的所述目标请求,并响应所述目标请求。The second master node is configured to receive the target request sent by the proxy server and respond to the target request. 2.根据权利要求1所述的系统,其特征在于,所述目标请求包含有目标键值,2. The system according to claim 1, wherein the target request includes a target key value, 所述代理服务器,具体用于:The proxy server is specifically used for: 计算所述目标键值对应的目标哈希值;查询路由表中是否存在所述目标哈希值;如果是,确定所述路由表中所述目标哈希值对应的主节点为第一主节点;如果否,从所述目标集群的各个主节点中,随机确定一个主节点为第一主节点,其中,所述路由表中存储有哈希值与主节点的标识的对应关系。Calculate the target hash value corresponding to the target key value; query whether the target hash value exists in the routing table; if so, determine that the primary node corresponding to the target hash value in the routing table is the first primary node ; if not, randomly determine a master node as the first master node from each master node of the target cluster, wherein the routing table stores the corresponding relationship between the hash value and the identifier of the master node. 3.根据权利要求2所述的系统,其特征在于,所述代理服务器还用于:3. The system according to claim 2, wherein the proxy server is further used for: 接收第三主节点反馈的对应于所述目标请求的请求成功信息;生成第二标识与所述目标哈希值的对应关系;将生成的对应关系更新到所述路由表中;其中,所述第三主节点为成功执行所述目标请求对应的请求命令的主节点,所述第二标识为所述第三主节点的标识。receiving the request success information corresponding to the target request fed back by the third master node; generating a corresponding relationship between the second identifier and the target hash value; updating the generated corresponding relationship into the routing table; wherein, the The third master node is the master node that successfully executes the request command corresponding to the target request, and the second identifier is the identifier of the third master node. 4.根据权利要求1-3中任一项所述的系统,其特征在于,所述代理服务器,还用于:4. The system according to any one of claims 1-3, wherein the proxy server is further configured to: 在所述接收客户端发送的所述目标请求之后,判断所述目标请求是否安全;After receiving the target request sent by the client, determine whether the target request is safe; 若为是,执行所述从所述目标集群的各个主节点中确定第一主节点的步骤。If yes, execute the step of determining the first master node from each master node of the target cluster. 5.根据权利要求1-3中任一项所述的系统,其特征在于,所述代理服务器,具体用于:5. The system according to any one of claims 1-3, wherein the proxy server is specifically used for: 确定所述转向信息的类型;若所述转向信息为MOVED信息,直接将所述目标请求发送给第二主节点;若所述转向信息为ASK信息,向第二主节点发送ASKING命令,再将所述目标请求发送给所述第二主节点。Determine the type of the steering information; if the steering information is MOVED information, directly send the target request to the second master node; if the steering information is ASK information, send an ASKING command to the second master node, and then send the ASKING command to the second master node. The target request is sent to the second master node. 6.一种集群访问方法,其特征在于,应用于代理服务器,所述方法包括:6. A cluster access method, characterized in that, applied to a proxy server, the method comprising: 接收目标客户端发送的用于访问目标集群的目标请求;Receive the target request sent by the target client to access the target cluster; 从所述目标集群的各个主节点中确定第一主节点;determining a first master node from each master node of the target cluster; 将所述目标请求发送至所述第一主节点;sending the target request to the first master node; 接收所述第一主节点反馈的反馈信息;receiving feedback information fed back by the first master node; 判断所述反馈信息是否为转向信息;Determine whether the feedback information is steering information; 如果是,从所述反馈信息中解析获得节点标识,作为第一标识;将所述目标请求发送给第二主节点,以使得所述第二主节点响应所述目标请求;其中,所述第二主节点为所述第一标识对应的主节点。If yes, parse and obtain the node identifier from the feedback information as the first identifier; send the target request to the second master node, so that the second master node responds to the target request; wherein the first The second master node is the master node corresponding to the first identifier. 7.根据权利要求6所述的方法,其特征在于,所述目标请求包含有目标键值,7. The method according to claim 6, wherein the target request includes a target key value, 所述从所述目标集群的各个主节点中确定第一主节点的步骤,包括:The step of determining the first master node from each master node of the target cluster includes: 计算所述目标键值对应的目标哈希值,Calculate the target hash value corresponding to the target key value, 查询路由表中是否存在所述目标哈希值,其中,所述路由表中存储有哈希值与主节点的标识的对应关系;query whether the target hash value exists in the routing table, wherein the routing table stores the corresponding relationship between the hash value and the identity of the master node; 如果是,确定所述路由表中所述目标哈希值对应的主节点为第一主节点;If yes, determine that the master node corresponding to the target hash value in the routing table is the first master node; 如果否,从所述目标集群的各个主节点中,随机确定一个主节点为第一主节点。If not, randomly determine one master node as the first master node from among the master nodes of the target cluster. 8.根据权利要求7所述的方法,其特征在于,所述方法还包括:8. The method according to claim 7, wherein the method further comprises: 接收第三主节点反馈的对应于所述目标请求的请求成功信息;其中,所述第三主节点为成功执行所述目标请求对应的请求命令的主节点;Receive the request success information corresponding to the target request fed back by the third master node; wherein, the third master node is the master node that successfully executes the request command corresponding to the target request; 生成第二标识与所述目标哈希值的对应关系,其中,所述第二标识为所述第三主节点的标识;generating a correspondence between a second identifier and the target hash value, wherein the second identifier is the identifier of the third master node; 将生成的对应关系更新到所述路由表中。The generated corresponding relationship is updated into the routing table. 9.根据权利要求6-8任一项所述的方法,其特征在于,在所述接收目标客户端发送的用于访问目标集群的目标请求的步骤之后,所述方法还包括:9. The method according to any one of claims 6-8, wherein after the step of receiving the target request sent by the target client for accessing the target cluster, the method further comprises: 判断所述目标请求是否安全;Determine whether the target request is safe; 若为是,执行所述从所述目标集群的各个主节点中确定第一主节点的步骤。If yes, execute the step of determining the first master node from each master node of the target cluster. 10.根据权利要求6-8任一项所述的方法,其特征在于,所述将所述目标请求发送给第二主节点的步骤,包括:10. The method according to any one of claims 6-8, wherein the step of sending the target request to the second master node comprises: 确定所述转向信息的类型;determining the type of steering information; 若所述转向信息为MOVED信息,直接将所述目标请求发送给第二主节点;If the steering information is MOVED information, directly send the target request to the second master node; 若所述转向信息为ASK信息,向第二主节点发送ASKING命令,再将所述目标请求发送给所述第二主节点。If the steering information is ASK information, send an ASKING command to the second master node, and then send the target request to the second master node. 11.一种集群访问装置,其特征在于,应用于代理服务器,所述装置包括:11. A cluster access device, characterized in that, applied to a proxy server, the device comprising: 第一接收模块,用于接收目标客户端发送的用于访问目标集群的目标请求;a first receiving module, configured to receive a target request sent by the target client for accessing the target cluster; 确定模块,用于从所述目标集群的各个主节点中确定第一主节点;a determining module, configured to determine the first master node from each master node of the target cluster; 第一发送模块,用于将所述目标请求发送至所述第一主节点;a first sending module, configured to send the target request to the first master node; 第二接收模块,用于接收所述第一主节点反馈的反馈信息;a second receiving module, configured to receive feedback information fed back by the first master node; 第一判断模块,用于判断所述反馈信息是否为转向信息;a first judging module for judging whether the feedback information is steering information; 第二发送模块,用于在所述第一判断模块的判断结果为是的情况下,从所述反馈信息中解析获得节点标识,作为第一标识;将所述目标请求发送给第二主节点,以使得所述第二主节点响应所述目标请求;其中,所述第二主节点为所述第一标识对应的主节点。A second sending module, configured to parse and obtain a node identifier from the feedback information when the determination result of the first determination module is yes, as the first identifier; and send the target request to the second master node , so that the second master node responds to the target request; wherein, the second master node is the master node corresponding to the first identifier. 12.根据权利要求11所述的装置,其特征在于,所述目标请求包含有目标键值,12. The apparatus according to claim 11, wherein the target request includes a target key value, 所述确定模块,包括:The determining module includes: 计算子模块,用于计算所述目标键值对应的目标哈希值,a calculation sub-module for calculating the target hash value corresponding to the target key value, 查询子模块,用于查询路由表中是否存在所述目标哈希值,其中,所述路由表中存储有哈希值与主节点的标识的对应关系;a query sub-module for querying whether the target hash value exists in the routing table, wherein the routing table stores the corresponding relationship between the hash value and the identity of the master node; 第一确定子模块,用于在所述路由表中存在所述目标哈希值的情况下,确定所述路由表中所述目标哈希值对应的主节点为第一主节点;a first determination submodule, configured to determine the master node corresponding to the target hash value in the routing table as the first master node when the target hash value exists in the routing table; 第二确定子模块,用于在所述路由表中不存在所述目标哈希值的情况下,从所述目标集群的各个主节点中,随机确定一个主节点为第一主节点。The second determination submodule is configured to randomly determine a master node as the first master node from each master node of the target cluster when the target hash value does not exist in the routing table. 13.根据权利要求12所述的装置,其特征在于,所述装置还包括:13. The apparatus of claim 12, wherein the apparatus further comprises: 第三接收模块,用于接收第三主节点反馈的对应于所述目标请求的请求成功信息;其中,所述第三主节点为成功执行所述目标请求对应的请求命令的主节点;a third receiving module, configured to receive the request success information corresponding to the target request fed back by a third master node; wherein, the third master node is a master node that successfully executes the request command corresponding to the target request; 生成模块,用于生成第二标识与所述目标哈希值的对应关系,其中,所述第二标识为所述第三主节点的标识;a generating module, configured to generate a correspondence between a second identifier and the target hash value, wherein the second identifier is the identifier of the third master node; 更新模块,用于将生成的对应关系更新到所述路由表中。An update module, configured to update the generated corresponding relationship into the routing table. 14.根据权利要求11-13任一项所述的装置,其特征在于,所述装置还包括:14. The device according to any one of claims 11-13, wherein the device further comprises: 第二判断模块,用于在所述接收目标客户端发送的用于访问目标集群的目标请求之后,判断所述目标请求是否安全;若为是,触发所述确定模块。The second judging module is configured to judge whether the target request is safe after receiving the target request sent by the target client for accessing the target cluster; if so, trigger the determining module. 15.根据权利要求11-13任一项所述的装置,其特征在于,所述第二发送模块,具体用于:15. The apparatus according to any one of claims 11-13, wherein the second sending module is specifically configured to: 在所述第一判断模块的判断结果为是的情况下,从所述反馈信息中解析获得节点标识,作为第一标识;确定所述转向信息的类型;若所述转向信息为MOVED信息,直接将所述目标请求发送给第二主节点;若所述转向信息为ASK信息,向第二主节点发送ASKING命令,再将所述目标请求发送给所述第二主节点。In the case that the judgment result of the first judgment module is yes, analyze and obtain the node identification from the feedback information as the first identification; determine the type of the steering information; if the steering information is MOVED information, directly Send the target request to the second master node; if the steering information is ASK information, send an ASKING command to the second master node, and then send the target request to the second master node.
CN201611169926.9A 2016-12-16 2016-12-16 A cluster access system, method and device Active CN108206779B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611169926.9A CN108206779B (en) 2016-12-16 2016-12-16 A cluster access system, method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611169926.9A CN108206779B (en) 2016-12-16 2016-12-16 A cluster access system, method and device

Publications (2)

Publication Number Publication Date
CN108206779A CN108206779A (en) 2018-06-26
CN108206779B true CN108206779B (en) 2020-08-14

Family

ID=62601653

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611169926.9A Active CN108206779B (en) 2016-12-16 2016-12-16 A cluster access system, method and device

Country Status (1)

Country Link
CN (1) CN108206779B (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108206779B (en) * 2016-12-16 2020-08-14 北京金山云网络技术有限公司 A cluster access system, method and device
CN110971631B (en) * 2018-09-29 2022-07-05 北京金山云网络技术有限公司 Method, device, server and medium for accessing ceph cluster
CN109407980A (en) * 2018-09-29 2019-03-01 武汉极意网络科技有限公司 Data-storage system based on Redis cluster
CN111107120B (en) * 2018-10-29 2022-09-02 亿阳信通股份有限公司 Redis cluster construction method and system
CN111435942B (en) * 2019-01-14 2023-04-18 北京京东尚科信息技术有限公司 Redis cluster access method, system, middleware, medium and device
CN109769028A (en) * 2019-01-25 2019-05-17 深圳前海微众银行股份有限公司 Redis cluster management method, apparatus, device and readable storage medium
CN110009201B (en) * 2019-03-15 2022-11-04 南瑞集团有限公司 A power data link system and method based on blockchain technology
CN109981767A (en) * 2019-03-20 2019-07-05 浪潮商用机器有限公司 HANA data bank access method, device, system, equipment and storage medium
CN111245943A (en) * 2020-01-14 2020-06-05 山东汇贸电子口岸有限公司 Method for obtaining accessible IP address by Redis cluster
CN113472823B (en) * 2020-03-30 2023-06-27 深圳Tcl数字技术有限公司 Server access method and device, intelligent terminal and storage medium
CN113821495B (en) * 2021-08-30 2025-01-10 山东有人物联网股份有限公司 Database cluster implementation system and method
CN114338769B (en) * 2021-12-22 2024-04-12 浙江中控技术股份有限公司 Access request processing method and device
CN115049061B (en) * 2022-07-13 2024-09-13 卡奥斯工业智能研究院(青岛)有限公司 Artificial intelligence reasoning system based on block chain
CN115827757B (en) * 2022-11-30 2024-03-12 西部科学城智能网联汽车创新中心(重庆)有限公司 Data operation method and device for multi-HBase cluster
CN115665159B (en) * 2022-12-14 2023-04-28 中国华能集团清洁能源技术研究院有限公司 Metadata management method and system in big data environment
CN116975036B (en) * 2023-08-09 2026-02-06 北京大学 Data management method, device, computer equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101217483A (en) * 2008-01-21 2008-07-09 中兴通讯股份有限公司 Method for implementing load-sharing proxy in clustered servers
CN102148850A (en) * 2010-08-09 2011-08-10 华为软件技术有限公司 Cluster system and service processing method thereof
CN102591970A (en) * 2011-12-31 2012-07-18 北京奇虎科技有限公司 Distributed key-value query method and query engine system
CN102724104A (en) * 2011-03-30 2012-10-10 北京东方通科技股份有限公司 Apparatus and method for automatically configuring Java EE application cluster
CN104050250A (en) * 2011-12-31 2014-09-17 北京奇虎科技有限公司 Distributed key-value query method and query engine system
US9361042B2 (en) * 2008-12-19 2016-06-07 Netapp, Inc. Accelerating internet small computer system interface (iSCSI) proxy input/output (I/O)
CN108206779A (en) * 2016-12-16 2018-06-26 北京金山云网络技术有限公司 A kind of cluster accesses system, method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101217483A (en) * 2008-01-21 2008-07-09 中兴通讯股份有限公司 Method for implementing load-sharing proxy in clustered servers
US9361042B2 (en) * 2008-12-19 2016-06-07 Netapp, Inc. Accelerating internet small computer system interface (iSCSI) proxy input/output (I/O)
CN102148850A (en) * 2010-08-09 2011-08-10 华为软件技术有限公司 Cluster system and service processing method thereof
CN102724104A (en) * 2011-03-30 2012-10-10 北京东方通科技股份有限公司 Apparatus and method for automatically configuring Java EE application cluster
CN102591970A (en) * 2011-12-31 2012-07-18 北京奇虎科技有限公司 Distributed key-value query method and query engine system
CN104050250A (en) * 2011-12-31 2014-09-17 北京奇虎科技有限公司 Distributed key-value query method and query engine system
CN108206779A (en) * 2016-12-16 2018-06-26 北京金山云网络技术有限公司 A kind of cluster accesses system, method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
广域网多级集群环境下的MPI扩展研究;张啸;《中国优秀硕士学位论文全文数据库(电子期刊)》;20120315;全文 *

Also Published As

Publication number Publication date
CN108206779A (en) 2018-06-26

Similar Documents

Publication Publication Date Title
CN108206779B (en) A cluster access system, method and device
US20200304563A1 (en) Method for accessing network by internet of things device, apparatus, and system
JP6704472B2 (en) Device configuration method and apparatus based on network configuration protocol
CN107690800B (en) Manage dynamic IP address assignment
CN105247529B (en) The synchronous voucher hash between directory service
US9110884B2 (en) Message publishing and subscribing method and apparatus
US10193997B2 (en) Encoded URI references in restful requests to facilitate proxy aggregation
US10491464B2 (en) Network topology assisted device provisioning
CN110019211A (en) The methods, devices and systems of association index
JP5466723B2 (en) Host providing system and communication control method
US9948603B1 (en) System and method of constructing dynamic namespaces in the internet of things
JP6106334B2 (en) Method, system and computer readable medium for performing advanced service routing
CN115150410A (en) Multi-cluster access method and system
CN108206843B (en) Cluster access method and device
CN110417777B (en) An optimized method and apparatus for communication between microservices
CN107784009A (en) Data query, data query processing method and processing device
JP6540063B2 (en) Communication information control apparatus, relay system, communication information control method, and communication information control program
CN107786594B (en) Service request processing method and device
CN109120556B (en) Method and system for cloud host to access object storage server
JP6233846B2 (en) Variable-length nonce generation
US10904327B2 (en) Method, electronic device and computer program product for searching for node
EP2939395B1 (en) Creating a profile for accessing resources across a plurality of nodes
US11916788B2 (en) Determination of routing domain information to merge IP addresses
US10904085B2 (en) Systems and methods for applying a configuration
CN117492933B (en) Data exchange method, device, electronic equipment and storage medium

Legal Events

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