WO2020224098A1 - 基于全局负载均衡的云存取方法、装置及存储介质 - Google Patents

基于全局负载均衡的云存取方法、装置及存储介质 Download PDF

Info

Publication number
WO2020224098A1
WO2020224098A1 PCT/CN2019/102193 CN2019102193W WO2020224098A1 WO 2020224098 A1 WO2020224098 A1 WO 2020224098A1 CN 2019102193 W CN2019102193 W CN 2019102193W WO 2020224098 A1 WO2020224098 A1 WO 2020224098A1
Authority
WO
WIPO (PCT)
Prior art keywords
database
cloud
database node
data
node
Prior art date
Application number
PCT/CN2019/102193
Other languages
English (en)
French (fr)
Inventor
张琦
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020224098A1 publication Critical patent/WO2020224098A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/10Mapping addresses of different types
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Definitions

  • This application relates to the field of cloud storage technology, and in particular to a cloud access method, device and computer-readable storage medium based on global load balancing.
  • This application provides a cloud access method, device, and computer-readable storage medium based on global load balancing, and its main purpose is to provide a cloud database access solution with multiple activities and high availability.
  • a cloud access method based on global load balancing includes:
  • the present application also provides a cloud access device based on global load balancing.
  • the device includes a memory and a processor.
  • the memory stores a global load balancing device that can run on the processor.
  • the cloud access program based on global load balancing is executed by the processor, the following steps are implemented:
  • the present application also provides a computer-readable storage medium storing a cloud access program based on global load balancing, and the cloud access program based on global load balancing It may be executed by one or more processors to implement the steps of the cloud access method based on global load balancing as described above.
  • the cloud access method, device and computer-readable storage medium based on global load balancing proposed in this application introduce global load balancing technology to the resource scheduling of the cloud database system, find the best database node corresponding to the client user, and then execute HTTP reconfiguration It is directed to client users and realizes a multi-active and highly available cloud database system based on global load balancing.
  • FIG. 1 is a schematic flowchart of a cloud access method based on global load balancing provided by an embodiment of this application;
  • FIG. 2 is a schematic diagram of the internal structure of a cloud access device based on global load balancing provided by an embodiment of the application;
  • Fig. 3 is a schematic diagram of modules of a cloud access program based on global load balancing in a cloud access device based on global load balancing provided by an embodiment of the application.
  • This application provides a cloud access method based on Global Server Load Balance (GSLB).
  • GSLB Global Server Load Balance
  • FIG. 1 it is a schematic flowchart of a cloud access method based on global load balancing provided by an embodiment of this application.
  • the method can be executed by a device, and the device can be implemented by software and/or hardware.
  • the cloud access method based on global load balancing includes:
  • the optimal database node is the database node in the cloud database system that is closest to the client user currently having data access needs and has the best operating condition.
  • the preset node selection method includes:
  • test picture test.jpg with a size of about 20KB
  • the client user downloads the pre-stored test picture test.jpg from each database node in the cloud database system according to the address in the speed test script program;
  • V Obtain the operation log of each database node in the cloud database system, and analyze the health information of each database node, such as CPU usage, memory usage, network usage, etc.;
  • the database node with the best health information is selected from the multiple candidate database nodes as the best database node.
  • the redirection includes:
  • domain name system When the domain name system cannot resolve the domain name, it sends a resolution request to the higher-level domain name system level by level;
  • the upper-level domain name system returns the IP address of the global load balancing device to the local domain name system according to its stored address records;
  • the client user sends a TCP connection to the global load balancing device and requests to access data;
  • the global load balancing device returns the HTTP redirected IP based on the optimal database node selected above, that is, the address of the optimal database node;
  • the technology based on HTTP redirection makes full use of the strategy of global load balancing to intelligently select the best database node, so that users can access the most recently running database node.
  • steps S1 and S2 use global load balancing to direct the user's access operation to the closest and best running database node in the cloud database system, thereby providing faster response speed and improving user experience.
  • this may lead to cloud database
  • the data of each database node in the system is independent and inconsistent, which violates the basic data consistency principle of the cloud database system. Therefore, it is necessary to synchronize the data between each cloud database node.
  • the data synchronization between each database node includes data replication and consistency check operations.
  • a peer-to-peer synchronization mechanism is adopted in the preferred embodiment of the present application.
  • SQL Structured Query Language
  • the SQL capturer only captures the SQL statements that can change the data records in the database node, such as insert, update and other operation types, and filters out queries and other operation types that do not change the database data.
  • the local database node uses the message queue server to send the captured SQL statement to the remote database node. After the message is received by the remote database node, it performs data consistency operations after parsing, such as data replication or update.
  • the embodiment of this application adopts a strong consistency strategy to define the SQL operation in the active and standby database nodes in the cloud database system as a transaction.
  • the data update operation of the active and standby database nodes is successful, and the entire transaction can be used. Submit, otherwise the transaction will be rolled back if any operation fails, which can effectively ensure strong consistency.
  • the embodiment of this application can also use the final consistency strategy, that is, it is not necessary to wait for the result of the operation of the remote database node, the local database node can submit it directly, and the verification database can be used for the operation failure. check. Therefore, the choice can be made based on the requirements between consistency and availability.
  • the preferred embodiment of the invention proposes a targeted inspection and correction algorithm, including:
  • the verification object is composed of operation records, operation timestamps, and Boolean identifiers.
  • the operation record is the primary key
  • the operation timestamp is the time of the current operation of the system
  • the boolean identifier is a flag indicating whether the operation is applied to the remote database (the value is set to false by default). If the execution fails, it ends directly.
  • the situation in the verification library at this time if the local cloud database and the remote cloud database have the same data, the flag bits in the verification library are all true. If the local cloud database operation succeeds, but the remote cloud database operation fails, the flag bit of the corresponding operation record is false. If the local database operation fails, but the remote cloud database operation succeeds, the flag bit of the corresponding operation record is also false.
  • the values of the flag bits are all true, it means that the data in the local database and the remote database are exactly the same, and the verification ends. If the flag bit is false, and these records exist in the local database, the records need to be inserted into the remote database. Regardless of whether the insertion or deletion is successful or not, the records whose flag bit value is true are deleted, which ensures that the local and remote database data are consistent. The remaining records with false flags are redundant data and can be checked in the next check cycle. The verification period can be set according to the actual production situation and server performance.
  • This application also provides a cloud access device based on global load balancing.
  • FIG. 2 it is a schematic diagram of the internal structure of a cloud access device based on global load balancing provided by an embodiment of this application.
  • the cloud access device 1 based on global load balancing may be a PC (Personal Computer, personal computer), or a terminal device such as a smart phone, a tablet computer, and a portable computer.
  • the cloud access device 1 based on global load balancing at least includes a memory 11, a processor 12, a communication bus 13, and a network interface 14.
  • the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc.
  • the memory 11 may be an internal storage unit of the cloud access device 1 based on global load balancing, such as a hard disk of the cloud access device 1 based on global load balancing.
  • the memory 11 may also be an external storage device of the cloud access device 1 based on global load balancing, such as a plug-in hard disk equipped on the cloud access device 1 based on global load balancing, and a smart memory card (Smart Memory Card).
  • the memory 11 may also include both an internal storage unit of the cloud access device 1 based on global load balancing and an external storage device.
  • the memory 11 can be used not only to store application software and various data installed in the cloud access device 1 based on global load balancing, such as the code of the cloud access program 01 based on global load balancing, etc., but also to temporarily store Data to be output or to be output.
  • the processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip in some embodiments, and is used to run the program code or processing stored in the memory 11 Data, such as executing cloud access program 01 based on global load balancing, etc.
  • CPU central processing unit
  • controller microcontroller
  • microprocessor or other data processing chip in some embodiments, and is used to run the program code or processing stored in the memory 11 Data, such as executing cloud access program 01 based on global load balancing, etc.
  • the communication bus 13 is used to realize the connection and communication between these components.
  • the network interface 14 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface), and is usually used to establish a communication connection between the device 1 and other electronic devices.
  • the device 1 may also include a user interface.
  • the user interface may include a display (Display) and an input unit such as a keyboard (Keyboard).
  • the optional user interface may also include a standard wired interface and a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light emitting diode) touch device, etc.
  • the display can also be called a display screen or a display unit as appropriate, and is used to display the information processed in the cloud access device 1 based on global load balancing and to display a visualized user interface.
  • Figure 2 only shows the cloud access device 1 based on global load balancing with components 11-14 and the cloud access program 01 based on global load balancing.
  • the structure shown in Figure 1 is not It does not constitute a limitation on the cloud access device 1 based on global load balancing, and may include fewer or more components than shown in the figure, or a combination of certain components, or a different component arrangement.
  • the cloud access program 01 based on global load balancing is stored in the memory 11; when the processor 12 executes the cloud access program 01 based on global load balancing stored in the memory 11, the following is achieved step:
  • Step 1 Select the best database node corresponding to a client user in the cloud database system according to a preset node selection method.
  • the optimal database node is the database node in the cloud database system that is closest to the client user currently having data access needs and has the best operating condition.
  • the preset node selection method includes:
  • test picture test.jpg with a size of about 20KB
  • the client user downloads the pre-stored test picture test.jpg from each database node in the cloud database system according to the address in the speed test script program;
  • V Obtain the operation log of each database node in the cloud database system, and analyze the health information of each database node, such as CPU usage, memory usage, network usage, etc.;
  • Step 2 Using HTTP-based redirection, the client user's access is redirected to the best database node, and the data access operation is performed on the best database node.
  • the redirection includes:
  • domain name system When the domain name system cannot resolve the domain name, it sends a resolution request to the higher-level domain name system level by level;
  • the upper-level domain name system returns the IP address of the global load balancing device to the local domain name system according to its stored address records;
  • the client user sends a TCP connection to the global load balancing device and requests to access data;
  • the global load balancing device returns the HTTP redirected IP based on the optimal database node selected above, that is, the address of the optimal database node;
  • the technology based on HTTP redirection makes full use of the strategy of global load balancing to intelligently select the best database node, so that users can access the most recently running database node.
  • the above steps 1 and 2 use global load balancing to direct the user's access operation to the closest and best running database node in the cloud database system, thereby providing faster response speed and improving user experience.
  • this may lead to cloud
  • the data of each database node in the database system is independent and inconsistent, which violates the basic data consistency principle of the cloud database system. Therefore, it is necessary to synchronize the data between each cloud database node.
  • Step 3 After performing data access operations in each database node in the cloud database system, synchronize the data between each database node.
  • the data synchronization between each database node includes data replication and consistency check operations.
  • a peer-to-peer synchronization mechanism is adopted in the preferred embodiment of the present application.
  • SQL Structured Query Language
  • the SQL capture device only captures the SQL statements that can change the data records in the database node, such as insert, update and other operation types. And filter out the query and other operation types that do not change the statement of the database data.
  • the local database node uses the message queue server to send the captured SQL statement to the remote database node. After the message is received by the remote database node, it performs data consistency operations after parsing, such as data replication or update.
  • the embodiment of this application adopts a strong consistency strategy to define the SQL operation in the active and standby database nodes in the cloud database system as a transaction.
  • the data update operation of the active and standby database nodes is successful, and the entire transaction can be used. Submit, otherwise the transaction will be rolled back if any operation fails, which can effectively ensure strong consistency.
  • the embodiment of this application can also use the final consistency strategy, that is, it is not necessary to wait for the result of the operation of the remote database node, the local database node can submit it directly, and the verification database can be used for the operation failure. check. Therefore, the choice can be made based on the requirements between consistency and availability.
  • the preferred embodiment of the invention proposes a targeted inspection and correction algorithm, including:
  • the check object is composed of operation records, operation timestamps and Boolean identifiers.
  • the operation record is the primary key
  • the operation timestamp is the time of the current operation of the system
  • the boolean identifier is a flag indicating whether the operation is applied to the remote database (the value is set to false by default). If the execution fails, it ends directly.
  • the situation in the verification library at this time if the local cloud database and the remote cloud database have the same data, the flag bits in the verification library are all true. If the local cloud database operation succeeds, but the remote cloud database operation fails, the flag bit of the corresponding operation record is false. If the local database operation fails, but the remote cloud database operation succeeds, the flag bit of the corresponding operation record is also false.
  • the values of the flag bits are all true, it means that the data in the local database and the remote database are exactly the same, and the verification ends. If the flag bit is false and these records exist in the local database, the records need to be inserted into the remote database. Regardless of whether the insertion or deletion is successful, the records with the flag value of true are deleted, which ensures that the local and remote database data are consistent. The remaining records with false flags are redundant data and can be checked in the next check cycle. The verification period can be set according to the actual production situation and server performance.
  • the cloud access program based on global load balancing may also be divided into one or more modules, and the one or more modules are stored in the memory 11 and run by one or more processors. (This embodiment is the processor 12) is executed to complete this application.
  • the module referred to in this application refers to a series of computer program instruction segments that can complete specific functions. It is used to describe the cloud access program based on global load balancing. The execution process in the cloud access device of global load balancing.
  • FIG. 3 a schematic diagram of the program modules of the cloud access program based on global load balancing in an embodiment of the cloud access device based on global load balancing of this application.
  • the cloud access program based on global load balancing The access program can be divided into an optimal database node selection module 10, a redirection module 20, and a data synchronization module 30.
  • an optimal database node selection module 10 a redirection module 20
  • a data synchronization module 30 Illustratively:
  • the best database node selection module 10 is used to select the best database node corresponding to a client user in the cloud database system according to a preset node selection method
  • the preset node selection method includes:
  • test picture test.jpg with a size of about 20KB
  • the client user downloads the pre-stored test picture test.jpg from each database node in the cloud database system according to the address in the speed test script program;
  • V Obtain the operation log of each database node in the cloud database system, and analyze the health information of each database node, including CPU usage, memory usage, and network usage;
  • the database node with the best health information is selected from the multiple candidate database nodes as the best database node.
  • the redirection module 20 is configured to redirect the client user's access to the best database node by using HTTP-based redirection, and perform data access operations on the best database node.
  • the redirection includes:
  • domain name system When the domain name system cannot resolve the domain name, it sends a resolution request to the higher-level domain name system level by level;
  • the upper-level domain name system returns the IP address of the global load balancing device to the local domain name system according to its stored address records;
  • the client user sends a TCP connection to the global load balancing device and requests to access data;
  • the global load balancing device returns the HTTP redirected IP based on the optimal database node selected above, that is, the address of the optimal database node;
  • the data synchronization module 30 is used for synchronizing data between each database node after performing a data access operation in each database node in the cloud database system.
  • the synchronizing data between each database node includes:
  • An SQL capture device is set in the connection driver of each database node in the cloud database system, wherein the SQL capture device only captures SQL statements that can change data records in the database node, and filters out statements that do not change the database data;
  • the captured SQL statement is sent to the remote database node using the message queue server, so that the message is received by the remote database node and then parsed to perform data consistency operations.
  • said synchronizing data between each database node further includes:
  • the SQL operation in the active and standby database nodes in the cloud database system is defined as a transaction.
  • the data update operation of the active and standby database nodes is successful, and the entire transaction can be committed. Otherwise, if any operation fails, the transaction will be rolled back.
  • an embodiment of the present application also proposes a computer-readable storage medium.
  • the computer-readable storage medium stores a cloud access program based on global load balancing.
  • the cloud access program based on global load balancing can be Or multiple processors execute to achieve the following operations:

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请涉及云储存技术领域,公开了一种基于全局负载均衡的云存取方法,该方法包括:在云数据库系统中按照预设的节点选择方法选择一个客户端用户对应的最佳数据库节点;利用基于HTTP的重定向,将客户端用户的访问重定向到该最佳数据库节点,在该最佳数据库节点上执行数据存取操作;在云数据库系统中的各个数据库节点中执行了数据存取操作后,同步各个数据库节点之间的数据。本申请还提出一种基于全局负载均衡的云存取装置以及一种计算机可读存储介质。本申请提供了一种多活高可用的云数据存取方案。

Description

基于全局负载均衡的云存取方法、装置及存储介质
本申请基于巴黎公约申明享有2019年5月8日递交的申请号为CN201910380139.6、名称为“基于全局负载均衡的云存取方法、装置及存储介质”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。
技术领域
本申请涉及云存储技术领域,尤其涉及一种基于全局负载均衡的云存取方法、装置及计算机可读存储介质。
背景技术
目前大多数云数据库采用一主多备的部署架构来提供高可用保障,通过binlog的数据复制技术维护数据一致性。用户只能向主库写入数据,容灾库从主库同步数据。但是,当用户跨区域访问云数据库时,数据经过多次网络转发,容易受到地域、带宽等因素影响而导致高延迟、低可用性的问题,影响用户体验。并且,只有当主库因断电、自然灾害等因素无法使用时,灾备被激活成主库,才能对外提供服务。在正常情况下,灾备库大多时候处于闲置状态,资源使用率极低。因此迫切需要一个多活的并且可以根据用户地域、延时等因素智能选择云数据库节点的高可用云数据库系统。
发明内容
本申请提供一种基于全局负载均衡的云存取方法、装置及计算机可读存储介质,其主要目的在于提供一种多活高可用的云数据库存取方案。
为实现上述目的,本申请提供的一种基于全局负载均衡的云存取方法,包括:
在云数据库系统中按照预设的节点选择方法选择一个客户端用户对应的最佳数据库节点;
利用基于HTTP的重定向,将客户端用户的访问重定向到该最佳数据库节点,在该最佳数据库节点上执行数据存取操作;
在云数据库系统中的各个数据库节点中执行数据存取操作后,同步各个数据库节点之间的数据。
此外,为实现上述目的,本申请还提供一种基于全局负载均衡的云存取装置,该装置包括存储器和处理器,所述存储器中存储有可在所述处理器上运行的基于全局负载均衡的云存取程序,所述基于全局负载均衡的云存取程序被所述处理器执行时实现如下步骤:
在云数据库系统中按照预设的节点选择方法选择一个客户端用户对应的最佳数据库节点;
利用基于HTTP的重定向,将客户端用户的访问重定向到该最佳数据库节点,在该最佳数据库节点上执行数据存取操作;
在云数据库系统中的各个数据库节点中执行了数据存取操作后,同步各个数据库节点之间的数据。
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有基于全局负载均衡的云存取程序,所述基于全局负载均衡的云存取程序可被一个或者多个处理器执行,以实现如上所述的基于全局负载均衡的云存取方法的步骤。
本申请提出的基于全局负载均衡的云存取方法、装置及计算机可读存储介质引入全局负载均衡技术到云数据库系统的资源调度,找出客户端用户对应的最佳数据库节点,然后执行HTTP重定向给客户端用户,实现了基于全局负载均衡的多活高可用云数据库系统。
附图说明
图1为本申请一实施例提供的基于全局负载均衡的云存取方法的流程示意图;
图2为本申请一实施例提供的基于全局负载均衡的云存取装置的内部结构示意图;
图3为本申请一实施例提供的基于全局负载均衡的云存取装置中基于全 局负载均衡的云存取程序的模块示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
本申请提供一种基于全局负载均衡(Global Server Load Balance,GSLB)的云存取方法。参照图1所示,为本申请一实施例提供的基于全局负载均衡的云存取方法的流程示意图。该方法可以由一个装置执行,该装置可以由软件和/或硬件实现。
在本实施例中,基于全局负载均衡的云存取方法包括:
S1、在云数据库系统中按照预设的节点选择方法选择一个客户端用户对应的最佳数据库节点。
本申请较佳实施例中,最佳数据库节点为距离当前有数据存取需求的客户端用户最近且运行状况最佳的云数据库系统中的数据库节点。
详细地,在本实施例中,所述预设的节点选择方法包括:
Ⅰ、在云数据库系统中的每个数据库节点处,分别存放一个大小约为20KB的测试图片test.jpg;
Ⅱ、在云数据库系统的网站主页嵌入一段测速脚本程序,当客户端用户访问所述网站主页时,测速脚本程序被触发,并开始计时;
Ⅲ、客户端用户根据测速脚本程序中的地址,从云数据库系统中的各个数据库节点中下载预存的测试图片test.jpg;
Ⅳ、生成已测速的cookie数据并提交下载所耗时间给云数据库系统中的全局负载均衡设备,并按照所述下载所耗时间从少到多的顺序,选择多个备选数据库节点;
Ⅴ、获取云数据库系统中各个数据库节点的运行日志,分析各个数据库节点的健康信息,如CPU使用率、内存使用率、网络占用率等;
Ⅵ、根据所述健康信息,从所述多个备选数据库节点选择健康信息最佳的数据库节点作为最佳数据库节点。
S2、利用基于HTTP的重定向,将客户端用户的访问重定向到该最佳数据库节点,在该最佳数据库节点上执行数据存取操作。
详细地,在本实施例中,所述重定向包括:
Ⅰ、接收客户端用户在浏览器中输入的域名,本地域名系统对所述域名尝试解析;
Ⅱ、当所述域名系统无法解析所述域名时,逐级向上级域名系统发出解析请求;
Ⅲ、上级域名系统根据其所存储的地址记录,返回全局负载均衡设备所在的IP地址给本地域名系统;
Ⅳ、客户端用户向所述全局负载均衡设备发出TCP连接,并请求存取数据;
Ⅴ、全局负载均衡设备根据上述选择的最佳数据库节点,返回HTTP重定向的IP,即所述最佳数据库节点的地址;
Ⅵ、客户端用户到所述最佳数据库节点执行数据存取操作。
基于HTTP重定向的技术充分利用了全局负载均衡的智能选择最佳数据库节点的策略,从而使用户能能够访问最近的运行状态最佳的数据库节点。
上述步骤S1及S2通过全局负载均衡将用户的访问操作导向云数据库系统中的距离最近、运行状态最佳的数据库节点,从而提供更快的响应速度,改善用户体验,然而,这可能导致云数据库系统中各个数据库节点的数据存在独立、不一致的情况,违背了云数据库系统基本的数据一致性原则,因此需要同步各个云数据库节点之间的数据。
S3、在云数据库系统中的各个数据库节点中执行了数据存取操作后,同步各个数据库节点之间的数据。
本申请较佳实施例中,所述各个数据库节点之间的数据同步包括数据的复制以及一致性校验操作。
为了实现云数据库系统中的各个数据库节点之间的数据的相互复制,本申请较佳实施例中采取了一种对等同步机制。
所述对等同步机制分别在云数据库系统中的各个数据库节点的连接驱动中设置SQL(结构化查询语言,Structured Query Language)捕获器。该SQL捕获器仅捕获能改变数据库节点中数据记录的SQL语句,如插入、更新等操 作类型,并过滤掉查询等操作类型对不改变数据库数据的语句。其中本地数据库节点将捕获到的SQL语句使用消息队列服务器发送给异地数据库节点,消息被异地数据库节点接受后经过解析后执行数据的一致性操作,如数据的复制或者更新等。
在数据一致性策略上,本申请实施例采用强一致性策略,将云数据库系统中的主备数据库节点中的SQL操作定义成一个事务,主备数据库节点数据都更新操作成功,整个事务才可提交,否则有任意一个操作失败都将事务执行回滚操作,这样可以有效的保证强一致性。
如果对系统的可用性要求较高,本申请实施例也可以使用最终一致性策略,即不必等待异地数据库节点操作的结果,本地数据库节点可以直接提交,对于操作失败的情况可以通过校验库来进行校验。因此可以依据一致性与可用性之间的要求进行选择。
针对上述机制可能出现的数据一致性情况,发明较佳实施例提出了针对性的检验纠正算法,包括:
1、本地数据库节点操作完成之后,判断该次操作是否执行成功。若执行成功,在校验库中构造校验对象,校验对象由操作记录、操作时间戳和布尔型标识组成。其中,操作记录为主键,操作时间戳为系统当前操作的时间,布尔型标识为一个表示此操作是否应用到了异地数据库中的标志位(这里值默认设置为false)。若执行失败,直接结束。
2、异地数据库节点操作完成后,判断该次操作是否执行成功。若执行成功,查询校验库,按主键(操作记录)查询,若校验库中存在该记录,更新该记录(将标志位的值false修改为true);若不存在,直接将该记录插入到校验数据库中(标志位的值默认为false)。若执行失败,直接结束。
此时校验库中的情况:若本地云数据库与异地云数据库数据一致,则校验库中标志位都为true。若本地云数据库操作成功,而异地云数据库操作失败,则相应的操作记录的标志位为false。若本地数据库操作失败,而异地云数据库操作操作成功,则相应的操作记录的标志位也为false。
若标志位的值全是true,则说明本地数据库与异地数据库中的数据完全相同,校验结束。若标志位为false,且本地数据库中存在这些记录,则该记录要求插入到异地数据库中。不论插入或者删除执行是否成功,都将标志位值 为true的记录删除,这样保证了本地与异地的数据库数据一致。而剩下的标志位为false的记录是冗余数据,可以留到下一校验周期中校验。校验周期可以按实际生产情况及服务器性能进行设置。
本申请还提供一种基于全局负载均衡的云存取装置。参照图2所示,为本申请一实施例提供的基于全局负载均衡的云存取装置的内部结构示意图。
在本实施例中,基于全局负载均衡的云存取装置1可以是PC(Personal Computer,个人电脑),也可以是智能手机、平板电脑、便携计算机等终端设备。该基于全局负载均衡的云存取装置1至少包括存储器11、处理器12,通信总线13,以及网络接口14。
其中,存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器11在一些实施例中可以是基于全局负载均衡的云存取装置1的内部存储单元,例如该基于全局负载均衡的云存取装置1的硬盘。存储器11在另一些实施例中也可以是基于全局负载均衡的云存取装置1的外部存储设备,例如基于全局负载均衡的云存取装置1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器11还可以既包括基于全局负载均衡的云存取装置1的内部存储单元也包括外部存储设备。存储器11不仅可以用于存储安装于基于全局负载均衡的云存取装置1的应用软件及各类数据,例如基于全局负载均衡的云存取程序01的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。
处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行基于全局负载均衡的云存取程序01等。
通信总线13用于实现这些组件之间的连接通信。
网络接口14可选的可以包括标准的有线接口、无线接口(如WI-FI接口),通常用于在该装置1与其他电子设备之间建立通信连接。
可选地,该装置1还可以包括用户接口,用户接口可以包括显示器 (Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在基于全局负载均衡的云存取装置1中处理的信息以及用于显示可视化的用户界面。
图2仅示出了具有组件11-14以及基于全局负载均衡的云存取程序01的基于全局负载均衡的云存取装置1,本领域技术人员可以理解的是,图1示出的结构并不构成对基于全局负载均衡的云存取装置1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
在图2所示的装置1实施例中,存储器11中存储有基于全局负载均衡的云存取程序01;处理器12执行存储器11中存储的基于全局负载均衡的云存取程序01时实现如下步骤:
步骤一、在云数据库系统中按照预设的节点选择方法选择一个客户端用户对应的最佳数据库节点。
本申请较佳实施例中,最佳数据库节点为距离当前有数据存取需求的客户端用户最近且运行状况最佳的云数据库系统中的数据库节点。
详细地,在本实施例中,所述预设的节点选择方法包括:
Ⅰ、在云数据库系统中的每个数据库节点处,分别存放一个大小约为20KB的测试图片test.jpg;
Ⅱ、在云数据库系统的网站主页嵌入一段测速脚本程序,当客户端用户访问所述网站主页时,测速脚本程序被触发,并开始计时;
Ⅲ、客户端用户根据测速脚本程序中的地址,从云数据库系统中的各个数据库节点中下载预存的测试图片test.jpg;
Ⅳ、生成已测速的cookie数据并提交下载所耗时间给云数据库系统中的全局负载均衡设备,并按照所述下载所耗时间从少到多的顺序,选择多个备选数据库节点;
Ⅴ、获取云数据库系统中各个数据库节点的运行日志,分析各个数据库节点的健康信息,如CPU使用率、内存使用率、网络占用率等;
Ⅵ、根据所述健康信息,从所述多个备选数据库节点选择健康信息最佳 的数据库节点作为最佳数据库节点。
步骤二、利用基于HTTP的重定向,将客户端用户的访问重定向到该最佳数据库节点,在该最佳数据库节点上执行数据存取操作。
详细地,在本实施例中,所述重定向包括:
Ⅰ、接收客户端用户在浏览器中输入的域名,本地域名系统对所述域名尝试解析;
Ⅱ、当所述域名系统无法解析所述域名时,逐级向上级域名系统发出解析请求;
Ⅲ、上级域名系统根据其所存储的地址记录,返回全局负载均衡设备所在的IP地址给本地域名系统;
Ⅳ、客户端用户向所述全局负载均衡设备发出TCP连接,并请求存取数据;
Ⅴ、全局负载均衡设备根据上述选择的最佳数据库节点,返回HTTP重定向的IP,即所述最佳数据库节点的地址;
Ⅵ、客户端用户到所述最佳数据库节点执行数据存取操作。
基于HTTP重定向的技术充分利用了全局负载均衡的智能选择最佳数据库节点的策略,从而使用户能能够访问最近的运行状态最佳的数据库节点。
上述步骤一及步骤二通过全局负载均衡将用户的访问操作导向云数据库系统中的距离最近、运行状态最佳的数据库节点,从而提供更快的响应速度,改善用户体验,然而,这可能导致云数据库系统中各个数据库节点的数据存在独立、不一致的情况,违背了云数据库系统基本的数据一致性原则,因此需要同步各个云数据库节点之间的数据。
步骤三、在云数据库系统中的各个数据库节点中执行了数据存取操作后,同步各个数据库节点之间的数据。
本申请较佳实施例中,所述各个数据库节点之间的数据同步包括数据的复制以及一致性校验操作。
为了实现云数据库系统中的各个数据库节点之间的数据的相互复制,本申请较佳实施例中采取了一种对等同步机制。
所述对等同步机制分别在云数据库系统中的各个数据库节点的连接驱动中设置SQL(结构化查询语言,Structured Query Language)捕获器。该SQL 捕获器仅捕获能改变数据库节点中数据记录的SQL语句,如插入、更新等操作类型。并过滤掉查询等操作类型对不改变数据库数据的语句。其中本地数据库节点将捕获到的SQL语句使用消息队列服务器发送给异地数据库节点,消息被异地数据库节点接受后经过解析后执行数据的一致性操作,如数据的复制或者更新等。
在数据一致性策略上,本申请实施例采用强一致性策略,将云数据库系统中的主备数据库节点中的SQL操作定义成一个事务,主备数据库节点数据都更新操作成功,整个事务才可提交,否则有任意一个操作失败都将事务执行回滚操作,这样可以有效的保证强一致性。
如果对系统的可用性要求较高,本申请实施例也可以使用最终一致性策略,即不必等待异地数据库节点操作的结果,本地数据库节点可以直接提交,对于操作失败的情况可以通过校验库来进行校验。因此可以依据一致性与可用性之间的要求进行选择。
针对上述机制可能出现的数据一致性情况,发明较佳实施例提出了针对性的检验纠正算法,包括:
1、本地数据库节点操作完成之后,判断该次操作是否执行成功。若执行成功,在校验库中构造校验对象,校验对象由操作记录、操作时间戳和布尔型标识组成。其中,操作记录为主键,操作时间戳为系统当前操作的时间,布尔型标识为一个表示此操作是否应用到了异地数据库中的标志位(这里值默认设置为false)。若执行失败,直接结束。
2、异地数据库节点操作完成后,判断该次操作是否执行成功。若执行成功,则查询校验库,按主键(操作记录)查询,若校验库中存在该记录,更新该记录(将标志位的值false修改为true);若不存在,直接将该记录插入到校验数据库中(标志位的值默认为false)。若执行失败,直接结束。
此时校验库中的情况:若本地云数据库与异地云数据库数据一致,则校验库中标志位都为true。若本地云数据库操作成功,而异地云数据库操作失败,则相应的操作记录的标志位为false。若本地数据库操作失败,而异地云数据库操作操作成功,则相应的操作记录的标志位也为false。
若标志位的值全是true,则说明本地数据库与异地数据库中的数据完全相同,校验结束。若标志位为false,且本地数据库中存在这些记录,则该记录 要求插入到异地数据库中。不论插入或者删除执行是否成功,都将标志位值为true的记录删除,这样保证了本地与异地的数据库数据一致。而剩下的标志位为false的记录是冗余数据,可以留到下一校验周期中校验。校验周期可以按实际生产情况及服务器性能进行设置。
可选地,在其他实施例中,基于全局负载均衡的云存取程序还可以被分割为一个或者多个模块,一个或者多个模块被存储于存储器11中,并由一个或多个处理器(本实施例为处理器12)所执行以完成本申请,本申请所称的模块是指能够完成特定功能的一系列计算机程序指令段,用于描述基于全局负载均衡的云存取程序在基于全局负载均衡的云存取装置中的执行过程。
例如,参照图3所示,为本申请基于全局负载均衡的云存取装置一实施例中的基于全局负载均衡的云存取程序的程序模块示意图,该实施例中,基于全局负载均衡的云存取程序可以被分割为最佳数据库节点选择模块10、重定向模块20、数据同步模块30,示例性地:
最佳数据库节点选择模块10用于:在云数据库系统中按照预设的节点选择方法选择一个客户端用户对应的最佳数据库节点;
可选地,所述预设的节点选择方法包括:
Ⅰ、在云数据库系统中的每个数据库节点处,分别存放一个大小约为20KB的测试图片test.jpg;
Ⅱ、在云数据库系统的网站主页嵌入一段测速脚本程序,当客户端用户访问所述网站主页时,测速脚本程序被触发,并开始计时;
Ⅲ、客户端用户根据测速脚本程序中的地址,从云数据库系统中的各个数据库节点中下载预存的测试图片test.jpg;
Ⅳ、生成“已测速”的cookie数据并提交下载所耗时间给云数据库系统中的全局负载均衡设备,并按照所述下载所耗时间从少到多的顺序,选择多个备选数据库节点;
Ⅴ、获取云数据库系统中各个数据库节点的运行日志,分析各个数据库节点的健康信息,包括CPU使用率、内存使用率、网络占用率;
Ⅵ、根据所述健康信息,从所述多个备选数据库节点选择健康信息最佳的数据库节点作为最佳数据库节点。
重定向模块20用于:利用基于HTTP的重定向,将客户端用户的访问重定向到该最佳数据库节点,在该最佳数据库节点上执行数据存取操作。
可选地,所述重定向包括:
Ⅰ、接收客户端用户在浏览器中输入的域名,本地域名系统对所述域名尝试解析;
Ⅱ、当所述域名系统无法解析所述域名时,逐级向上级域名系统发出解析请求;
Ⅲ、上级域名系统根据其所存储的地址记录,返回全局负载均衡设备所在的IP地址给本地域名系统;
Ⅳ、客户端用户向所述全局负载均衡设备发出TCP连接,并请求存取数据;
Ⅴ、全局负载均衡设备根据上述选择的最佳数据库节点,返回HTTP重定向的IP,即所述最佳数据库节点的地址;
Ⅵ、客户端用户到所述最佳数据库节点执行数据存取操作。
数据同步模块30用于:在云数据库系统中的各个数据库节点中执行了数据存取操作后,同步各个数据库节点之间的数据。
可选地,所述同步各个数据库节点之间的数据包括:
在云数据库系统中的各个数据库节点的连接驱动中设置SQL捕获器,其中,所述SQL捕获器仅捕获能改变数据库节点中数据记录的SQL语句,并过滤掉不改变数据库数据的语句;
将捕获到的SQL语句使用消息队列服务器发送给异地数据库节点,使消息被异地数据库节点接受后经过解析后执行数据的一致性操作。
可选地,所述同步各个数据库节点之间的数据还包括:
将云数据库系统中的主备数据库节点中的SQL操作定义成一个事务,主备数据库节点数据都更新操作成功,整个事务才可提交,否则有任意一个操作失败都将事务执行回滚操作。
上述最佳数据库节点选择模块10、重定向模块20、数据同步模块30等程序模块被执行时所实现的功能或操作步骤与上述实施例大体相同,在此不再赘述。
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有基于全局负载均衡的云存取程序,所述基于全局负载均衡的云存取程序可被一个或多个处理器执行,以实现如下操作:
在云数据库系统中按照预设的节点选择方法选择一个客户端用户对应的最佳数据库节点;
利用基于HTTP的重定向,将客户端用户的访问重定向到该最佳数据库节点,在该最佳数据库节点上执行数据存取操作;
在云数据库系统中的各个数据库节点中执行了数据存取操作后,同步各个数据库节点之间的数据。
本申请计算机可读存储介质具体实施方式与上述基于全局负载均衡的云存取装置和方法各实施例基本相同,在此不作累述。
需要说明的是,上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。并且本文中的术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、装置、物品或者方法中还存在另外的相同要素。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。

Claims (20)

  1. 一种基于全局负载均衡的云存取方法,其特征在于,所述方法包括:
    在云数据库系统中按照预设的节点选择方法选择一个客户端用户对应的最佳数据库节点;
    利用基于HTTP的重定向,将客户端用户的访问重定向到该最佳数据库节点,在该最佳数据库节点上执行数据存取操作;
    在云数据库系统中的各个数据库节点中执行数据存取操作后,同步各个数据库节点之间的数据。
  2. 如权利要求1所述的基于全局负载均衡的云存取方法,其特征在于,所述最佳数据库节点为距离当前有数据存取需求的客户端用户最近且运行状况最佳的云数据库系统中的数据库节点。
  3. 如权利要求1所述的基于全局负载均衡的云存取方法,其特征在于,所述预设的节点选择方法包括:
    在云数据库系统中的每个数据库节点处,分别存放一个测试图片test.jpg;
    在云数据库系统的网站主页嵌入一段测速脚本程序,当客户端用户访问所述网站主页时,测速脚本程序被触发,并开始计时;
    客户端用户根据测速脚本程序中的地址,从云数据库系统中的各个数据库节点中下载预存的测试图片test.jpg;
    生成已测速的cookie数据并提交下载所耗时间给云数据库系统中的全局负载均衡设备,并按照所述下载所耗时间从少到多的顺序,选择多个备选数据库节点;
    获取云数据库系统中各个数据库节点的运行日志,分析各个数据库节点的健康信息,包括CPU使用率、内存使用率、网络占用率;
    根据所述健康信息,从所述多个备选数据库节点选择健康信息最佳的数据库节点作为所述最佳数据库节点。
  4. 如权利要求1所述的基于全局负载均衡的云存取方法,其特征在于,所述重定向包括:
    本地域名系统接收客户端用户输入的域名并解析所述域名;
    当所述本地域名系统无法解析所述域名时,逐级向上级域名系统发出解 析请求;
    上级域名系统根据其所存储的地址记录,返回全局负载均衡设备所在的IP地址给本地域名系统;
    客户端用户向所述全局负载均衡设备发出TCP连接,并请求存取数据;
    全局负载均衡设备根据上述选择的最佳数据库节点,返回HTTP重定向的IP,即所述最佳数据库节点的地址;
    客户端用户到所述最佳数据库节点执行数据存取操作。
  5. 如权利要求1至4中任意一项所述的基于全局负载均衡的云存取方法,其特征在于,所述同步各个数据库节点之间的数据包括数据的复制,其中所述数据的复制包括:
    在云数据库系统中的各个数据库节点的连接驱动中设置SQL捕获器,其中,所述SQL捕获器用于捕获能改变数据库节点中数据记录的SQL语句,并过滤掉不改变数据库数据的语句;
    将捕获到的SQL语句使用消息队列服务器发送给异地数据库节点,使消息被异地数据库节点接受并解析后执行数据的一致性操作。
  6. 如权利要求5述的基于全局负载均衡的云存取方法,其特征在于,所述同步各个数据库节点之间的数据还包括数据的一致性校验,其中,所述数据的一致性校验包括:
    将云数据库系统中的主备数据库节点中的SQL操作定义成一个事务,当主备数据库节点数据都成功完成更新操作时,允许提交所述事务,否则有任意一个操作失败则对所述事务执行回滚操作。
  7. 如权利要求6述的基于全局负载均衡的云存取方法,其特征在于,若所述同步各个数据库节点之间的数据的操作对系统的可用性要求较高,则不必等待异地数据库节点操作的结果,本地数据库节点可以直接提交,对于操作失败的情况可以通过校验库来进行校验。
  8. 一种基于全局负载均衡的云存取装置,其特征在于,所述装置包括存储器和处理器,所述存储器上存储有可在所述处理器上运行的基于全局负载均衡的云存取程序,所述基于全局负载均衡的云存取程序被所述处理器执行时实现如下步骤:
    在云数据库系统中按照预设的节点选择方法选择一个客户端用户对应的 最佳数据库节点;
    利用基于HTTP的重定向,将客户端用户的访问重定向到该最佳数据库节点,在该最佳数据库节点上执行数据存取操作;
    在云数据库系统中的各个数据库节点中执行了数据存取操作后,同步各个数据库节点之间的数据。
  9. 如权利要求8所述的基于全局负载均衡的云存取装置,其特征在于,所述最佳数据库节点为距离当前有数据存取需求的客户端用户最近且运行状况最佳的云数据库系统中的数据库节点。
  10. 如权利要求8所述的基于全局负载均衡的云存取装置,其特征在于,所述预设的节点选择方法包括:
    在云数据库系统中的每个数据库节点处,分别存放一个测试图片test.jpg;
    在云数据库系统的网站主页嵌入一段测速脚本程序,当客户端用户访问所述网站主页时,测速脚本程序被触发,并开始计时;
    客户端用户根据测速脚本程序中的地址,从云数据库系统中的各个数据库节点中下载预存的测试图片test.jpg;
    生成已测速的cookie数据并提交下载所耗时间给云数据库系统中的全局负载均衡设备,并按照所述下载所耗时间从少到多的顺序,选择多个备选数据库节点;
    获取云数据库系统中各个数据库节点的运行日志,分析各个数据库节点的健康信息,包括CPU使用率、内存使用率、网络占用率;
    根据所述健康信息,从所述多个备选数据库节点选择健康信息最佳的数据库节点作为所述最佳数据库节点。
  11. 如权利要求8所述的基于全局负载均衡的云存取装置,其特征在于,所述重定向包括:
    本地域名系统接收客户端用户输入的域名,并解析所述域名;
    当所述本地域名系统无法解析所述域名时,逐级向上级域名系统发出解析请求;
    所述上级域名系统根据其所存储的地址记录,返回全局负载均衡设备所在的IP地址给本地域名系统;
    客户端用户向所述全局负载均衡设备发出TCP连接,并请求存取数据;
    全局负载均衡设备根据上述选择的最佳数据库节点,返回HTTP重定向的IP,即所述最佳数据库节点的地址;
    客户端用户到所述最佳数据库节点执行数据存取操作。
  12. 如权利要求8至11中任意一项所述的基于全局负载均衡的云存取装置,其特征在于,所述同步各个数据库节点之间的数据包括:
    在云数据库系统中的各个数据库节点的连接驱动中设置SQL捕获器,其中,所述SQL捕获器用于捕获能改变数据库节点中数据记录的SQL语句,并过滤掉不改变数据库数据的语句;
    将捕获到的SQL语句使用消息队列服务器发送给异地数据库节点,使消息被异地数据库节点接受并解析后执行数据的一致性操作。
  13. 如权利要求12述的基于全局负载均衡的云存取装置,其特征在于,所述同步各个数据库节点之间的数据还包括数据的一致性校验,其中,所述数据的一致性校验包括:
    将云数据库系统中的主备数据库节点中的SQL操作定义成一个事务,当主备数据库节点数据都成功完成更新操作时,允许提交所述事务,否则有任意一个操作失败则对所述事务执行回滚操作。
  14. 如权利要求13述的基于全局负载均衡的云存取装置,其特征在于,若所述同步各个数据库节点之间的数据的操作对系统的可用性要求较高,则不必等待异地数据库节点操作的结果,本地数据库节点可以直接提交,对于操作失败的情况可以通过校验库来进行校验。
  15. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有基于全局负载均衡的云存取程序,所述基于全局负载均衡的云存取程序可被一个或者多个处理器执行,以实现如下步骤:
    在云数据库系统中按照预设的节点选择方法选择一个客户端用户对应的最佳数据库节点;
    利用基于HTTP的重定向,将客户端用户的访问重定向到该最佳数据库节点,在该最佳数据库节点上执行数据存取操作;
    在云数据库系统中的各个数据库节点中执行了数据存取操作后,同步各个数据库节点之间的数据。
  16. 如权利要求15所述的计算机可读存储介质,其特征在于,所述最佳 数据库节点为距离当前有数据存取需求的客户端用户最近且运行状况最佳的云数据库系统中的数据库节点。
  17. 如权利要求15所述的计算机可读存储介质,其特征在于,所述预设的节点选择方法包括:
    在云数据库系统中的每个数据库节点处,分别存放一个测试图片test.jpg;
    在云数据库系统的网站主页嵌入一段测速脚本程序,当客户端用户访问所述网站主页时,测速脚本程序被触发,并开始计时;
    客户端用户根据测速脚本程序中的地址,从云数据库系统中的各个数据库节点中下载预存的测试图片test.jpg;
    生成已测速的cookie数据并提交下载所耗时间给云数据库系统中的全局负载均衡设备,并按照所述下载所耗时间从少到多的顺序,选择多个备选数据库节点;
    获取云数据库系统中各个数据库节点的运行日志,分析各个数据库节点的健康信息,包括CPU使用率、内存使用率、网络占用率;
    根据所述健康信息,从所述多个备选数据库节点选择健康信息最佳的数据库节点作为所述最佳数据库节点。
  18. 如权利要求15所述的计算机可读存储介质,其特征在于,所述重定向包括:
    本地域名系统接收客户端用户输入的域名,并解析所述域名;
    当所述本地域名系统无法解析所述域名时,逐级向上级域名系统发出解析请求;
    所述上级域名系统根据其所存储的地址记录,返回全局负载均衡设备所在的IP地址给本地域名系统;
    客户端用户向所述全局负载均衡设备发出TCP连接,并请求存取数据;
    全局负载均衡设备根据上述选择的最佳数据库节点,返回HTTP重定向的IP,即所述最佳数据库节点的地址;
    客户端用户到所述最佳数据库节点执行数据存取操作。
  19. 如权利要求15至18中任意一项所述的计算机可读存储介质,其特征在于,所述同步各个数据库节点之间的数据包括:
    在云数据库系统中的各个数据库节点的连接驱动中设置SQL捕获器,其 中,所述SQL捕获器用于捕获能改变数据库节点中数据记录的SQL语句,并过滤掉不改变数据库数据的语句;
    将捕获到的SQL语句使用消息队列服务器发送给异地数据库节点,使消息被异地数据库节点接受并解析后执行数据的一致性操作。
  20. 如权利要求19述的计算机可读存储介质,其特征在于,所述同步各个数据库节点之间的数据还包括数据的一致性校验,其中,所述数据的一致性校验包括:
    将云数据库系统中的主备数据库节点中的SQL操作定义成一个事务,当主备数据库节点数据都成功完成更新操作时,允许提交所述事务,否则有任意一个操作失败则对所述事务执行回滚操作。
PCT/CN2019/102193 2019-05-08 2019-08-23 基于全局负载均衡的云存取方法、装置及存储介质 WO2020224098A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910380139.6A CN110225087A (zh) 2019-05-08 2019-05-08 基于全局负载均衡的云存取方法、装置及存储介质
CN201910380139.6 2019-05-08

Publications (1)

Publication Number Publication Date
WO2020224098A1 true WO2020224098A1 (zh) 2020-11-12

Family

ID=67820801

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/102193 WO2020224098A1 (zh) 2019-05-08 2019-08-23 基于全局负载均衡的云存取方法、装置及存储介质

Country Status (2)

Country Link
CN (1) CN110225087A (zh)
WO (1) WO2020224098A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115470303A (zh) * 2022-11-14 2022-12-13 苏州浪潮智能科技有限公司 一种数据库访问方法、装置、系统、设备及可读存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110691124B (zh) * 2019-09-24 2020-11-24 华润网络(深圳)有限公司 一种异地多活架构下数据处理方法及系统
CN111159141A (zh) * 2020-01-02 2020-05-15 中国航空工业集团公司西安航空计算技术研究所 一种去中心化的分布式数据同步方法、分布式节点及系统
CN115866047B (zh) * 2023-01-31 2023-05-05 华控清交信息科技(北京)有限公司 一种多方安全计算中的数据重定向方法、装置及电子设备

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008018969A1 (en) * 2006-08-04 2008-02-14 Parallel Computers Technology, Inc. Apparatus and method of optimizing database clustering with zero transaction loss
CN102510407A (zh) * 2011-11-22 2012-06-20 沈文策 一种对博客进行读、写操作的方法及系统
CN104468777A (zh) * 2014-12-05 2015-03-25 北京奇虎科技有限公司 数据操作方法和装置
CN104468852A (zh) * 2013-09-18 2015-03-25 腾讯科技(北京)有限公司 客户端选择ip链接地址的方法、装置及系统
CN104735088A (zh) * 2015-04-16 2015-06-24 北京金山安全软件有限公司 一种cdn网络中服务器节点调整方法及装置
CN106991190A (zh) * 2017-04-11 2017-07-28 广东浪潮大数据研究有限公司 一种数据库自动创建子数据库系统

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104301415A (zh) * 2014-10-21 2015-01-21 无锡云捷科技有限公司 一种基于http重定向的全局负载均衡方法
CN104270291B (zh) * 2014-10-22 2018-05-01 网宿科技股份有限公司 Cdn网络质量监控方法
CN104572851B (zh) * 2014-12-16 2018-09-07 北京百度网讯科技有限公司 获取推荐信息的方法和装置
CN108108431B (zh) * 2017-12-19 2021-07-23 中国民航信息网络股份有限公司 数据同步方法和系统

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2008018969A1 (en) * 2006-08-04 2008-02-14 Parallel Computers Technology, Inc. Apparatus and method of optimizing database clustering with zero transaction loss
CN102510407A (zh) * 2011-11-22 2012-06-20 沈文策 一种对博客进行读、写操作的方法及系统
CN104468852A (zh) * 2013-09-18 2015-03-25 腾讯科技(北京)有限公司 客户端选择ip链接地址的方法、装置及系统
CN104468777A (zh) * 2014-12-05 2015-03-25 北京奇虎科技有限公司 数据操作方法和装置
CN104735088A (zh) * 2015-04-16 2015-06-24 北京金山安全软件有限公司 一种cdn网络中服务器节点调整方法及装置
CN106991190A (zh) * 2017-04-11 2017-07-28 广东浪潮大数据研究有限公司 一种数据库自动创建子数据库系统

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115470303A (zh) * 2022-11-14 2022-12-13 苏州浪潮智能科技有限公司 一种数据库访问方法、装置、系统、设备及可读存储介质

Also Published As

Publication number Publication date
CN110225087A (zh) 2019-09-10

Similar Documents

Publication Publication Date Title
WO2020224098A1 (zh) 基于全局负载均衡的云存取方法、装置及存储介质
US11032140B2 (en) Using a template to update a stack of resources
US8930409B2 (en) System and method for supporting named operations in a distributed data grid
AU2015401229B2 (en) Website access method, apparatus, and website system
WO2017124938A1 (zh) 一种数据同步方法、装置及系统
US10015226B2 (en) Methods for making AJAX web applications bookmarkable and crawlable and devices thereof
US10979440B1 (en) Preventing serverless application package tampering
US9077681B2 (en) Page loading optimization using page-maintained cache
US11614967B2 (en) Distributed scheduling in a virtual machine environment
US9998544B2 (en) Synchronization testing of active clustered servers
WO2012034537A1 (zh) 一种在线应用系统及其实现方法
WO2017157111A1 (zh) 防止内存数据丢失的的方法、装置和系统
US9253244B1 (en) Subscription based polling for resource updates
CN112463808A (zh) 目标集群的数据处理方法、装置和服务器
WO2013177375A1 (en) Composite graph cache management
WO2022135410A1 (zh) 加载源文件的方法及装置
CN113032477B (zh) 基于gtid的长距离数据同步方法、装置及计算设备
CN113220407B (zh) 故障演练的方法和装置
US10853131B2 (en) Dataflow life cycles
US11017032B1 (en) Document recovery utilizing serialized data
US11537559B2 (en) Client generated aggregated indices
WO2019205345A1 (zh) 用户信息同步方法、装置、计算机装置及存储介质
CN105610908B (zh) 一种基于安卓设备的samba服务实现方法及系统
CN117312448A (zh) 一种集群数据同步方法、系统、存储介质及设备
Fu Data synchronization in a network-volatile mobile ecosystem

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19928123

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19928123

Country of ref document: EP

Kind code of ref document: A1