WO2019061657A1 - Data service method and system - Google Patents

Data service method and system Download PDF

Info

Publication number
WO2019061657A1
WO2019061657A1 PCT/CN2017/108745 CN2017108745W WO2019061657A1 WO 2019061657 A1 WO2019061657 A1 WO 2019061657A1 CN 2017108745 W CN2017108745 W CN 2017108745W WO 2019061657 A1 WO2019061657 A1 WO 2019061657A1
Authority
WO
WIPO (PCT)
Prior art keywords
database
data
data resources
synchronized
real time
Prior art date
Application number
PCT/CN2017/108745
Other languages
French (fr)
Chinese (zh)
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 WO2019061657A1 publication Critical patent/WO2019061657A1/en

Links

Images

Classifications

    • 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
    • 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/25Integrating or interfacing systems involving database management systems
    • 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
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements
    • 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]

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a data service method and system.
  • the existing data service system generally only includes one data center. For the data service system of such a single data center, once the data center is abnormal, the data service system cannot be continuously available, thereby making the reliability of the data service system more reliable. low.
  • the present application provides a data service method and system, which aims to ensure the continuous availability of a data service system and improve the reliability of a data service system.
  • the data service system includes a flow dividing device, a first data center, and a second data center; data resources and second data of the first data center The data resources of the center are synchronized in real time;
  • the offloading device receives an access request of a client
  • the offloading device offloads the access request to one of the first data center and the second data center according to a preset offloading rule
  • the data center that receives the access request in the first data center and the second data center feeds back corresponding data resources to the client according to the access request.
  • the second aspect of the present application further provides a data service method, which is applied to the data service system as described above, where the data service method includes:
  • the offloading device receives the access request of the client
  • the offloading device offloads the access request to one of the first data center and the second data center according to a preset offloading rule
  • the data center that receives the access request in the first data center and the second data center feeds back corresponding data resources to the client according to the access request;
  • the data resource of the first data center and the data resource of the second data center are synchronized in real time.
  • the data service method and system provided by the present application distributes the received access request of the client to the first data center in the data service system according to a preset offloading rule. Any one of the second data centers, and any data center that receives the access request in the data service system may feed back corresponding data resources to the client according to the access request, thereby implementing The dual data center provides services and shunt control for the client at the same time. Further, the databases of the two data centers in the data service system can realize real-time synchronization in different places. On the one hand, the full use of resources avoids the waste of a data center being idle for many years, and doubles the data service capability through resource integration; on the other hand, if one of the data centers is abnormal, the client's access request can be dynamically updated. Switching to another normal running data center is non-aware to the user, ensuring high availability of the data service system and improving the reliability of the data service system.
  • FIG. 1 is a schematic structural diagram of an embodiment of a data service system according to the present application.
  • FIG. 2 is a schematic structural diagram of another embodiment of a data service system according to the present application.
  • FIG. 3 is a partial schematic structural diagram of a database in a data service system of the present application.
  • FIG. 4 is a schematic diagram of another partial architecture in a database in the data service system of the present application.
  • FIG. 5 is a schematic flowchart of an embodiment of a data service method according to an application of the present application.
  • the application provides a data service system.
  • 1 is a schematic structural diagram of a preferred embodiment of a data service system 10 of the present application.
  • the data service system 10 may include, but is not limited to, a first data center 11, a second data center 12, and a shunt device (not shown).
  • the first data center 11 and the second data center 12 in FIG. 1 can be respectively constructed in different geographical locations.
  • the first data center 11 is in Shenzhen and the second data center 12 is in Shanghai.
  • the client 13 in FIG. 1 is connected to the first data center 11 and the second data center 12 via a network.
  • the first data center 11 may include a first server 111 and a first memory 112 for storing data resources
  • the second data center 12 may include a second server 121 and for storing A second memory 122 of the data resource.
  • Both the first memory 112 and the second memory 122 can be network memories.
  • the first server 111 and the second server 121 are respectively connected to the network.
  • the first server 111 is connected to the first memory 112, and the second server 121 is connected to the second memory 122.
  • First server 111 and second server 121 Can be configured based on F5 VS/iRULES, nginx+php, tomcat.
  • the first data center 11 may include a first server 111 and a database
  • the second data center 12 may include a second server 121 and a database.
  • the first server 111 and the second server 121 are respectively connected to the network.
  • the offloading device receives the access request of the client 13, and offloads the access request to one of the first data center 11 and the second data center 12 according to a preset offloading rule.
  • the offloading device can be independently configured in a background server of the network or system, and the shunt device is connected to the first data center 11 and the second data center 12, respectively. Specifically, the shunt device is connected to the first server 111 and the second server 121, respectively. After receiving the access request from the client 13, the offloading device determines the data center corresponding to the access request according to the preset offloading rule, and forwards the access request to the determined data center through the network.
  • the shunt device can also be configured in the first data center 11 and/or the second data center 12.
  • the shunt device is the first server 111 and the second server 121 described above.
  • the access request sent by the client 13 is sent to the first server 111 and the second server 121 via the network, and the first server 111 and the second server 121 respectively determine whether they respond to the access request according to a preset offload rule.
  • the preset shunting rule enables at least one of the first server 111 and the second server 121 to respond to the access request.
  • the preset offloading rule enables one of the first server 111 and the second server 121 to respond to the access request.
  • the offloading device may use the GTM mechanism to offload the access request of the client 13.
  • the preset offload rule can be in the following manner:
  • Method 1 the proportional offload method: the ratio between the number of access requests that are offloaded to the first data center 11 and the number of access requests that are offloaded to the second data center 12 is a preset ratio;
  • the ratio of the number of access requests that are offloaded to the first data center 11 to the number of access requests that are offloaded to the second data center 12 may be X:Y. Where X and Y are both positive integers. Therefore, the number of access requests responded to by the two data centers can be reasonably allocated, and the resources can be reasonably utilized, thereby avoiding a waste of resources in a data center that is idle for a long time, and improving data service capabilities through resource integration.
  • Method 2 the geographical branching method: performing traffic distribution according to the geographic location where the client 13 of the access request is located;
  • the correspondence between the geographic location and the data center can be set in advance.
  • the geographic location corresponding to the first data center 11 may be Nanjing, Beijing, Hangzhou, and the like.
  • the geographic location corresponding to the second data center 12 may be Shenzhen, Guangzhou, Xiamen, and the like.
  • the first data center 11 responds, and the access request is offloaded to the first data center 11.
  • Sent to the client 13 in Shenzhen The access request is responded to by the second data center 12 according to the correspondence, and the access request is offloaded to the second data center 12.
  • the correspondence may be established according to the principle of proximity.
  • the geographic location of the data center can be close to the location of the data center.
  • the method can allocate the access requests responded by the two data centers according to the geographical reason, so that the client 13 can access the data center nearby, utilize resources more reasonably, and improve the data service capability through resource integration.
  • Mode 3 When an abnormality occurs in one of the first data center 11 and the second data center 12, the access request is offloaded to a data center where no abnormality occurs.
  • the data center receiving the access request in the first data center 11 and the second data center 12 feeds back corresponding data resources to the client 13 according to the access request.
  • the first server 111 receives the access request.
  • the first server 111 reads data from the first memory 112 via NFS according to the access request, and feeds back to the client 13 that initiated the access request.
  • the first server 111 receives the access request.
  • the first server 111 reads data from the database according to the access request and feeds back to the client 13 that initiated the access request.
  • the data resources of the first data center 11 and the data resources of the second data center 12 are synchronized in real time.
  • the first server 111 synchronizes the data resources in the first memory 112 to the second memory 122. Specifically, the first server 111 can synchronize the data resources in the first memory 112 to the second memory 122 in real time and remotely through a data mirror backup tool (such as remote synchronize).
  • a data mirror backup tool such as remote synchronize
  • the first data center 11 includes a first database 113 and a second database 114 for storing the data resources
  • the second data center 12 includes a data for storing the data.
  • the first database 113 and the third database 123 may be Redis databases, using "main + From the "mode schema.
  • the first database 113 includes a first primary database and a first secondary database.
  • the third database 123 includes a third primary database and a third secondary database.
  • the second database 114 and the fourth database 124 may be Mysql databases, the second database 114 employs a "master + slave” mode architecture, and the fourth database 124 employs a "slave + slave” mode architecture.
  • the second database 114 includes a second primary database and a second secondary database, and the fourth database 124 includes two fourth secondary databases.
  • the second database 114 synchronizes the data resources to the fourth database 124 via the sql statement.
  • the first server 111 can perform read and write operations on the first database 113 and the second database 114.
  • the second server 121 can perform a read operation on the third database 123 and the fourth database 124.
  • the data resources in the first database 113 are synchronized with the data resources in the second database 114 in real time; the data resources in the third database 123 are synchronized with the data resources in the fourth database 124 in real time;
  • the data resources in the first primary database are synchronized with the data resources in the first slave database in real time;
  • the data resources in the third primary database are synchronized with the data resources in the third slave database in real time;
  • the data resources in the second primary database are synchronized with the data resources in the second slave database in real time; the data resources in the second primary database are synchronized in real time to one of the fourth databases 124 From the database, the data resources in the second slave database are synchronized in real time to another of the fourth slave databases in the fourth database 124.
  • the first data center 11 includes a first database 113 and a second database 114 for storing the data resources
  • the second data center 12 includes a data for storing the data.
  • the first database 113 and the third database 123 may be Redis databases, employing a "master + slave" mode architecture.
  • the first database 113 includes a first primary database and a first secondary database.
  • the third database 123 includes a third primary database and a third secondary database.
  • the second database 114 and the fourth database 124 may be an Oracle database, the second database 114 adopts a "master + slave" mode architecture, and the fourth database 124 employs a "master + slave” mode architecture.
  • the second database 114 includes a second primary database and a second secondary database, and the fourth database 124 includes a fourth primary database and a fourth secondary database.
  • the second database 114 synchronizes the data to the fourth database 124 via DataGuard data synchronization technology.
  • the first server 111 pairs the first database 113 and the second data Library 114 can perform read and write operations.
  • the second server 121 can perform a read operation on the third database 123 and the fourth database 124.
  • the data resources in the first database 113 are synchronized with the data resources in the second database 114 in real time; the data resources in the third database 123 are synchronized with the data resources in the fourth database 124 in real time;
  • the data resources in the first primary database are synchronized with the data resources in the first slave database in real time;
  • the data resources in the third primary database are synchronized with the data resources in the third slave database in real time;
  • the data resources in the second primary database are synchronized with the data resources in the second slave database in real time; the data resources in the fourth primary database are synchronized with the data resources in the fourth slave database in real time; The data resources in the second primary database are synchronized in real time to the fourth primary database.
  • the data service system of this embodiment offloads the access request to one of the first data center 11 and the second data center 12 according to a preset offloading rule by receiving the access request of the client 13 And the data center that receives the access request in the first data center 11 and the second data center 12 feeds back the corresponding data resource to the client 13 according to the access request, so that the data center can be implemented through the dual data center.
  • Off-site applications provide services, offload control, and read-write separation, and the databases in the two data centers can be synchronized in real time.
  • the full use of resources avoids the waste of a data center being idle for many years, and doubles the data service capability through resource integration; on the other hand, if one of the data centers is abnormal, the GTM mechanism can detect it in real time. Abnormally, the user's access request is dynamically switched to another normal running data center, which is non-aware to the user, guarantees high availability for the data service system, and improves the reliability of the data service system.
  • the application further provides a data service method.
  • the data service method is implemented based on the data service system described in the foregoing embodiment. For details of the data service system, reference may be made to the foregoing embodiments, and details are not described herein.
  • FIG. 5 is a schematic flowchart of an embodiment of a data service method according to an application.
  • the data service method comprises:
  • Step S10 The offloading device receives an access request of the client.
  • Step S20 The offloading device offloads the access request to one of the first data center and the second data center according to a preset offloading rule.
  • the shunt device can be independently configured on a network or a system.
  • the back-end server is connected to the first data center and the second data center.
  • the shunt device is respectively connected to the first server and the second server.
  • the traffic distribution device After receiving the access request from the client, the traffic distribution device determines the data center corresponding to the access request according to the preset traffic distribution rule, and forwards the access request to the determined data center through the network.
  • the shunt device may also be configured in the first data center and/or the second data center.
  • the shunt device is the first server and the second server.
  • the access request sent by the client is sent to the first server and the second server respectively via the network, and the first server and the second server respectively determine whether they respond to the access request according to the preset offload rule.
  • the preset shunting rule enables at least one of the first server and the second server to respond to the access request.
  • the preset offloading rule enables one of the first server and the second server to respond to the access request.
  • the offloading device may use a GTM mechanism to offload client access requests.
  • the preset offload rule can be in the following manner:
  • Method 1 the proportional offload method: the ratio between the number of access requests that are offloaded to the first data center and the number of access requests that are offloaded to the second data center is a preset ratio;
  • the ratio of the number of access requests diverted to the first data center to the number of access requests diverted to the second data center may be X:Y. Where X and Y are both positive integers. Therefore, the number of access requests responded to by the two data centers can be reasonably allocated, and the resources can be reasonably utilized, thereby avoiding a waste of resources in a data center that is idle for a long time, and improving data service capabilities through resource integration.
  • Method 2 the geographical branching method: performing traffic distribution according to the geographical location of the client where the access request is located;
  • the correspondence between the geographic location and the data center can be set in advance.
  • the geographic location corresponding to the first data center may be Nanjing, Beijing, Hangzhou, and the like.
  • the geographic location corresponding to the second data center may be Shenzhen, Guangzhou, Xiamen, and the like.
  • the first data center responds, and the access request is offloaded to the first data center.
  • the second data center responds, and the access request is offloaded to the second data center.
  • the correspondence may be established according to the principle of proximity.
  • the geographic location of the data center can be close to the location of the data center.
  • the access requests responded by the two data centers can be allocated according to the geographical location, so that the client can access the data center nearby, utilize resources more rationally, and improve data service capability through resource integration.
  • Mode 3 When an abnormality occurs in one of the first data center and the second data center, the access request is offloaded to a data center where no abnormality occurs.
  • Step S30 The data center that receives the access request in the first data center and the second data center feeds back corresponding data resources to the client according to the access request.
  • the first server receives the access request.
  • the first server reads data from the first memory through NFS according to the access request, and feeds back to the client that initiated the access request.
  • the first server receives the access request.
  • the first server reads data from the database according to the access request and feeds back to the client that initiated the access request.
  • the data resources of the first data center and the data resources of the second data center are synchronized in real time.
  • the data service method of this embodiment by accessing the received access request of the client according to a preset offloading rule, to the one of the first data center and the second data center, and the The data center that receives the access request in the first data center and the second data center feeds back the corresponding data resource to the client according to the access request, so that the dual data center can realize the off-site application and provide the service and the offload simultaneously. Control and read-write separation, and the database of the two data centers can achieve real-time synchronization in different places.
  • the full use of resources avoids the waste of a data center being idle for many years, and doubles the data service capability through resource integration; on the other hand, if one of the data centers is abnormal, the GTM mechanism can detect it in real time. Abnormally, the user's access request is dynamically switched to another normal running data center, which is non-aware to the user, guarantees high availability for the data service system, and improves the reliability of the data service.
  • the method further includes: when the data stored in the first memory changes, A server synchronizes data resources in the first memory to a second memory.
  • the first server may synchronize the data resources in the first memory to the second memory in real time through a data mirror backup tool (such as remote synchronize).
  • the database has the following two implementation manners:
  • the first data center includes a first database and a second database for storing the data resource
  • the second data center includes a third for storing the data resource.
  • Database and fourth database are examples of database
  • the first database and the third database may be Redis databases, using a "master + slave" mode architecture.
  • the first database includes a first primary database and a first secondary database.
  • the third database includes a third primary database and a third secondary database.
  • the second database and the fourth database may be Mysql databases, the second database adopts a "master + slave” mode architecture, and the fourth database adopts a "slave + slave” mode architecture.
  • the second database includes a second primary database and a second secondary database, and the fourth database includes two fourth secondary databases.
  • the second database synchronizes the data resources to the fourth database through the sql statement.
  • the first server can perform read and write operations on the first database and the second database.
  • the second server can perform read operations on the third database and the fourth database.
  • the data service method further includes:
  • the data resources in the first database are synchronized with the data resources in the second database in real time; the data resources in the third database are synchronized with the data resources in the fourth database in real time;
  • the data resources in the first primary database are synchronized with the data resources in the first slave database in real time;
  • the data resources in the third primary database are synchronized with the data resources in the third slave database in real time;
  • the data resources in the second primary database are synchronized with the data resources in the second slave database in real time; the data resources in the second primary database are synchronized in real time to one of the fourth slaves in the fourth database In the database, the data resources in the second slave database are synchronized in real time to another fourth slave database in the fourth database.
  • the first data center includes a first database and a second database for storing the data resource
  • the second data center includes a third for storing the data resource Database and fourth database.
  • the first database and the third database may be Redis databases, using a "master + slave" mode architecture.
  • the first database includes a first primary database and a first secondary database.
  • the third database includes a third primary database and a third secondary database.
  • the second database and the fourth database may be an Oracle database, and second The database adopts the "master + slave” mode architecture, and the fourth database adopts the "master + slave” mode architecture.
  • the second database includes a second primary database and a second secondary database, and the fourth database includes a fourth primary database and a fourth secondary database.
  • the second database synchronizes the data to the fourth database via DataGuard data synchronization technology.
  • the first server can perform read and write operations on the first database and the second database.
  • the second server can perform read operations on the third database and the fourth database.
  • the data service method further includes:
  • the data resources in the first database are synchronized with the data resources in the second database in real time; the data resources in the third database are synchronized with the data resources in the fourth database in real time;
  • the data resources in the first primary database are synchronized with the data resources in the first slave database in real time;
  • the data resources in the third primary database are synchronized with the data resources in the third slave database in real time;
  • the data resources in the second primary database are synchronized with the data resources in the second slave database in real time; the data resources in the fourth primary database are synchronized with the data resources in the fourth slave database in real time; The data resources in the second primary database are synchronized in real time to the fourth primary database.

Landscapes

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

Abstract

Disclosed in the present application are a data service method and system. The method comprises: a distributing device receives an access request of a client; the distributing device distributes the access request to one of a first data center and a second data center according to a preset distributing rule; the data center receiving the access request in the first data center and the second data center feeds back a corresponding data resource to the client according to the access request. By means of the present application, service and distributing control can be provided for a client at the same time by means of double data centers; the high availability of the data service system is guaranteed; and the reliability of the data service system is enhanced.

Description

数据服务方法及系统Data service method and system
本申请基于巴黎公约申明享有2017年9月30日递交的申请号为CN 201710915082.6、名称为“数据服务方法及系统”中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。This application is based on the priority of the Paris Convention on the application of the Chinese Patent Application No. CN 201710915082.6, entitled "Data Service Method and System", filed on September 30, 2017, the entire contents of which are incorporated by reference. In this application.
技术领域Technical field
本申请涉及计算机技术领域,尤其涉及一种数据服务方法及系统。The present application relates to the field of computer technologies, and in particular, to a data service method and system.
背景技术Background technique
现有的数据服务系统一般仅包括一个数据中心,对于这种单数据中心的数据服务系统,一旦整个数据中心出现异常,则无法保障数据服务系统的持续可用,从而造成数据服务系统的可靠性较低。The existing data service system generally only includes one data center. For the data service system of such a single data center, once the data center is abnormal, the data service system cannot be continuously available, thereby making the reliability of the data service system more reliable. low.
发明内容Summary of the invention
本申请提供一种数据服务方法及系统,旨在保障数据服务系统的持续可用,提高数据服务系统的可靠性。The present application provides a data service method and system, which aims to ensure the continuous availability of a data service system and improve the reliability of a data service system.
为实现上述目的,本申请第一方面提供的一种数据服务系统,所述数据服务系统包括分流装置、第一数据中心和第二数据中心;所述第一数据中心的数据资源和第二数据中心的数据资源实时同步;To achieve the above objective, a data service system provided by the first aspect of the present application, the data service system includes a flow dividing device, a first data center, and a second data center; data resources and second data of the first data center The data resources of the center are synchronized in real time;
所述分流装置接收客户端的访问请求;The offloading device receives an access request of a client;
所述分流装置根据预设的分流规则将所述访问请求分流至所述第一数据中心和所述第二数据中心中的一个;The offloading device offloads the access request to one of the first data center and the second data center according to a preset offloading rule;
所述第一数据中心和第二数据中心中接收到所述访问请求的数据中心根据所述访问请求,向所述客户端反馈对应的数据资源。The data center that receives the access request in the first data center and the second data center feeds back corresponding data resources to the client according to the access request.
此外,为实现上述目的,本申请第二方面还提供一种数据服务方法,应用于如上所述的数据服务系统,所述数据服务方法包括:In addition, to achieve the above object, the second aspect of the present application further provides a data service method, which is applied to the data service system as described above, where the data service method includes:
分流装置接收客户端的访问请求;The offloading device receives the access request of the client;
所述分流装置根据预设的分流规则将所述访问请求分流至第一数据中心和第二数据中心中的一个;The offloading device offloads the access request to one of the first data center and the second data center according to a preset offloading rule;
所述第一数据中心和第二数据中心中接收到所述访问请求的数据中心根据所述访问请求,向所述客户端反馈对应的数据资源;And the data center that receives the access request in the first data center and the second data center feeds back corresponding data resources to the client according to the access request;
其中,所述第一数据中心的数据资源和第二数据中心的数据资源实时同步。The data resource of the first data center and the data resource of the second data center are synchronized in real time.
本申请提出的数据服务方法及系统,通过将接收到的客户端的访问请求根据预设的分流规则分流至数据服务系统中第一数据中心和 所述第二数据中心的任意一个,并且所述数据服务系统中接收到所述访问请求的任意一个数据中心可根据所述访问请求,向所述客户端反馈对应的数据资源,从而可以实现通过双数据中心为客户端同时提供服务、分流控制,进一步地,所述数据服务系统中的两个数据中心的数据库可以实现异地实时同步。一方面充分利用资源,避免了一个数据中心常年处于闲置状态而造成浪费,通过资源整合,双倍提升了数据服务能力;另一方面,如果其中一个数据中心发生异常,可将客户端的访问请求动态切换到另外一个正常运行的数据中心,对用户来说是无感知的,保障了数据服务系统的高可用性,提高了数据服务系统的可靠性。The data service method and system provided by the present application distributes the received access request of the client to the first data center in the data service system according to a preset offloading rule. Any one of the second data centers, and any data center that receives the access request in the data service system may feed back corresponding data resources to the client according to the access request, thereby implementing The dual data center provides services and shunt control for the client at the same time. Further, the databases of the two data centers in the data service system can realize real-time synchronization in different places. On the one hand, the full use of resources avoids the waste of a data center being idle for many years, and doubles the data service capability through resource integration; on the other hand, if one of the data centers is abnormal, the client's access request can be dynamically updated. Switching to another normal running data center is non-aware to the user, ensuring high availability of the data service system and improving the reliability of the data service system.
附图说明DRAWINGS
图1为本申请数据服务系统一实施例的架构示意图;1 is a schematic structural diagram of an embodiment of a data service system according to the present application;
图2为本申请数据服务系统另一实施例的架构示意图;2 is a schematic structural diagram of another embodiment of a data service system according to the present application;
图3为本申请数据服务系统中的数据库的一局部架构示意图;3 is a partial schematic structural diagram of a database in a data service system of the present application;
图4为本申请数据服务系统中的数据库中的另一局部架构示意图;4 is a schematic diagram of another partial architecture in a database in the data service system of the present application;
图5为本申请数据服务方法一实施例的流程示意图。FIG. 5 is a schematic flowchart of an embodiment of a data service method according to an application of the present application.
具体实施方式Detailed ways
为了使本申请所要解决的技术问题、技术方案及有益效果更加清楚、明白,以下结合附图和实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the technical problems, technical solutions and beneficial effects to be solved by the present application clearer and clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
本申请提供一种数据服务系统。请参阅图1是本申请数据服务系统10较佳实施例的架构示意图。The application provides a data service system. 1 is a schematic structural diagram of a preferred embodiment of a data service system 10 of the present application.
在本实施例中,所述的数据服务系统10可包括,但不仅限于,第一数据中心11,第二数据中心12和分流装置(图中未示出)。In this embodiment, the data service system 10 may include, but is not limited to, a first data center 11, a second data center 12, and a shunt device (not shown).
如图1中的第一数据中心11和第二数据中心12,可以分别架构于不同的地理位置,例如,第一数据中心11在深圳,第二数据中心12在上海。图1中客户端13通过网络与第一数据中心11和第二数据中心12连接。The first data center 11 and the second data center 12 in FIG. 1 can be respectively constructed in different geographical locations. For example, the first data center 11 is in Shenzhen and the second data center 12 is in Shanghai. The client 13 in FIG. 1 is connected to the first data center 11 and the second data center 12 via a network.
在一实施例中,如图1所示,第一数据中心11可以包括第一服务器111和用于存储数据资源的第一存储器112,第二数据中心12可以包括第二服务器121和用于存储数据资源的第二存储器122。第一存储器112和第二存储器122均可以为网络存储器。第一服务器111和第二服务器121分别与网络连接。第一服务器111和第一存储器112连接,第二服务器121和第二存储器122连接。第一服务器111和第二服务器121 可以基于F5 VS/iRULES、nginx+php、tomcat配置。In an embodiment, as shown in FIG. 1, the first data center 11 may include a first server 111 and a first memory 112 for storing data resources, and the second data center 12 may include a second server 121 and for storing A second memory 122 of the data resource. Both the first memory 112 and the second memory 122 can be network memories. The first server 111 and the second server 121 are respectively connected to the network. The first server 111 is connected to the first memory 112, and the second server 121 is connected to the second memory 122. First server 111 and second server 121 Can be configured based on F5 VS/iRULES, nginx+php, tomcat.
在另一实施例中,如图2所示,第一数据中心11可以包括第一服务器111和数据库,第二数据中心12可以包括第二服务器121和数据库。第一服务器111和第二服务器121分别与网络连接。In another embodiment, as shown in FIG. 2, the first data center 11 may include a first server 111 and a database, and the second data center 12 may include a second server 121 and a database. The first server 111 and the second server 121 are respectively connected to the network.
所述分流装置接收客户端13的访问请求,并根据预设的分流规则将所述访问请求分流至所述第一数据中心11和所述第二数据中心12中的一个。The offloading device receives the access request of the client 13, and offloads the access request to one of the first data center 11 and the second data center 12 according to a preset offloading rule.
在一种可选的实施例中,所述分流装置可以独立配置于网络或系统的后台服务器中,且该分流装置分别与第一数据中心11和第二数据中心12连接。具体的,该分流装置分别与第一服务器111和第二服务器121连接。该分流装置接收到客户端13的访问请求后,根据预设的分流规则确定该访问请求所对应的数据中心,并通过网络将该访问请求转发至确定的数据中心中。In an optional embodiment, the offloading device can be independently configured in a background server of the network or system, and the shunt device is connected to the first data center 11 and the second data center 12, respectively. Specifically, the shunt device is connected to the first server 111 and the second server 121, respectively. After receiving the access request from the client 13, the offloading device determines the data center corresponding to the access request according to the preset offloading rule, and forwards the access request to the determined data center through the network.
或者,在另一种可选的实施例中,该分流装置还可以配置于第一数据中心11和/或第二数据中心12中。例如,该分流装置即为上述第一服务器111和第二服务器121。客户端13发送的访问请求经由网络,分别发送至第一服务器111和第二服务器121,由第一服务器111和第二服务器121分别根据预设的分流规则确定自身是否响应该访问请求。可以理解的是,该预设的分流规则使得第一服务器111和第二服务器121中的至少一个可以响应该访问请求。该预设的分流规则使得第一服务器111和第二服务器121中的其中一个可以响应该访问请求。Alternatively, in another alternative embodiment, the shunt device can also be configured in the first data center 11 and/or the second data center 12. For example, the shunt device is the first server 111 and the second server 121 described above. The access request sent by the client 13 is sent to the first server 111 and the second server 121 via the network, and the first server 111 and the second server 121 respectively determine whether they respond to the access request according to a preset offload rule. It can be understood that the preset shunting rule enables at least one of the first server 111 and the second server 121 to respond to the access request. The preset offloading rule enables one of the first server 111 and the second server 121 to respond to the access request.
所述分流装置可以采用GTM机制对客户端13的访问请求进行分流。该预设的分流规则可以采用以下方式:The offloading device may use the GTM mechanism to offload the access request of the client 13. The preset offload rule can be in the following manner:
方式1,比例分流法:分流至所述第一数据中心11的访问请求数量与分流至所述第二数据中心12的访问请求数量之间的比值为预设比值;Method 1, the proportional offload method: the ratio between the number of access requests that are offloaded to the first data center 11 and the number of access requests that are offloaded to the second data center 12 is a preset ratio;
例如,分流至第一数据中心11的访问请求数量与分流至第二数据中心12的访问请求数量之比可以为X:Y。其中,X和Y均为正整数。从而可以合理的分配两个数据中心所响应的访问请求的数量,合理利用资源,避免了一个数据中心常年处于闲置状态而造成资源浪费,通过资源整合,提升了数据服务能力。For example, the ratio of the number of access requests that are offloaded to the first data center 11 to the number of access requests that are offloaded to the second data center 12 may be X:Y. Where X and Y are both positive integers. Therefore, the number of access requests responded to by the two data centers can be reasonably allocated, and the resources can be reasonably utilized, thereby avoiding a waste of resources in a data center that is idle for a long time, and improving data service capabilities through resource integration.
方式2,地域分流法:根据所述访问请求的客户端13所在的地理位置进行分流;Method 2, the geographical branching method: performing traffic distribution according to the geographic location where the client 13 of the access request is located;
可以预先设置地理位置和数据中心的对应关系。例如,第一数据中心11对应的地理位置可以为南京、北京、杭州等等。第二数据中心12对应的地理位置可以为深圳、广州、厦门等等。对于南京的客户端13所发送的访问请求,根据该对应关系,则由第一数据中心11响应,则将该访问请求分流至第一数据中心11。对于深圳的客户端13所发送 的访问请求,根据该对应关系,则由第二数据中心12响应,则将该访问请求分流至第二数据中心12。The correspondence between the geographic location and the data center can be set in advance. For example, the geographic location corresponding to the first data center 11 may be Nanjing, Beijing, Hangzhou, and the like. The geographic location corresponding to the second data center 12 may be Shenzhen, Guangzhou, Xiamen, and the like. For the access request sent by the client 13 of Nanjing, according to the correspondence, the first data center 11 responds, and the access request is offloaded to the first data center 11. Sent to the client 13 in Shenzhen The access request is responded to by the second data center 12 according to the correspondence, and the access request is offloaded to the second data center 12.
可选地,可以根据就近原则建立该对应关系。数据中心所对应的地理位置可以靠近该数据中心的所在地。Alternatively, the correspondence may be established according to the principle of proximity. The geographic location of the data center can be close to the location of the data center.
该方式可以根据地域合理的分配两个数据中心所响应的访问请求,使得客户端13能够就近访问数据中心,更加合理的利用资源,通过资源整合,提升了数据服务能力。The method can allocate the access requests responded by the two data centers according to the geographical reason, so that the client 13 can access the data center nearby, utilize resources more reasonably, and improve the data service capability through resource integration.
方式3,所述第一数据中心11和第二数据中心12中的其中一个发生异常时,将所述访问请求分流至未发生异常的数据中心。Mode 3: When an abnormality occurs in one of the first data center 11 and the second data center 12, the access request is offloaded to a data center where no abnormality occurs.
例如,若第一数据中心11发生异常,则将所有访问请求分流至第二数据中心12。该分流的切换对于客户端13来说是无感知的,从而保障了数据服务系统的高可用性。For example, if an abnormality occurs in the first data center 11, all access requests are offloaded to the second data center 12. The switching of the offload is not perceptible to the client 13, thereby ensuring high availability of the data service system.
所述第一数据中心11和第二数据中心12中接收到所述访问请求的数据中心根据所述访问请求,向所述客户端13反馈对应的数据资源。The data center receiving the access request in the first data center 11 and the second data center 12 feeds back corresponding data resources to the client 13 according to the access request.
以下以第一数据中心11接收到了所述访问请求为例:The following takes the access request by the first data center 11 as an example:
对于图1所示的数据服务系统来说,第一服务器111接收到该访问请求。该第一服务器111根据访问请求通过NFS从第一存储器112中读取数据,并反馈给发起该访问请求的客户端13。For the data service system shown in FIG. 1, the first server 111 receives the access request. The first server 111 reads data from the first memory 112 via NFS according to the access request, and feeds back to the client 13 that initiated the access request.
对于图2所示的数据服务系统来说,第一服务器111接收到该访问请求。该第一服务器111根据访问请求从数据库中读取数据,并反馈给发起该访问请求的客户端13。For the data service system shown in FIG. 2, the first server 111 receives the access request. The first server 111 reads data from the database according to the access request and feeds back to the client 13 that initiated the access request.
所述第一数据中心11的数据资源和第二数据中心12的数据资源实时同步。The data resources of the first data center 11 and the data resources of the second data center 12 are synchronized in real time.
对于图1所示的数据服务系统来说,当第一存储器112中存储的数据发生变化时,第一服务器111将所述第一存储器112中的数据资源同步至第二存储器122。具体的,第一服务器111可以通过数据镜像备份工具(如remote synchronize)将第一存储器112中的数据资源实时、远程的同步到第二存储器122中。For the data service system shown in FIG. 1, when the data stored in the first memory 112 changes, the first server 111 synchronizes the data resources in the first memory 112 to the second memory 122. Specifically, the first server 111 can synchronize the data resources in the first memory 112 to the second memory 122 in real time and remotely through a data mirror backup tool (such as remote synchronize).
采用上述同步策略,可以有效地保证在其中一个数据中心发生异常时,能够将访问请求分流至正常工作的数据中心。该分流的切换对于客户端13来说是无感知的,保障了数据服务系统的高可用性。By adopting the above synchronization strategy, it is possible to effectively ensure that when an abnormality occurs in one of the data centers, the access request can be offloaded to the data center that is working normally. The switching of the offload is non-aware to the client 13, ensuring high availability of the data service system.
对于图2所示的数据服务系统来说,其数据库具有以下两种实施方式:For the data service system shown in Figure 2, its database has the following two implementations:
实施方式一,如图2所示,所述第一数据中心11包括用于存储所述数据资源的第一数据库113和第二数据库114,所述第二数据中心12包括用于存储所述数据资源的第三数据库123和第四数据库124。Embodiment 1, as shown in FIG. 2, the first data center 11 includes a first database 113 and a second database 114 for storing the data resources, and the second data center 12 includes a data for storing the data. The third database 123 and the fourth database 124 of resources.
第一数据库113和第三数据库123可以为Redis数据库,采用“主+ 从”模式架构。所述第一数据库113包括第一主数据库和第一从数据库。所述第三数据库123包括第三主数据库和第三从数据库。The first database 113 and the third database 123 may be Redis databases, using "main + From the "mode schema. The first database 113 includes a first primary database and a first secondary database. The third database 123 includes a third primary database and a third secondary database.
如图3所示,第二数据库114和第四数据库124可以为Mysql数据库,第二数据库114采用“主+从”模式架构,第四数据库124采用“从+从”模式架构。所述第二数据库114包括第二主数据库和第二从数据库,所述第四数据库124包括两个第四从数据库。As shown in FIG. 3, the second database 114 and the fourth database 124 may be Mysql databases, the second database 114 employs a "master + slave" mode architecture, and the fourth database 124 employs a "slave + slave" mode architecture. The second database 114 includes a second primary database and a second secondary database, and the fourth database 124 includes two fourth secondary databases.
第二数据库114通过sql语句将数据资源同步至第四数据库124。The second database 114 synchronizes the data resources to the fourth database 124 via the sql statement.
在第一数据中心11,第一服务器111对第一数据库113和第二数据库114可进行读、写操作。在第二数据中心12,第二服务器121对第三数据库123和第四数据库124可进行读操作。In the first data center 11, the first server 111 can perform read and write operations on the first database 113 and the second database 114. In the second data center 12, the second server 121 can perform a read operation on the third database 123 and the fourth database 124.
所述第一数据库113中的数据资源与所述第二数据库114中的数据资源实时同步;所述第三数据库123中的数据资源与所述第四数据库124中的数据资源实时同步;The data resources in the first database 113 are synchronized with the data resources in the second database 114 in real time; the data resources in the third database 123 are synchronized with the data resources in the fourth database 124 in real time;
所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The data resources in the first primary database are synchronized with the data resources in the first slave database in real time; the data resources in the third primary database are synchronized with the data resources in the third slave database in real time;
所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;所述第二主数据库中的数据资源实时同步至所述第四数据库124中的一个所述第四从数据库中,所述第二从数据库中的数据资源实时同步至所述第四数据库124中的另一个所述第四从数据库中。The data resources in the second primary database are synchronized with the data resources in the second slave database in real time; the data resources in the second primary database are synchronized in real time to one of the fourth databases 124 From the database, the data resources in the second slave database are synchronized in real time to another of the fourth slave databases in the fourth database 124.
通过在第一数据中心11和第二数据中心12均设置多个数据库,并且采用上述同步策略,可以有效地保证在其中一个数据中心发生异常时,能够将访问请求分流至正常工作的数据中心。该分流的切换对于客户端13来说是无感知的,保障了数据服务系统的高可用性。By setting a plurality of databases in both the first data center 11 and the second data center 12, and adopting the above synchronization strategy, it is possible to effectively ensure that when an abnormality occurs in one of the data centers, the access request can be offloaded to the data center that is working normally. The switching of the offload is non-aware to the client 13, ensuring high availability of the data service system.
实施方式二,如图2所示,所述第一数据中心11包括用于存储所述数据资源的第一数据库113和第二数据库114,所述第二数据中心12包括用于存储所述数据资源的第三数据库123和第四数据库124。Embodiment 2, as shown in FIG. 2, the first data center 11 includes a first database 113 and a second database 114 for storing the data resources, and the second data center 12 includes a data for storing the data. The third database 123 and the fourth database 124 of resources.
第一数据库113和第三数据库123可以为Redis数据库,采用“主+从”模式架构。所述第一数据库113包括第一主数据库和第一从数据库。所述第三数据库123包括第三主数据库和第三从数据库。The first database 113 and the third database 123 may be Redis databases, employing a "master + slave" mode architecture. The first database 113 includes a first primary database and a first secondary database. The third database 123 includes a third primary database and a third secondary database.
如图4所示,第二数据库114和第四数据库124可以为Oracle数据库,第二数据库114采用“主+从”模式架构,第四数据库124采用“主+从”模式架构。所述第二数据库114包括第二主数据库和第二从数据库,所述第四数据库124包括第四主数据库和第四从数据库。As shown in FIG. 4, the second database 114 and the fourth database 124 may be an Oracle database, the second database 114 adopts a "master + slave" mode architecture, and the fourth database 124 employs a "master + slave" mode architecture. The second database 114 includes a second primary database and a second secondary database, and the fourth database 124 includes a fourth primary database and a fourth secondary database.
第二数据库114通过DataGuard数据同步技术将数据同步至第四数据库124。The second database 114 synchronizes the data to the fourth database 124 via DataGuard data synchronization technology.
在第一数据中心11,第一服务器111对第一数据库113和第二数据 库114可进行读、写操作。在第二数据中心12,第二服务器121对第三数据库123和第四数据库124可进行读操作。In the first data center 11, the first server 111 pairs the first database 113 and the second data Library 114 can perform read and write operations. In the second data center 12, the second server 121 can perform a read operation on the third database 123 and the fourth database 124.
所述第一数据库113中的数据资源与所述第二数据库114中的数据资源实时同步;所述第三数据库123中的数据资源与所述第四数据库124中的数据资源实时同步;The data resources in the first database 113 are synchronized with the data resources in the second database 114 in real time; the data resources in the third database 123 are synchronized with the data resources in the fourth database 124 in real time;
所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The data resources in the first primary database are synchronized with the data resources in the first slave database in real time; the data resources in the third primary database are synchronized with the data resources in the third slave database in real time;
所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;所述第四主数据库中的数据资源与所述第四从数据库中的数据资源实时同步;所述第二主数据库中的数据资源实时同步至所述第四主数据库中。The data resources in the second primary database are synchronized with the data resources in the second slave database in real time; the data resources in the fourth primary database are synchronized with the data resources in the fourth slave database in real time; The data resources in the second primary database are synchronized in real time to the fourth primary database.
通过在第一数据中心11和第二数据中心12均设置多个数据库,并且采用上述同步策略,可以有效地保证在其中一个数据中心发生异常时,能够将访问请求分流至正常工作的数据中心。该分流的切换对于客户端13来说是无感知的,保障了数据服务系统的高可用性。By setting a plurality of databases in both the first data center 11 and the second data center 12, and adopting the above synchronization strategy, it is possible to effectively ensure that when an abnormality occurs in one of the data centers, the access request can be offloaded to the data center that is working normally. The switching of the offload is non-aware to the client 13, ensuring high availability of the data service system.
本实施例的数据服务系统,通过将接收到的客户端13的访问请求根据预设的分流规则将所述访问请求分流至所述第一数据中心11和所述第二数据中心12中的一个,并且所述第一数据中心11和第二数据中心12中接收到所述访问请求的数据中心根据所述访问请求,向所述客户端13反馈对应的数据资源,从而可以通过双数据中心实现异地应用同时提供服务、分流控制和读写分离,且两个数据中心的数据库可以实现异地实时同步。一方面充分利用资源,避免了一个数据中心常年处于闲置状态而造成浪费,通过资源整合,双倍提升了数据服务能力;另一方面,如其中一个数据中心发生异常、GTM机制能够实时侦测到异常,将用户的访问请求动态切换到另外一个正常运行的数据中心,对用户来说是无感知的,对数据服务系统来说则保障了高可用性,提高了数据服务系统的可靠性。The data service system of this embodiment offloads the access request to one of the first data center 11 and the second data center 12 according to a preset offloading rule by receiving the access request of the client 13 And the data center that receives the access request in the first data center 11 and the second data center 12 feeds back the corresponding data resource to the client 13 according to the access request, so that the data center can be implemented through the dual data center. Off-site applications provide services, offload control, and read-write separation, and the databases in the two data centers can be synchronized in real time. On the one hand, the full use of resources avoids the waste of a data center being idle for many years, and doubles the data service capability through resource integration; on the other hand, if one of the data centers is abnormal, the GTM mechanism can detect it in real time. Abnormally, the user's access request is dynamically switched to another normal running data center, which is non-aware to the user, guarantees high availability for the data service system, and improves the reliability of the data service system.
本申请进一步提供一种数据服务方法。该数据服务方法基于上述实施例所述的数据服务系统实现,数据服务系统的具体细节可以参照上述各个实施例,在此不再赘述。The application further provides a data service method. The data service method is implemented based on the data service system described in the foregoing embodiment. For details of the data service system, reference may be made to the foregoing embodiments, and details are not described herein.
参照图5,图5为本申请数据服务方法一实施例的流程示意图。Referring to FIG. 5, FIG. 5 is a schematic flowchart of an embodiment of a data service method according to an application.
在一实施例中,该数据服务方法包括:In an embodiment, the data service method comprises:
步骤S10,分流装置接收客户端的访问请求;Step S10: The offloading device receives an access request of the client.
步骤S20,分流装置根据预设的分流规则将所述访问请求分流至所述第一数据中心和所述第二数据中心中的一个。Step S20: The offloading device offloads the access request to one of the first data center and the second data center according to a preset offloading rule.
在一种可选的实施例中,所述分流装置可以独立配置于网络或系 统的后台服务器中,且该分流装置分别与第一数据中心和第二数据中心连接。具体的,该分流装置分别与第一服务器和第二服务器连接。该分流装置接收到客户端的访问请求后,根据预设的分流规则确定该访问请求所对应的数据中心,并通过网络将该访问请求转发至确定的数据中心中。In an optional embodiment, the shunt device can be independently configured on a network or a system. The back-end server is connected to the first data center and the second data center. Specifically, the shunt device is respectively connected to the first server and the second server. After receiving the access request from the client, the traffic distribution device determines the data center corresponding to the access request according to the preset traffic distribution rule, and forwards the access request to the determined data center through the network.
或者,在另一种可选的实施例中,该分流装置还可以配置于第一数据中心和/或第二数据中心中。例如,该分流装置即为上述第一服务器和第二服务器。客户端发送的访问请求经由网络,分别发送至第一服务器和第二服务器,由第一服务器和第二服务器分别根据预设的分流规则确定自身是否响应该访问请求。可以理解的是,该预设的分流规则使得第一服务器和第二服务器中的至少一个可以响应该访问请求。该预设的分流规则使得第一服务器和第二服务器中的其中一个可以响应该访问请求。Alternatively, in another optional embodiment, the shunt device may also be configured in the first data center and/or the second data center. For example, the shunt device is the first server and the second server. The access request sent by the client is sent to the first server and the second server respectively via the network, and the first server and the second server respectively determine whether they respond to the access request according to the preset offload rule. It can be understood that the preset shunting rule enables at least one of the first server and the second server to respond to the access request. The preset offloading rule enables one of the first server and the second server to respond to the access request.
所述分流装置可以采用GTM机制对客户端的访问请求进行分流。该预设的分流规则可以采用以下方式:The offloading device may use a GTM mechanism to offload client access requests. The preset offload rule can be in the following manner:
方式1,比例分流法:分流至所述第一数据中心的访问请求数量与分流至所述第二数据中心的访问请求数量之间的比值为预设比值;Method 1, the proportional offload method: the ratio between the number of access requests that are offloaded to the first data center and the number of access requests that are offloaded to the second data center is a preset ratio;
例如,分流至第一数据中心的访问请求数量与分流至第二数据中心的访问请求数量之比可以为X:Y。其中,X和Y均为正整数。从而可以合理的分配两个数据中心所响应的访问请求的数量,合理利用资源,避免了一个数据中心常年处于闲置状态而造成资源浪费,通过资源整合,提升了数据服务能力。For example, the ratio of the number of access requests diverted to the first data center to the number of access requests diverted to the second data center may be X:Y. Where X and Y are both positive integers. Therefore, the number of access requests responded to by the two data centers can be reasonably allocated, and the resources can be reasonably utilized, thereby avoiding a waste of resources in a data center that is idle for a long time, and improving data service capabilities through resource integration.
方式2,地域分流法:根据所述访问请求的客户端所在的地理位置进行分流;Method 2, the geographical branching method: performing traffic distribution according to the geographical location of the client where the access request is located;
可以预先设置地理位置和数据中心的对应关系。例如,第一数据中心对应的地理位置可以为南京、北京、杭州等等。第二数据中心对应的地理位置可以为深圳、广州、厦门等等。对于南京的客户端所发送的访问请求,根据该对应关系,则由第一数据中心响应,则将该访问请求分流至第一数据中心。对于深圳的客户端所发送的访问请求,根据该对应关系,则由第二数据中心响应,则将该访问请求分流至第二数据中心。The correspondence between the geographic location and the data center can be set in advance. For example, the geographic location corresponding to the first data center may be Nanjing, Beijing, Hangzhou, and the like. The geographic location corresponding to the second data center may be Shenzhen, Guangzhou, Xiamen, and the like. For the access request sent by the client of Nanjing, according to the correspondence, the first data center responds, and the access request is offloaded to the first data center. For the access request sent by the client in Shenzhen, according to the correspondence, the second data center responds, and the access request is offloaded to the second data center.
可选地,可以根据就近原则建立该对应关系。数据中心所对应的地理位置可以靠近该数据中心的所在地。Alternatively, the correspondence may be established according to the principle of proximity. The geographic location of the data center can be close to the location of the data center.
该方式可以根据地域合理的分配两个数据中心所响应的访问请求,使得客户端能够就近访问数据中心,更加合理的利用资源,通过资源整合,提升了数据服务能力。In this way, the access requests responded by the two data centers can be allocated according to the geographical location, so that the client can access the data center nearby, utilize resources more rationally, and improve data service capability through resource integration.
方式3,所述第一数据中心和第二数据中心中的其中一个发生异常时,将所述访问请求分流至未发生异常的数据中心。 Mode 3: When an abnormality occurs in one of the first data center and the second data center, the access request is offloaded to a data center where no abnormality occurs.
例如,若第一数据中心发生异常,则将所有访问请求分流至第二数据中心。该分流的切换对于客户端来说是无感知的,从而保障了数据服务系统的高可用性。For example, if an exception occurs in the first data center, all access requests are offloaded to the second data center. The switching of the offload is non-aware to the client, thereby ensuring high availability of the data service system.
步骤S30,所述第一数据中心和第二数据中心中接收到所述访问请求的数据中心根据所述访问请求,向所述客户端反馈对应的数据资源。Step S30: The data center that receives the access request in the first data center and the second data center feeds back corresponding data resources to the client according to the access request.
以下以第一数据中心接收到了所述访问请求为例:The following takes the access request as an example in the first data center:
对于图1所示的数据服务系统来说,第一服务器接收到该访问请求。该第一服务器根据访问请求通过NFS从第一存储器中读取数据,并反馈给发起该访问请求的客户端。For the data service system shown in FIG. 1, the first server receives the access request. The first server reads data from the first memory through NFS according to the access request, and feeds back to the client that initiated the access request.
对于图2所示的数据服务系统来说,第一服务器接收到该访问请求。该第一服务器根据访问请求从数据库中读取数据,并反馈给发起该访问请求的客户端。For the data service system shown in FIG. 2, the first server receives the access request. The first server reads data from the database according to the access request and feeds back to the client that initiated the access request.
所述第一数据中心的数据资源和第二数据中心的数据资源实时同步。The data resources of the first data center and the data resources of the second data center are synchronized in real time.
本实施例的数据服务方法,通过将接收到的客户端的访问请求根据预设的分流规则将所述访问请求分流至所述第一数据中心和所述第二数据中心中的一个,并且所述第一数据中心和第二数据中心中接收到所述访问请求的数据中心根据所述访问请求,向所述客户端反馈对应的数据资源,从而可以通过双数据中心实现异地应用同时提供服务、分流控制和读写分离,且两个数据中心的数据库可以实现异地实时同步。一方面充分利用资源,避免了一个数据中心常年处于闲置状态而造成浪费,通过资源整合,双倍提升了数据服务能力;另一方面,如其中一个数据中心发生异常、GTM机制能够实时侦测到异常,将用户的访问请求动态切换到另外一个正常运行的数据中心,对用户来说是无感知的,对数据服务系统来说则保障了高可用性,提高了数据服务的可靠性。The data service method of this embodiment, by accessing the received access request of the client according to a preset offloading rule, to the one of the first data center and the second data center, and the The data center that receives the access request in the first data center and the second data center feeds back the corresponding data resource to the client according to the access request, so that the dual data center can realize the off-site application and provide the service and the offload simultaneously. Control and read-write separation, and the database of the two data centers can achieve real-time synchronization in different places. On the one hand, the full use of resources avoids the waste of a data center being idle for many years, and doubles the data service capability through resource integration; on the other hand, if one of the data centers is abnormal, the GTM mechanism can detect it in real time. Abnormally, the user's access request is dynamically switched to another normal running data center, which is non-aware to the user, guarantees high availability for the data service system, and improves the reliability of the data service.
进一步的,对于图1所示的数据服务系统来说,在一可选的实施例中,在上述实施例的基础上,该方法还包括:当第一存储器中存储的数据发生变化时,第一服务器将所述第一存储器中的数据资源同步至第二存储器。具体的,第一服务器可以通过数据镜像备份工具(如remote synchronize)将第一存储器中的数据资源实时、远程的同步到第二存储器中。Further, in the data service system shown in FIG. 1, in an optional embodiment, based on the foregoing embodiment, the method further includes: when the data stored in the first memory changes, A server synchronizes data resources in the first memory to a second memory. Specifically, the first server may synchronize the data resources in the first memory to the second memory in real time through a data mirror backup tool (such as remote synchronize).
采用上述同步策略,可以有效地保证在其中一个数据中心发生异常时,能够将访问请求分流至正常工作的数据中心。该分流的切换对于客户端来说是无感知的,保障了数据服务系统的高可用性。 By adopting the above synchronization strategy, it is possible to effectively ensure that when an abnormality occurs in one of the data centers, the access request can be offloaded to the data center that is working normally. The switching of the offload is non-aware to the client, ensuring high availability of the data service system.
进一步的,对于图2所示的数据服务系统来说,在一可选的实施例中,在上述实施例的基础上,其数据库具有以下两种实施方式:Further, for the data service system shown in FIG. 2, in an optional embodiment, based on the above embodiments, the database has the following two implementation manners:
实施方式一,如图2所示,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库,所述第二数据中心包括用于存储所述数据资源的第三数据库和第四数据库。Embodiment 1, as shown in FIG. 2, the first data center includes a first database and a second database for storing the data resource, and the second data center includes a third for storing the data resource. Database and fourth database.
第一数据库和第三数据库可以为Redis数据库,采用“主+从”模式架构。所述第一数据库包括第一主数据库和第一从数据库。所述第三数据库包括第三主数据库和第三从数据库。The first database and the third database may be Redis databases, using a "master + slave" mode architecture. The first database includes a first primary database and a first secondary database. The third database includes a third primary database and a third secondary database.
如图3所示,第二数据库和第四数据库可以为Mysql数据库,第二数据库采用“主+从”模式架构,第四数据库采用“从+从”模式架构。所述第二数据库包括第二主数据库和第二从数据库,所述第四数据库包括两个第四从数据库。As shown in FIG. 3, the second database and the fourth database may be Mysql databases, the second database adopts a "master + slave" mode architecture, and the fourth database adopts a "slave + slave" mode architecture. The second database includes a second primary database and a second secondary database, and the fourth database includes two fourth secondary databases.
第二数据库通过sql语句将数据资源同步至第四数据库。The second database synchronizes the data resources to the fourth database through the sql statement.
在第一数据中心,第一服务器对第一数据库和第二数据库可进行读、写操作。在第二数据中心,第二服务器对第三数据库和第四数据库可进行读操作。In the first data center, the first server can perform read and write operations on the first database and the second database. In the second data center, the second server can perform read operations on the third database and the fourth database.
所述数据服务方法还包括:The data service method further includes:
所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同步;所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步;The data resources in the first database are synchronized with the data resources in the second database in real time; the data resources in the third database are synchronized with the data resources in the fourth database in real time;
所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The data resources in the first primary database are synchronized with the data resources in the first slave database in real time; the data resources in the third primary database are synchronized with the data resources in the third slave database in real time;
所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;所述第二主数据库中的数据资源实时同步至所述第四数据库中的一个所述第四从数据库中,所述第二从数据库中的数据资源实时同步至所述第四数据库中的另一个所述第四从数据库中。The data resources in the second primary database are synchronized with the data resources in the second slave database in real time; the data resources in the second primary database are synchronized in real time to one of the fourth slaves in the fourth database In the database, the data resources in the second slave database are synchronized in real time to another fourth slave database in the fourth database.
通过在第一数据中心和第二数据中心均设置多个数据库,并且采用上述同步策略,可以有效地保证在其中一个数据中心发生异常时,能够将访问请求分流至正常工作的数据中心。该分流的切换对于客户端来说是无感知的,保障了数据服务系统的高可用性。By setting a plurality of databases in both the first data center and the second data center, and adopting the above synchronization strategy, it is possible to effectively ensure that when an abnormality occurs in one of the data centers, the access request can be offloaded to the data center that works normally. The switching of the offload is non-aware to the client, ensuring high availability of the data service system.
实施方式二,如图2所示,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库,所述第二数据中心包括用于存储所述数据资源的第三数据库和第四数据库。Embodiment 2, as shown in FIG. 2, the first data center includes a first database and a second database for storing the data resource, and the second data center includes a third for storing the data resource Database and fourth database.
第一数据库和第三数据库可以为Redis数据库,采用“主+从”模式架构。所述第一数据库包括第一主数据库和第一从数据库。所述第三数据库包括第三主数据库和第三从数据库。The first database and the third database may be Redis databases, using a "master + slave" mode architecture. The first database includes a first primary database and a first secondary database. The third database includes a third primary database and a third secondary database.
如图4所示,第二数据库和第四数据库可以为Oracle数据库,第二 数据库采用“主+从”模式架构,第四数据库采用“主+从”模式架构。所述第二数据库包括第二主数据库和第二从数据库,所述第四数据库包括第四主数据库和第四从数据库。As shown in FIG. 4, the second database and the fourth database may be an Oracle database, and second The database adopts the "master + slave" mode architecture, and the fourth database adopts the "master + slave" mode architecture. The second database includes a second primary database and a second secondary database, and the fourth database includes a fourth primary database and a fourth secondary database.
第二数据库通过DataGuard数据同步技术将数据同步至第四数据库。The second database synchronizes the data to the fourth database via DataGuard data synchronization technology.
在第一数据中心,第一服务器对第一数据库和第二数据库可进行读、写操作。在第二数据中心,第二服务器对第三数据库和第四数据库可进行读操作。In the first data center, the first server can perform read and write operations on the first database and the second database. In the second data center, the second server can perform read operations on the third database and the fourth database.
所述数据服务方法还包括:The data service method further includes:
所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同步;所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步;The data resources in the first database are synchronized with the data resources in the second database in real time; the data resources in the third database are synchronized with the data resources in the fourth database in real time;
所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The data resources in the first primary database are synchronized with the data resources in the first slave database in real time; the data resources in the third primary database are synchronized with the data resources in the third slave database in real time;
所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;所述第四主数据库中的数据资源与所述第四从数据库中的数据资源实时同步;所述第二主数据库中的数据资源实时同步至所述第四主数据库中。The data resources in the second primary database are synchronized with the data resources in the second slave database in real time; the data resources in the fourth primary database are synchronized with the data resources in the fourth slave database in real time; The data resources in the second primary database are synchronized in real time to the fourth primary database.
通过在第一数据中心和第二数据中心均设置多个数据库,并且采用上述同步策略,可以有效地保证在其中一个数据中心发生异常时,能够将访问请求分流至正常工作的数据中心。该分流的切换对于客户端来说是无感知的,保障了数据服务系统的高可用性。By setting a plurality of databases in both the first data center and the second data center, and adopting the above synchronization strategy, it is possible to effectively ensure that when an abnormality occurs in one of the data centers, the access request can be offloaded to the data center that works normally. The switching of the offload is non-aware to the client, ensuring high availability of the data service system.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。It is to be understood that the term "comprises", "comprising", or any other variants thereof, is intended to encompass a non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes those elements. It also includes other elements that are not explicitly listed, or elements that are inherent to such a process, method, article, or device. An element that is defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device that comprises the element.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件来实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网 络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and can also be implemented by hardware, but in many cases, the former is A better implementation. Based on such understanding, the technical solution of the present application, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk, CD-ROM, including a number of instructions to make a terminal device (can be a mobile phone, computer, server, air conditioner, or network) The network device, etc.) performs the methods described in the various embodiments of the present application.
以上参照附图说明了本申请的优选实施例,并非因此局限本申请的权利范围。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。另外,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。The preferred embodiments of the present application have been described above with reference to the drawings, and are not intended to limit the scope of the application. The serial numbers of the embodiments of the present application are merely for the description, and do not represent the advantages and disadvantages of the embodiments. Additionally, although logical sequences are shown in the flowcharts, in some cases the steps shown or described may be performed in a different order than the ones described herein.
本领域技术人员不脱离本申请的范围和实质,可以有多种变型方案实现本申请,比如作为一个实施例的特征可用于另一实施例而得到又一实施例。凡在运用本申请的技术构思之内所作的任何修改、等同替换和改进,均应在本申请的权利范围之内。 A person skilled in the art can implement the present application in various variants without departing from the scope and spirit of the present application. For example, the features of one embodiment can be used in another embodiment to obtain another embodiment. Any modifications, equivalent substitutions and improvements made within the technical concept of the application should be within the scope of the application.

Claims (20)

  1. 一种数据服务系统,其特征在于,所述数据服务系统包括分流装置、第一数据中心和第二数据中心;所述第一数据中心的数据资源和第二数据中心的数据资源实时同步;A data service system, comprising: a data distribution system, a first data center and a second data center; and the data resources of the first data center and the data resources of the second data center are synchronized in real time;
    所述分流装置接收客户端的访问请求;The offloading device receives an access request of a client;
    所述分流装置根据预设的分流规则将所述访问请求分流至所述第一数据中心和所述第二数据中心中的一个;The offloading device offloads the access request to one of the first data center and the second data center according to a preset offloading rule;
    所述第一数据中心和第二数据中心中接收到所述访问请求的数据中心根据所述访问请求,向所述客户端反馈对应的数据资源。The data center that receives the access request in the first data center and the second data center feeds back corresponding data resources to the client according to the access request.
  2. 如权利要求1所述的数据服务系统,其特征在于,所述预设的分流规则为:The data service system according to claim 1, wherein the preset offloading rule is:
    分流至所述第一数据中心的访问请求数量与分流至所述第二数据中心的访问请求数量之间的比值为预设比值。The ratio between the number of access requests that are offloaded to the first data center and the number of access requests that are offloaded to the second data center is a preset ratio.
  3. 如权利要求1所述的数据服务系统,其特征在于,所述预设的分流规则为:The data service system according to claim 1, wherein the preset offloading rule is:
    根据所述访问请求的客户端所在的地理位置就近分流。The location of the client according to the access request is distributed nearby.
  4. 如权利要求1所述的数据服务系统,其特征在于,所述预设的分流规则为:The data service system according to claim 1, wherein the preset offloading rule is:
    当所述第一数据中心和第二数据中心中的其中一个发生异常时,将所述访问请求分流至未发生异常的数据中心。When an abnormality occurs in one of the first data center and the second data center, the access request is offloaded to a data center where no abnormality has occurred.
  5. 如权利要求1所述的数据服务系统,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一存储器和与所述第一存储器连接的第一服务器,所述第二数据中心包括用于存储所述数据资源的第二存储器;所述第一存储器和第二存储器均为网络存储器;The data service system of claim 1 wherein said first data center comprises a first memory for storing said data resource and a first server coupled to said first memory, said second The data center includes a second memory for storing the data resource; the first memory and the second memory are both network memories;
    当所述第一存储器内的数据资源发生变化时,所述第一服务器将所述第一存储器内的数据资源同步至所述第二存储器。The first server synchronizes data resources in the first memory to the second memory when a data resource in the first memory changes.
  6. 如权利要求2所述的数据服务系统,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库,所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同步;A data service system according to claim 2, wherein said first data center includes a first database and a second database for storing said data resources, said data resources in said first database and said The data resources in the second database are synchronized in real time;
    所述第二数据中心包括用于存储所述数据资源的第三数据库和第四数据库,所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步; The second data center includes a third database and a fourth database for storing the data resources, and the data resources in the third database are synchronized with the data resources in the fourth database in real time;
    所述第一数据库和第三数据库为Redis数据库,所述第二数据库和第四数据库为Mysql数据库,其中:The first database and the third database are Redis databases, and the second database and the fourth database are Mysql databases, wherein:
    所述第一数据库包括第一主数据库和第一从数据库,所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;The first database includes a first primary database and a first secondary database, and the data resources in the first primary database are synchronized with the data resources in the first secondary database in real time;
    所述第三数据库包括第三主数据库和第三从数据库,所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The third database includes a third primary database and a third secondary database, and the data resources in the third primary database are synchronized with the data resources in the third secondary database in real time;
    所述第二数据库包括第二主数据库和第二从数据库,所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;The second database includes a second primary database and a second secondary database, and the data resources in the second primary database are synchronized with the data resources in the second secondary database in real time;
    所述第四数据库包括两个第四从数据库,所述第二主数据库中的数据资源实时同步至所述第四数据库中的一个所述第四从数据库中,所述第二从数据库中的数据资源实时同步至所述第四数据库中的另一个所述第四从数据库中。The fourth database includes two fourth slave databases, and the data resources in the second master database are synchronously synchronized to one of the fourth slave databases in the fourth database, and the second slave database The data resource is synchronized in real time to another of the fourth slave databases in the fourth database.
  7. 如权利要求3所述的数据服务系统,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库,所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同步;A data service system according to claim 3, wherein said first data center includes a first database and a second database for storing said data resources, said data resources in said first database and said The data resources in the second database are synchronized in real time;
    所述第二数据中心包括用于存储所述数据资源的第三数据库和第四数据库,所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步;The second data center includes a third database and a fourth database for storing the data resources, and the data resources in the third database are synchronized with the data resources in the fourth database in real time;
    所述第一数据库和第三数据库为Redis数据库,所述第二数据库和第四数据库为Mysql数据库,其中:The first database and the third database are Redis databases, and the second database and the fourth database are Mysql databases, wherein:
    所述第一数据库包括第一主数据库和第一从数据库,所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;The first database includes a first primary database and a first secondary database, and the data resources in the first primary database are synchronized with the data resources in the first secondary database in real time;
    所述第三数据库包括第三主数据库和第三从数据库,所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The third database includes a third primary database and a third secondary database, and the data resources in the third primary database are synchronized with the data resources in the third secondary database in real time;
    所述第二数据库包括第二主数据库和第二从数据库,所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;The second database includes a second primary database and a second secondary database, and the data resources in the second primary database are synchronized with the data resources in the second secondary database in real time;
    所述第四数据库包括两个第四从数据库,所述第二主数据库中的数据资源实时同步至所述第四数据库中的一个所述第四从数据库中,所述第二从数据库中的数据资源实时同步至所述第四数据库中的另一个所述第四从数据库中。The fourth database includes two fourth slave databases, and the data resources in the second master database are synchronously synchronized to one of the fourth slave databases in the fourth database, and the second slave database The data resource is synchronized in real time to another of the fourth slave databases in the fourth database.
  8. 如权利要求4所述的数据服务系统,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库,所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同步;A data service system according to claim 4, wherein said first data center includes a first database and a second database for storing said data resources, said data resources in said first database and said The data resources in the second database are synchronized in real time;
    所述第二数据中心包括用于存储所述数据资源的第三数据库和 第四数据库,所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步;The second data center includes a third database for storing the data resources and a fourth database, wherein the data resources in the third database are synchronized with the data resources in the fourth database in real time;
    所述第一数据库和第三数据库为Redis数据库,所述第二数据库和第四数据库为Mysql数据库,其中:The first database and the third database are Redis databases, and the second database and the fourth database are Mysql databases, wherein:
    所述第一数据库包括第一主数据库和第一从数据库,所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;The first database includes a first primary database and a first secondary database, and the data resources in the first primary database are synchronized with the data resources in the first secondary database in real time;
    所述第三数据库包括第三主数据库和第三从数据库,所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The third database includes a third primary database and a third secondary database, and the data resources in the third primary database are synchronized with the data resources in the third secondary database in real time;
    所述第二数据库包括第二主数据库和第二从数据库,所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;The second database includes a second primary database and a second secondary database, and the data resources in the second primary database are synchronized with the data resources in the second secondary database in real time;
    所述第四数据库包括两个第四从数据库,所述第二主数据库中的数据资源实时同步至所述第四数据库中的一个所述第四从数据库中,所述第二从数据库中的数据资源实时同步至所述第四数据库中的另一个所述第四从数据库中。The fourth database includes two fourth slave databases, and the data resources in the second master database are synchronously synchronized to one of the fourth slave databases in the fourth database, and the second slave database The data resource is synchronized in real time to another of the fourth slave databases in the fourth database.
  9. 如权利要求2所述的数据服务系统,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库,所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同步;A data service system according to claim 2, wherein said first data center includes a first database and a second database for storing said data resources, said data resources in said first database and said The data resources in the second database are synchronized in real time;
    所述第二数据中心包括用于存储所述数据资源的第三数据库和第四数据库,所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步;The second data center includes a third database and a fourth database for storing the data resources, and the data resources in the third database are synchronized with the data resources in the fourth database in real time;
    所述第一数据库和第三数据库为Redis数据库,所述第二数据库和第四数据库为Oracle数据库,其中:The first database and the third database are Redis databases, and the second database and the fourth database are Oracle databases, wherein:
    所述第一数据库包括第一主数据库和第一从数据库,所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;The first database includes a first primary database and a first secondary database, and the data resources in the first primary database are synchronized with the data resources in the first secondary database in real time;
    所述第三数据库包括第三主数据库和第三从数据库,所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The third database includes a third primary database and a third secondary database, and the data resources in the third primary database are synchronized with the data resources in the third secondary database in real time;
    所述第二数据库包括第二主数据库和第二从数据库,所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;The second database includes a second primary database and a second secondary database, and the data resources in the second primary database are synchronized with the data resources in the second secondary database in real time;
    所述第四数据库包括第四主数据库和第四从数据库,所述第四主数据库中的数据资源与所述第四从数据库中的数据资源实时同步;The fourth database includes a fourth primary database and a fourth secondary database, and the data resources in the fourth primary database are synchronized with the data resources in the fourth secondary database in real time;
    所述第二主数据库中的数据资源实时同步至所述第四主数据库中。The data resources in the second primary database are synchronized in real time to the fourth primary database.
  10. 如权利要求3所述的数据服务系统,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库,所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同 步;A data service system according to claim 3, wherein said first data center includes a first database and a second database for storing said data resources, said data resources in said first database and said The data resources in the second database are in real time step;
    所述第二数据中心包括用于存储所述数据资源的第三数据库和第四数据库,所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步;The second data center includes a third database and a fourth database for storing the data resources, and the data resources in the third database are synchronized with the data resources in the fourth database in real time;
    所述第一数据库和第三数据库为Redis数据库,所述第二数据库和第四数据库为Oracle数据库,其中:The first database and the third database are Redis databases, and the second database and the fourth database are Oracle databases, wherein:
    所述第一数据库包括第一主数据库和第一从数据库,所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;The first database includes a first primary database and a first secondary database, and the data resources in the first primary database are synchronized with the data resources in the first secondary database in real time;
    所述第三数据库包括第三主数据库和第三从数据库,所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The third database includes a third primary database and a third secondary database, and the data resources in the third primary database are synchronized with the data resources in the third secondary database in real time;
    所述第二数据库包括第二主数据库和第二从数据库,所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;The second database includes a second primary database and a second secondary database, and the data resources in the second primary database are synchronized with the data resources in the second secondary database in real time;
    所述第四数据库包括第四主数据库和第四从数据库,所述第四主数据库中的数据资源与所述第四从数据库中的数据资源实时同步;The fourth database includes a fourth primary database and a fourth secondary database, and the data resources in the fourth primary database are synchronized with the data resources in the fourth secondary database in real time;
    所述第二主数据库中的数据资源实时同步至所述第四主数据库中。The data resources in the second primary database are synchronized in real time to the fourth primary database.
  11. 如权利要求4所述的数据服务系统,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库,所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同步;A data service system according to claim 4, wherein said first data center includes a first database and a second database for storing said data resources, said data resources in said first database and said The data resources in the second database are synchronized in real time;
    所述第二数据中心包括用于存储所述数据资源的第三数据库和第四数据库,所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步;The second data center includes a third database and a fourth database for storing the data resources, and the data resources in the third database are synchronized with the data resources in the fourth database in real time;
    所述第一数据库和第三数据库为Redis数据库,所述第二数据库和第四数据库为Oracle数据库,其中:The first database and the third database are Redis databases, and the second database and the fourth database are Oracle databases, wherein:
    所述第一数据库包括第一主数据库和第一从数据库,所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;The first database includes a first primary database and a first secondary database, and the data resources in the first primary database are synchronized with the data resources in the first secondary database in real time;
    所述第三数据库包括第三主数据库和第三从数据库,所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The third database includes a third primary database and a third secondary database, and the data resources in the third primary database are synchronized with the data resources in the third secondary database in real time;
    所述第二数据库包括第二主数据库和第二从数据库,所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;The second database includes a second primary database and a second secondary database, and the data resources in the second primary database are synchronized with the data resources in the second secondary database in real time;
    所述第四数据库包括第四主数据库和第四从数据库,所述第四主数据库中的数据资源与所述第四从数据库中的数据资源实时同步;The fourth database includes a fourth primary database and a fourth secondary database, and the data resources in the fourth primary database are synchronized with the data resources in the fourth secondary database in real time;
    所述第二主数据库中的数据资源实时同步至所述第四主数据库中。The data resources in the second primary database are synchronized in real time to the fourth primary database.
  12. 一种数据服务方法,应用于数据服务系统,其特征在于,所 述数据服务方法包括:A data service method applied to a data service system, characterized in that The data service methods include:
    分流装置接收客户端的访问请求;The offloading device receives the access request of the client;
    所述分流装置根据预设的分流规则将所述访问请求分流至第一数据中心和第二数据中心中的一个;The offloading device offloads the access request to one of the first data center and the second data center according to a preset offloading rule;
    所述第一数据中心和第二数据中心中接收到所述访问请求的数据中心根据所述访问请求,向所述客户端反馈对应的数据资源;And the data center that receives the access request in the first data center and the second data center feeds back corresponding data resources to the client according to the access request;
    其中,所述第一数据中心的数据资源和第二数据中心的数据资源实时同步。The data resource of the first data center and the data resource of the second data center are synchronized in real time.
  13. 如权利要求12所述的数据服务方法,其特征在于,所述预设的分流规则为:The data service method according to claim 12, wherein the preset offloading rule is:
    分流至所述第一数据中心的访问请求数量与分流至所述第二数据中心的访问请求数量之间的比值为预设比值。The ratio between the number of access requests that are offloaded to the first data center and the number of access requests that are offloaded to the second data center is a preset ratio.
  14. 如权利要求12所述的数据服务方法,其特征在于,所述预设的分流规则为:The data service method according to claim 12, wherein the preset offloading rule is:
    根据所述访问请求的客户端所在的地理位置就近分流。The location of the client according to the access request is distributed nearby.
  15. 如权利要求12所述的数据服务方法,其特征在于,所述预设的分流规则为:The data service method according to claim 12, wherein the preset offloading rule is:
    当所述第一数据中心和第二数据中心中的其中一个发生异常时,将所述访问请求分流至未发生异常的数据中心。When an abnormality occurs in one of the first data center and the second data center, the access request is offloaded to a data center where no abnormality has occurred.
  16. 如权利要求12所述的数据服务方法,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一存储器和与所述第一存储器连接的第一服务器,所述第二数据中心包括用于存储所述数据资源的第二存储器;所述第一存储器和第二存储器均为网络存储器;所述数据服务方法还包括:The data service method according to claim 12, wherein said first data center includes a first memory for storing said data resource and a first server connected to said first memory, said second The data center includes a second memory for storing the data resource; the first memory and the second memory are both network memories; and the data service method further includes:
    当所述第一存储器内的数据资源发生变化时,所述第一服务器将所述第一存储器内的数据资源同步至所述第二存储器。The first server synchronizes data resources in the first memory to the second memory when a data resource in the first memory changes.
  17. 如权利要求13所述的数据服务方法,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库,所述第二数据中心包括用于存储所述数据资源的第三数据库和第四数据库,所述第一数据库和第三数据库为Redis数据库,所述第二数据库和第四数据库为Mysql数据库;所述第一数据库包括第一主数据库和第一从数据库,所述第三数据库包括第三主数据库和第三从数据库,所述第二数据库包括第二主数据库和第二从数据库,所述第四数据库包括两个第四从数据库,所述数据服务方法还包括: The data service method according to claim 13, wherein said first data center includes a first database and a second database for storing said data resources, said second data center including said a third database and a fourth database of data resources, the first database and the third database are Redis databases, the second database and the fourth database are Mysql databases; the first database includes a first primary database and a first database From the database, the third database includes a third primary database and a third secondary database, the second database includes a second primary database and a second secondary database, the fourth database includes two fourth secondary databases, Data service methods also include:
    所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同步;The data resources in the first database are synchronized with the data resources in the second database in real time;
    所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步;The data resources in the third database are synchronized with the data resources in the fourth database in real time;
    所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;The data resources in the first primary database are synchronized with the data resources in the first slave database in real time;
    所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The data resources in the third primary database are synchronized with the data resources in the third secondary database in real time;
    所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;The data resources in the second primary database are synchronized with the data resources in the second secondary database in real time;
    所述第二主数据库中的数据资源实时同步至所述第四数据库中的一个所述第四从数据库中,所述第二从数据库中的数据资源实时同步至所述第四数据库中的另一个所述第四从数据库中。The data resources in the second primary database are synchronously synchronized to one of the fourth slave databases in the fourth database, and the data resources in the second slave database are synchronized in real time to another one in the fourth database. One of the fourth slave databases.
  18. 如权利要求14所述的数据服务方法,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库,所述第二数据中心包括用于存储所述数据资源的第三数据库和第四数据库,所述第一数据库和第三数据库为Redis数据库,所述第二数据库和第四数据库为Mysql数据库;所述第一数据库包括第一主数据库和第一从数据库,所述第三数据库包括第三主数据库和第三从数据库,所述第二数据库包括第二主数据库和第二从数据库,所述第四数据库包括两个第四从数据库,所述数据服务方法还包括:The data service method according to claim 14, wherein said first data center includes a first database and a second database for storing said data resources, said second data center including said a third database and a fourth database of data resources, the first database and the third database are Redis databases, the second database and the fourth database are Mysql databases; the first database includes a first primary database and a first database From the database, the third database includes a third primary database and a third secondary database, the second database includes a second primary database and a second secondary database, the fourth database includes two fourth secondary databases, Data service methods also include:
    所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同步;The data resources in the first database are synchronized with the data resources in the second database in real time;
    所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步;The data resources in the third database are synchronized with the data resources in the fourth database in real time;
    所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;The data resources in the first primary database are synchronized with the data resources in the first slave database in real time;
    所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The data resources in the third primary database are synchronized with the data resources in the third secondary database in real time;
    所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;The data resources in the second primary database are synchronized with the data resources in the second secondary database in real time;
    所述第二主数据库中的数据资源实时同步至所述第四数据库中的一个所述第四从数据库中,所述第二从数据库中的数据资源实时同步至所述第四数据库中的另一个所述第四从数据库中。The data resources in the second primary database are synchronously synchronized to one of the fourth slave databases in the fourth database, and the data resources in the second slave database are synchronized in real time to another one in the fourth database. One of the fourth slave databases.
  19. 如权利要求15所述的数据服务方法,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库, 所述第二数据中心包括用于存储所述数据资源的第三数据库和第四数据库,所述第一数据库和第三数据库为Redis数据库,所述第二数据库和第四数据库为Mysql数据库;所述第一数据库包括第一主数据库和第一从数据库,所述第三数据库包括第三主数据库和第三从数据库,所述第二数据库包括第二主数据库和第二从数据库,所述第四数据库包括两个第四从数据库,所述数据服务方法还包括:The data service method according to claim 15, wherein said first data center includes a first database and a second database for storing said data resources, The second data center includes a third database and a fourth database for storing the data resource, the first database and the third database are Redis databases, and the second database and the fourth database are Mysql databases; The first database includes a first primary database and a first secondary database, the third database includes a third primary database and a third secondary database, and the second database includes a second primary database and a second secondary database, the first database The four databases include two fourth slave databases, and the data service methods further include:
    所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同步;The data resources in the first database are synchronized with the data resources in the second database in real time;
    所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步;The data resources in the third database are synchronized with the data resources in the fourth database in real time;
    所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;The data resources in the first primary database are synchronized with the data resources in the first slave database in real time;
    所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The data resources in the third primary database are synchronized with the data resources in the third secondary database in real time;
    所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步;The data resources in the second primary database are synchronized with the data resources in the second secondary database in real time;
    所述第二主数据库中的数据资源实时同步至所述第四数据库中的一个所述第四从数据库中,所述第二从数据库中的数据资源实时同步至所述第四数据库中的另一个所述第四从数据库中。The data resources in the second primary database are synchronously synchronized to one of the fourth slave databases in the fourth database, and the data resources in the second slave database are synchronized in real time to another one in the fourth database. One of the fourth slave databases.
  20. 如权利要求13所述的数据服务方法,其特征在于,所述第一数据中心包括用于存储所述数据资源的第一数据库和第二数据库,所述第二数据中心包括用于存储所述数据资源的第三数据库和第四数据库,所述第一数据库和第三数据库为Redis数据库,所述第二数据库和第四数据库为Oracle数据库,所述第一数据库包括第一主数据库和第一从数据库,所述第三数据库包括第三主数据库和第三从数据库,所述第二数据库包括第二主数据库和第二从数据库,所述第四数据库包括第四主数据库和第四从数据库,所述数据服务方法还包括:The data service method according to claim 13, wherein said first data center includes a first database and a second database for storing said data resources, said second data center including said a third database and a fourth database of data resources, the first database and the third database are Redis databases, the second database and the fourth database are Oracle databases, and the first database includes a first primary database and a first database From the database, the third database includes a third primary database and a third secondary database, the second database includes a second primary database and a second secondary database, and the fourth database includes a fourth primary database and a fourth secondary database The data service method further includes:
    所述第一数据库中的数据资源与所述第二数据库中的数据资源实时同步;The data resources in the first database are synchronized with the data resources in the second database in real time;
    所述第三数据库中的数据资源与所述第四数据库中的数据资源实时同步;The data resources in the third database are synchronized with the data resources in the fourth database in real time;
    所述第一主数据库中的数据资源与所述第一从数据库中的数据资源实时同步;The data resources in the first primary database are synchronized with the data resources in the first slave database in real time;
    所述第三主数据库中的数据资源与所述第三从数据库中的数据资源实时同步;The data resources in the third primary database are synchronized with the data resources in the third secondary database in real time;
    所述第二主数据库中的数据资源与所述第二从数据库中的数据资源实时同步; The data resources in the second primary database are synchronized with the data resources in the second secondary database in real time;
    所述第四主数据库中的数据资源与所述第四从数据库中的数据资源实时同步,所述第二主数据库中的数据资源实时同步至所述第四主数据库中。 The data resources in the fourth primary database are synchronized with the data resources in the fourth secondary database in real time, and the data resources in the second primary database are synchronized in real time to the fourth primary database.
PCT/CN2017/108745 2017-09-30 2017-10-31 Data service method and system WO2019061657A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710915082.6 2017-09-30
CN201710915082.6A CN107734017B (en) 2017-09-30 2017-09-30 Data service method and system

Publications (1)

Publication Number Publication Date
WO2019061657A1 true WO2019061657A1 (en) 2019-04-04

Family

ID=61209526

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/108745 WO2019061657A1 (en) 2017-09-30 2017-10-31 Data service method and system

Country Status (2)

Country Link
CN (1) CN107734017B (en)
WO (1) WO2019061657A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108491466B (en) * 2018-03-06 2022-08-30 平安科技(深圳)有限公司 Electronic device, access instruction information acquisition method, and storage medium
CN109145057A (en) * 2018-09-10 2019-01-04 合肥科讯金服科技有限公司 A kind of data service platform system
CN109819048B (en) * 2019-02-27 2022-03-15 北京字节跳动网络技术有限公司 Data synchronization method, device, terminal and storage medium
CN110083657A (en) * 2019-02-27 2019-08-02 北京字节跳动网络技术有限公司 Data interchange method, apparatus, terminal and storage medium
CN111431818B (en) * 2020-02-28 2023-06-09 口碑(上海)信息技术有限公司 Cross-domain request flow distribution method and device, storage medium and computer equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090303880A1 (en) * 2008-06-09 2009-12-10 Microsoft Corporation Data center interconnect and traffic engineering
CN102065119A (en) * 2010-10-18 2011-05-18 中山大学 Network interactive program-oriented network service system
CN102143237A (en) * 2011-05-09 2011-08-03 宋健 Grid-based Internet content delivery method and system
CN104639451A (en) * 2013-11-14 2015-05-20 中兴通讯股份有限公司 Data flow distribution method and controller

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105847391A (en) * 2016-04-25 2016-08-10 云南电网有限责任公司昆明供电局 Distributed cloud data central structure

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090303880A1 (en) * 2008-06-09 2009-12-10 Microsoft Corporation Data center interconnect and traffic engineering
CN102065119A (en) * 2010-10-18 2011-05-18 中山大学 Network interactive program-oriented network service system
CN102143237A (en) * 2011-05-09 2011-08-03 宋健 Grid-based Internet content delivery method and system
CN104639451A (en) * 2013-11-14 2015-05-20 中兴通讯股份有限公司 Data flow distribution method and controller

Also Published As

Publication number Publication date
CN107734017B (en) 2020-12-15
CN107734017A (en) 2018-02-23

Similar Documents

Publication Publication Date Title
WO2019061657A1 (en) Data service method and system
TWI710915B (en) Resource processing method based on internet data center, related devices and communication system
EP3490224B1 (en) Data synchronization method and system
US10713135B2 (en) Data disaster recovery method, device and system
US20160078117A1 (en) Policy-based Storage Structure Distribution
TWI755417B (en) Computing task allocation method, execution method of stream computing task, control server, stream computing center server cluster, stream computing system and remote multi-active system
US7788233B1 (en) Data store replication for entity based partition
US7962509B2 (en) Systems and methods for server management
KR101670343B1 (en) Method, device, and system for peer-to-peer data replication and method, device, and system for master node switching
CN106487486B (en) Service processing method and data center system
CN105471960A (en) Information interaction system and method between private clouds and public cloud
WO2019001017A1 (en) Inter-cluster data migration method and system, server, and computer storage medium
WO2015192661A1 (en) Method, device, and system for data synchronization in distributed storage system
CN104683161B (en) Network management and device based on SaaS
CN109547512A (en) A kind of method and device of the distributed Session management based on NoSQL
CN101334797A (en) Distributed file systems and its data block consistency managing method
US9058304B2 (en) Continuous workload availability between sites at unlimited distances
WO2019210580A1 (en) Access request processing method, apparatus, computer device, and storage medium
EP4213038A1 (en) Data processing method and apparatus based on distributed storage, device, and medium
US10528580B2 (en) Method and mechanism for efficient re-distribution of in-memory columnar units in a clustered RDBMS on topology change
US20160078065A1 (en) Policy-based Storage Structure Distribution
CN110175089A (en) A kind of dual-active disaster recovery and backup systems with read and write abruption function
EP3044682B1 (en) Transaction query engine
CN112492022A (en) Cluster, method, system and storage medium for improving database availability
CN114422331A (en) Disaster tolerance switching method, device and system

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: 17927649

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC , EPO FORM 1205A DATED 28.09.2020.

122 Ep: pct application non-entry in european phase

Ref document number: 17927649

Country of ref document: EP

Kind code of ref document: A1