CN111897791B - Service distribution method, device, equipment and storage medium - Google Patents

Service distribution method, device, equipment and storage medium Download PDF

Info

Publication number
CN111897791B
CN111897791B CN202010680188.4A CN202010680188A CN111897791B CN 111897791 B CN111897791 B CN 111897791B CN 202010680188 A CN202010680188 A CN 202010680188A CN 111897791 B CN111897791 B CN 111897791B
Authority
CN
China
Prior art keywords
fragment
service message
key value
value pair
configuration information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010680188.4A
Other languages
Chinese (zh)
Other versions
CN111897791A (en
Inventor
孟浩鹏
李俊林
汪广骏
苏兆成
张舵
傅韬
周涛
李以策
张鹏鹏
周振玉
董明烨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Ums Co ltd
Original Assignee
China Ums Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Ums Co ltd filed Critical China Ums Co ltd
Priority to CN202010680188.4A priority Critical patent/CN111897791B/en
Publication of CN111897791A publication Critical patent/CN111897791A/en
Application granted granted Critical
Publication of CN111897791B publication Critical patent/CN111897791B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/16Error detection or correction of the data by redundancy in hardware
    • G06F11/20Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
    • G06F11/202Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
    • G06F11/2023Failover techniques
    • G06F11/203Failover techniques using migration

Abstract

The application discloses a service distribution method, a device, equipment and a storage medium, wherein the method, the device, the equipment and the storage medium are used for reading a preset distributed cache and obtaining configuration information of a preset identifier of a service message. The configuration information comprises a key value pair, the key value pair is used for indicating the corresponding relation between a preset identifier and a target system, the target system comprises a local system or a remote system, and the preset identifier is preselected from the device number, the organization number or the fragment number of the database fragment to which the service message belongs according to the requirement. And sending the service message to the target system according to the corresponding relation indicated by the key value pair. Therefore, the preset identification is preselected from the device number, the organization number or the slicing number of the database slicing to which the service message belongs according to the configuration information of the preset identification stored in the distributed cache, so that the service is shunted in different required dimensions according to the shunting mode of the device number, the organization number and the slicing number, the service shunting effect is obvious, and the applicability is higher.

Description

Service distribution method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of information processing technologies, and in particular, to a service offloading method, apparatus, device, and storage medium.
Background
The remote dual-active system refers to that two systems are respectively deployed at two places, which can be called a local system and a remote system, and the local system and the remote system are peer-to-peer and have the same service function. For most enterprise users who use ex-situ dual-activity systems to conduct transactions, how to effectively shunt the traffic (e.g., transaction traffic) to the systems in different regions is an unavoidable problem in using ex-situ dual-activity systems, as the systems are deployed in two different regions (e.g., shanghai and Wuhan).
Disclosure of Invention
The application provides a service distribution method, a device, equipment and a storage medium, and aims to effectively distribute services to systems in different areas.
In order to achieve the above object, the present application provides the following technical solutions:
a traffic splitting method, comprising:
reading a preset distributed cache, and obtaining configuration information of a preset identifier of a service message, wherein the configuration information comprises a key value pair, the key value pair is used for indicating a corresponding relation between the preset identifier and a target system, and the target system comprises a local system or a remote system; the preset identifier comprises a device number, a mechanism number or a fragment number of a database fragment to which the service message belongs, and is preselected from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements; the requirements include security, traffic splitting and operation and maintenance requirements;
And sending the service message to the target system according to the corresponding relation indicated by the key value pair.
Optionally, the preset identifier includes:
a device number;
the reading the preset distributed cache to obtain the configuration information of the preset identifier of the service message includes:
reading a preset distributed cache, and acquiring first configuration information of the equipment number; the first configuration information comprises a first key value pair, wherein the first key value pair is used for indicating the corresponding relation between the equipment number and the target system;
the sending the service message to the target system according to the corresponding relation indicated by the key value pair comprises the following steps:
and sending the service message to the target system according to the corresponding relation indicated by the first key value pair.
Optionally, the preset identifier includes:
a mechanism number;
the reading the preset distributed cache to obtain the configuration information of the preset identifier of the service message includes:
reading a preset distributed cache, and obtaining second configuration information of the mechanism number; the second configuration information comprises a second key value pair, wherein the second key value pair is used for indicating the corresponding relation between the mechanism number and the target system;
The sending the service message to the target system according to the corresponding relation indicated by the key value pair comprises the following steps:
and sending the service message to the target system according to the corresponding relation indicated by the second key value pair.
Optionally, the preset identifier includes:
the service message belongs to the fragment number of the database fragment;
the reading the preset distributed cache to obtain the configuration information of the preset identifier of the service message includes:
reading a preset distributed cache, and obtaining third configuration information of the fragment number; the third configuration information comprises a third key value pair, wherein the third key value pair is used for indicating the corresponding relation between the fragment number and the target system;
the sending the service message to the target system according to the corresponding relation indicated by the key value pair comprises the following steps:
and sending the service message to the target system according to the corresponding relation indicated by the third key value pair.
Optionally, the reading the preset distributed cache, and obtaining the third configuration information of the fragment number includes:
under the condition that the database fragments of the remote system fail, acquiring a target service message from the remote system, wherein the target service message is a service message stored in the failure database fragments;
Obtaining the equipment number of the target transaction message by unpacking the target service message;
calculating the fragment number of the fault database fragment based on the equipment number;
and acquiring third configuration information of the fragment number from a preset distributed cache according to the fragment number.
Optionally, the calculating the fragment number of the fault database fragment based on the device number includes:
obtaining the number of sub-tables and the total number of fragments of a database;
taking the number indicated by the target character as an integer value under the condition that the equipment number is the target character, wherein the target character comprises a number character;
under the condition that the equipment number is not the target character, carrying out hash calculation on the character indicated by the equipment number to obtain the integer value;
calculating the integer value by using the number of the sub-tables to obtain the number of the sub-table of the database to which the fault database fragment belongs;
and calculating the number by using the total number of fragments to obtain the fragment number of the fault database fragment.
Optionally, before the reading the preset distributed cache, the method further includes:
and acquiring a service message, and unpacking the service message to obtain the equipment number and the mechanism number of the service message.
A traffic splitting device comprising:
the system comprises an acquisition unit, a storage unit and a control unit, wherein the acquisition unit is used for reading a preset distributed cache and acquiring configuration information of a preset identifier of a service message, the configuration information comprises a key value pair, the key value pair is used for indicating the corresponding relation between the preset identifier and a target system, and the target system comprises a local system or a remote system; the preset identifier comprises a device number, a mechanism number or a fragment number of a database fragment to which the service message belongs, and is preselected from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements; the requirements include security, traffic splitting and operation and maintenance requirements;
and the sending unit is used for sending the service message to the target system according to the corresponding relation indicated by the key value pair.
A computer readable storage medium having stored thereon a computer program which, when run on a computer, performs the traffic splitting method.
A traffic splitting device comprising: a processor, a memory, and a bus; the processor is connected with the memory through the bus;
The memory is used for storing a program, and the processor is used for running the program, wherein the service diversion method is executed when the program runs.
According to the technical scheme, the preset distributed cache is read, and configuration information of the preset identifier of the service message is obtained. The configuration information comprises a key value pair, the key value pair is used for indicating the corresponding relation between a preset identifier and a target system, the target system comprises a local system or a remote system, the preset identifier comprises a device number, a mechanism number or a fragment number of a database fragment to which a service message belongs, and the preset identifier is preselected from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements, wherein the requirements comprise security, service distribution and operation and maintenance requirements. And sending the service message to the target system according to the corresponding relation indicated by the key value pair. Therefore, the preset identification is preselected from the device number, the organization number or the slicing number of the database slicing to which the service message belongs according to the configuration information of the preset identification stored in the distributed cache, so that the service is shunted in different required dimensions according to the shunting mode of the device number, the organization number and the slicing number, the service shunting effect is obvious, and the applicability is higher.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic diagram of a service splitting method provided in an embodiment of the present application;
fig. 2 is a schematic diagram of a method for calculating a fragment number according to an embodiment of the present application;
fig. 3 is a schematic diagram of another service splitting method according to an embodiment of the present application;
fig. 4 is a schematic flow chart of obtaining third configuration information of a fragment number according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a service splitting device provided in an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The flow provided by the embodiment of the application is applied to a remote double-activity system and is used for effectively shunting the service to the systems in different areas.
In the practical application process of service diversion, the applicant finds that:
because the security trust levels of the systems in the two regions are different, for example, the remote system is a newly built system, the security trust level is lower, the local system is a system which is used for a long time, and the security trust level is higher, so that in order to consider the security trust and ensure the processing efficiency and stability of the service, in the initial stage of deployment of the remote system, only a small amount of service is usually split, i.e. the service with a small amount is switched to the remote system for execution, so as to verify whether the remote system has the capability of bearing service split. In the process of initiating a service, a service initiating device (such as a pos machine) or a service initiating merchant (such as a local merchant) is generally used as a service initiator. For service initiation devices, the number of service initiation is small, and one service initiation device typically initiates only one service within a limited time. For the service initiating merchant, because the service initiating merchant comprises a large number of service initiating devices, compared with the service initiating device, the service initiating merchant is taken as a service initiating party, and the number of the initiated services is large.
Therefore, for the distribution of a small number of services, the distribution of a small number of services to a remote system by taking one service as a distribution dimension can be realized according to the distribution mode of the equipment number (i.e. the number of the service initiating equipment, such as the number of the pos machine: 0123). For example, 100 service initiation devices, each service initiation device initiates two services within one hour. And carrying out service initiation for 2 hours in total, sending out 400 parts of service, selecting a small amount of service (for example, 50 parts) from 400 parts of service, distributing 50 parts of service to a different-place system according to a device number distribution mode, and distributing the rest 120 parts to a local system.
After the distribution verification of a small amount of services is passed, the fact that the remote system has the capacity of bearing service distribution is determined, and then the distribution of a large amount of services to the remote system by taking a service set as a distribution dimension can be realized according to a distribution mode of an organization number (a code of a region where a service initiating merchant belongs, for example, 102000-Anhui). For example, 10 service initiating merchants, each service initiating merchant initiates 1000 services within one hour, and initiates 10000 services within 1 hour in total, and the local system and the remote system each bear 5000 services, so that 5000 services are distributed to the local system and 5000 services are distributed to the remote system according to the mode of mechanism number distribution.
In addition, whether the local system or the remote system, the database shards for storing the service message (typically, the service initiator will send the service message to the local system or the remote system during the process of initiating the service) may not be used for individual reasons. In the operation and maintenance process of the remote double-activity system, aiming at the situation that the database fragments in the remote system cannot be used, service messages stored in the fault database fragments can be switched to the local system for processing in a fragment number splitting mode. Of course, when the local system fails, the service message stored in the local system can be sent to the remote system in a splitting number splitting mode. In addition, in order to realize the operation and maintenance requirements under the condition that the database fragments in the local system or the remote system have no faults, the service messages stored in the database fragments of any one system can be sent to the other system in a split number splitting mode. For example, the remote system adopts a mysql database, a certain database fragment of the mysql database cannot be used, and in the process of operating and maintaining the remote system, the service message stored under the fault mysql database fragment is sent to the local system, so that the local system can bear the service to which the service message belongs, the loss of the service is avoided, and the reliability of operation and maintenance is improved.
Based on the findings of the applicant, the embodiments of the present application provide the following technical solutions: fig. 1 is a schematic diagram of a service splitting method according to an embodiment of the present application, and in the method shown in fig. 1, a transaction service is taken as an example for explanation.
The flow shown in fig. 1 may be executed by a server, specifically, the server receives a transaction message sent by a service initiator, and determines, according to configuration information stored in a distributed cache, a sending object of the transaction message, where in this embodiment, fig. 1 includes the following steps:
s101: and acquiring a transaction message.
S102: unpacking the transaction message to obtain the equipment number and the organization number.
The transaction message includes a device number and an organization number, and the specific implementation process of the device number and the organization number is obtained by unpacking the transaction message, which is known to those skilled in the art, and is not described herein.
S103: and reading a preset distributed cache, and judging whether the distributed cache has configuration information of the equipment number. If the configuration information of the device number exists in the distributed cache, S104 is executed, otherwise S105 is executed.
The configuration information of the device number includes a first Key-Value pair (Key-Value), where the first Key-Value pair is used to indicate a correspondence between the device number and a cluster name, and the cluster name is a cluster name of a local system or a remote system (for example, the cluster name of the local system is a Shanghai-nan cluster, and the cluster name of the remote system is a Wuhan-nan cluster).
It should be noted that, a cluster is a technology commonly adopted in the existing service system, and a cluster is a group of mutually independent computers interconnected through a high-speed network, where the computers form a group and are managed in a mode of a single system (i.e., a local system or a remote system), and the cluster is just like an independent server (i.e., a server to which the local system or the remote system belongs).
Specifically, the data format of the first key-value pair includes:
key = device number: value = cluster name.
The pair "abcdefgh" is represented by the first key value: "whSouthGroup" is taken as an example, the first bond value represents: device no abcdefgh: the Wuhan south cluster.
It should be noted that the distributed cache mentioned in this embodiment includes, but is not limited to, a hazelcast cache. The hazelcast cache adopts an embedded deployment mode, and each cache node is equal to each other, so that the cache invalidation problem caused by the fault of a single cache node can be avoided, and the consistency of cache data can be effectively ensured.
S104: and sending the transaction message to a local system or a remote system according to the corresponding relation indicated by the first key value pair.
The pair "abcdefgh" is represented by the first key value: "whSouthGroup" and "abd": for example, "shSouthGroup" indicates the correspondence between the device number abcdefgh and the south-martial-China cluster, and between the device number abd and the south-martial-China cluster, which belongs to a different-place system, and the south-martial-China cluster which belongs to a local system, so that the transaction message of the device number abcdefgh is sent to the different-place system. And sending the transaction message of the equipment number abd to a local system.
Obviously, according to the corresponding relation indicated by the first key value pair, the sending object of the transaction message is determined, so that a small number of businesses can be distributed to a different-place system by taking one business as a distribution dimension, in other words, the businesses can be distributed to the different-place system in a mode of distributing equipment numbers.
S105: and judging whether the configuration information of the organization number exists in the distributed cache. If there is configuration information of the organization number in the distributed cache, S106 is executed, otherwise S107 is executed.
The configuration information of the mechanism number comprises a second key value pair, and the second key value pair is used for indicating the corresponding relation between the mechanism number and the cluster name.
Specifically, the data format of the second key-value pair includes:
key = mechanism number: value = cluster name.
The second key value pair "101600": "shSouthGroup" is taken as an example, the second bond value pair represents: mechanism number 101600: and E, a Shanghai square cluster.
S106: and sending the transaction message to a local system or a remote system according to the corresponding relation indicated by the second key value pair.
With the second key value pair "101": "whSouthGroup" and "101600": for example, "shSouthGroup", the second key pair indicates the correspondence between the organization number 101 and the south-martial-China cluster, and between the organization number 101600 and the south-above-sea cluster, which belongs to a remote system, and the south-above-sea cluster belongs to a local system. And, the number of transaction messages with the organization number of 101 is 1000 parts, and the number of transaction messages with the organization number of 101600 is 1000 parts. Thus, 1000 transaction messages of the organization number 101 are sent to the off-site system. 1000 transaction messages of the organization number 101600 are sent to the local system.
Obviously, according to the corresponding relation indicated by the second key value pair, the sending object of the transaction message is determined, so that the service set is taken as the diversion dimension, and more services can be diverted to the different-place system, in other words, the service can be diverted to the different-place system according to the equipment number diversion mode.
S107: and sending the transaction message to a local system.
The distributed cache has no configuration information of the equipment number and the mechanism number, so that only the transaction message can be sent to the local system, i.e. service distribution is not performed.
S108: under the condition that the database fragments of the remote system are faulty, the target transaction message is obtained from the remote system, and the fragment number of the database fragment to which the target transaction message belongs is calculated through the equipment number obtained by unpacking the target transaction message.
The target transaction message is a transaction message stored in a fault database in a sliced manner, and the specific implementation process of calculating the slicing number of the database in which the target transaction message belongs through the equipment number of the target transaction message can be seen in the following steps and explanation of the steps shown in fig. 2.
Optionally, when the database fragment of the local system fails, a transaction message stored in the failed database fragment is obtained from the local system, and the fragment number of the database fragment to which the transaction message belongs is calculated through the equipment number obtained by unpacking the transaction message.
S109: and changing the configuration information of the fragment numbers pre-stored in the distributed cache, so that the changed configuration information indicates the corresponding relation between the fragment numbers and the local system.
The configuration information of the fragment number comprises a third key value pair, wherein the third key value pair is used for indicating the corresponding relation between the fragment number and a preset numerical value, and the preset numerical value indicates 0 or 1.
When the preset value indicates 0, the target transaction message stored in the database fragment to which the fragment number belongs in the remote system is sent to the local system. When the preset value indicates 1, the identification sends the target transaction message stored in the database fragment to which the fragment number belongs in the remote system to the local system.
Specifically, the data format of the third key-value pair includes:
key = fragment number: value=0 or 1.
The third key value pair "0": for the example of "1", the third key value represents: fragment number 0:1.
s110: and sending the target transaction message to the local system according to the corresponding relation indicated by the third key value pair.
The third key value pair "0": "1", "10": "1" and "20": for example, "0" indicates the correspondence between the third key value pair and the fragment numbers 0 and 1, the fragment numbers 10 and 1, and the fragment numbers 20 and 0. Therefore, the target transaction messages stored in the database fragments to which the fragment number 0 and the fragment number 10 belong are sent to the local system. And for the target transaction message which can be stored in a slicing way by the data of the slicing number 20, the target transaction message is kept to be stored in a different place system.
Obviously, under the condition of the fault of the remote system, the target transaction message in the remote system is determined and sent to the local system according to the corresponding relation indicated by the third key value pair, and the local system performs isolated storage on the target transaction message, so that the loss of the target transaction message stored in the fault database in the remote system in a fragmented manner is avoided.
It should be emphasized that in this embodiment, in the case that the database shards of the remote system or the local system have no fault, the technician may still set the corresponding relationship indicated by the third key value pair according to the operation and maintenance requirement, so as to selectively send the transaction message stored in the database shards under any one of the remote dual-activity systems to the other system.
In summary, according to the corresponding relationship indicated by the first key value pair stored in the preset distributed cache, the transaction message is sent to the local system or the remote system, so as to realize the diversion of the transaction service according to the device number diversion mode. And sending the transaction message to a local system or a remote system according to the corresponding relation indicated by the second key value pair stored in the distributed cache, so that the transaction service is split according to the mode of splitting the organization number. According to the operation and maintenance requirements, setting the corresponding relation indicated by the third key value pair stored in the distributed cache, and sending the transaction message stored in the database under any one system in the different-place double-activity system to the other system, so that the transaction service is split according to the splitting number splitting mode. Therefore, according to the first key value pair, the second key value pair and the third key value pair stored in the distributed cache, the service is split in different required dimensions according to the split mode of the equipment number, the mechanism number and the fragment number, the service splitting effect is obvious, and the applicability is strong.
As shown in fig. 2, a schematic diagram of a method for calculating a fragment number according to an embodiment of the present application includes the following steps:
s201: the number of the sub-tables and the total number of the sub-slices of the database are obtained.
In practical application, whether the local system or the remote system is used, the database is divided into a plurality of database sub-tables, the access data are generated in each database sub-table (namely, the transaction message is stored in the database sub-table), and each database sub-table has a unique number. Specifically, the number of the database sub-tables is 128, namely the database is divided into 128 database sub-tables, and each database sub-table is marked with a unique sub-table number.
In addition, in practical application, the database is segmented into a plurality of database segments, whether the local system or the remote system is adopted, the transaction message is stored in the database segments, and each database segment has a unique segment number.
The specific implementation process of obtaining the number of the sub-tables and the total number of the sub-slices of the database is known as a person skilled in the art, and will not be described herein.
S202: and judging whether the characters indicated by the equipment number of the transaction message are all numbers.
If the characters indicated by the device number of the transaction message are all numbers, S203 is executed, otherwise S204 is executed.
S203: the number indicated by the device number is taken as an integer value.
Specifically, if the device number is 123, the integer value is 123.
S204: and carrying out hash calculation on the character indicated by the equipment number to obtain an integer value.
The specific implementation process of performing hash calculation on the character indicated by the device number to obtain an integer value is known as common general knowledge familiar to those skilled in the art, specifically, the character indicated by the device number is mapped into a unique integer (i.e. hash value) through a hash function, and finally the hash value is used as the integer value.
S205: and calculating the integer value by using the number of the sub-tables of the database to obtain the number of the sub-table of the database to which the database fragment belongs.
S206: and calculating the number by using the total number of fragments of the database to obtain the fragment number of the fragment of the database to which the transaction message belongs.
In summary, the number indicated by the device number is taken as an integer value, or the hash calculation is performed on the character indicated by the device number, so as to obtain the integer value. And calculating the integer value by using the number of the sub-tables of the database to obtain the number of the sub-table of the database to which the database fragment belongs. And calculating the number by using the total number of fragments of the database to obtain the fragment number of the fragment of the database to which the transaction message belongs. Therefore, the embodiment can calculate the fragment number of the database fragment to which the transaction message belongs through the equipment number of the transaction message.
The steps provided in fig. 1 may be summarized as a flow shown in fig. 3.
As shown in fig. 3, a schematic diagram of another service splitting method provided in an embodiment of the present application includes the following steps:
s301: and reading a preset distributed cache to obtain configuration information of a preset identifier of the service message.
The configuration information comprises a key value pair, the key value pair is used for indicating the corresponding relation between a preset identifier and a target system, the target system comprises a local system or a remote system, the preset identifier comprises a device number, a mechanism number or a fragment number of a database fragment to which a service message belongs, and the preset identifier is preselected from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements, wherein the requirements comprise security, service distribution and operation and maintenance requirements.
Optionally, before the preset distributed cache is read, a service message may be further obtained, and the service message is unpacked to obtain a device number and an organization number of the service message.
S302: and sending the service message to the target system according to the corresponding relation indicated by the key value pair.
Optionally, if the preset identifier is the equipment number, reading a preset distributed cache to obtain first configuration information of the equipment number. The first configuration information comprises a first key value pair, and the first key value pair is used for indicating the corresponding relation between the equipment number and the target system. And sending the service message to the target system according to the corresponding relation indicated by the first key value pair.
Optionally, if the preset identifier is the mechanism number, the preset distributed cache is read, and the second configuration information of the mechanism number is obtained. The second configuration information comprises a second key value pair, and the second key value pair is used for indicating the corresponding relation between the mechanism number and the target system. And sending the service message to the target system according to the corresponding relation indicated by the second key value pair.
Optionally, if the preset identifier is a fragment number of a database fragment to which the service message belongs, the preset distributed cache is read, and third configuration information of the fragment number is obtained. The third configuration information comprises a third key value pair, and the third key value pair is used for indicating the corresponding relation between the fragment number and the target system. And sending the service message to the target system according to the corresponding relation indicated by the third key value pair.
It should be noted that, the specific implementation process of reading the preset distributed cache and obtaining the third configuration information of the fragment number may refer to the steps shown in fig. 4 and the explanation of the steps described below.
In summary, the preset distributed cache is read, and configuration information of a preset identifier of the service message is obtained. The configuration information comprises a key value pair, the key value pair is used for indicating the corresponding relation between a preset identifier and a target system, the target system comprises a local system or a remote system, the preset identifier comprises a device number, a mechanism number or a fragment number of a database fragment to which a service message belongs, and the preset identifier is preselected from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements, wherein the requirements comprise security, service distribution and operation and maintenance requirements. And sending the service message to the target system according to the corresponding relation indicated by the key value pair. As can be seen, in this embodiment, according to the configuration information of the preset identifier stored in the distributed cache, the preset identifier is preselected from the device number, the organization number or the fragment number of the database fragment to which the service message belongs according to the requirement, so as to realize the shunting of the service in different requirement dimensions according to the shunting modes of the device number, the organization number and the fragment number, with remarkable service shunting effect and strong applicability.
As shown in fig. 4, a flowchart of obtaining third configuration information of a fragment number according to an embodiment of the present application includes the following steps:
s401: and under the condition that the database fragments of the remote system fail, acquiring the target service message from the remote system.
The target service message is a service message stored in a fault database in a slicing way.
S402: and obtaining the equipment number of the target transaction message by unpacking the target service message.
The specific implementation process of obtaining the device number of the target transaction message by unpacking the target service message is known as a person skilled in the art, and will not be described herein.
S403: based on the device number, a shard number of the failed database shard is calculated.
The specific implementation process of calculating the fragment number of the fault database fragment is consistent with the implementation flow of the fragment number calculation method shown in fig. 2, and specifically can be summarized as the following steps:
1. the number of the sub-tables and the total number of the sub-slices of the database are obtained.
2. In the case where the device number is a target character, the number indicated by the target character is taken as an integer value, and the target character includes a number character.
3. And under the condition that the equipment number is not the target character, carrying out hash calculation on the character indicated by the equipment number to obtain an integer value.
4. And calculating the integer value by using the number of the sub-tables to obtain the number of the sub-table of the database to which the fault database fragment belongs.
5. And calculating the number by using the total number of fragments to obtain the fragment number of the fault database fragment.
S404: and acquiring third configuration information of the fragment number from a preset distributed cache according to the fragment number.
In summary, based on the flow provided in this embodiment, the third configuration information of the fragment number can be effectively obtained, and the fragment number of the fault database fragment can be calculated based on the device number, so as to implement the splitting of the service in different operation and maintenance requirement dimensions according to the splitting manner of the fragment number, and improve the applicability of service splitting.
Corresponding to the service splitting method provided by the application, the embodiment of the application also provides a service splitting device.
Fig. 5 is a schematic structural diagram of a service splitting device according to an embodiment of the present application, where the service splitting device includes:
the unpacking unit 100 is configured to obtain a service packet, and unpack the service packet to obtain a device number and an organization number of the service packet.
The obtaining unit 200 is configured to read a preset distributed cache, obtain configuration information of a preset identifier of a service packet, where the configuration information includes a key value pair, and the key value pair is used to indicate a correspondence between the preset identifier and a target system, and the target system includes a local system or a remote system. The preset identifier comprises a device number, a mechanism number or a fragment number of a database fragment to which the service message belongs, and is preselected from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements. The requirements include security, traffic splitting, and operation and maintenance requirements.
The obtaining unit 200 is specifically configured to read a preset distributed cache, and obtain first configuration information of the device number, where the first configuration information includes a first key value pair, and the first key value pair is used to indicate a corresponding relationship between the device number and the target system.
The obtaining unit 200 is specifically configured to read a preset distributed cache, and obtain second configuration information of the mechanism number; the second configuration information comprises a second key value pair, and the second key value pair is used for indicating the corresponding relation between the mechanism number and the target system.
The obtaining unit 200 is specifically configured to read a preset distributed cache, and obtain third configuration information of the fragment number, where the third configuration information includes a third key value pair, and the third key value pair is used to indicate a correspondence between the fragment number and the target system.
The specific implementation process of the obtaining unit 200 for reading the preset distributed cache and obtaining the third configuration information of the fragment number includes: under the condition that the database fragments of the remote system fail, the target service message is obtained from the remote system, and the target service message is the service message stored in the failure database fragments. And obtaining the equipment number of the target transaction message by unpacking the target service message. Based on the device number, a shard number of the failed database shard is calculated. And acquiring third configuration information of the fragment number from a preset distributed cache according to the fragment number.
The specific implementation process of the obtaining unit 200 for calculating the fragment number of the fault database fragment based on the device number includes: and obtaining the number of the sub-tables and the total number of the fragments of the database, and taking the number indicated by the target character as an integer value when the equipment number is the target character, wherein the target character comprises the number character. And under the condition that the equipment number is not the target character, carrying out hash calculation on the character indicated by the equipment number to obtain an integer value. And calculating the integer value by using the number of the sub-tables to obtain the number of the sub-table of the database to which the fault database fragment belongs. And calculating the number by using the total number of fragments to obtain the fragment number of the fault database fragment.
And the sending unit 300 is configured to send the service packet to the target system according to the corresponding relationship indicated by the key value pair.
The sending unit 300 is specifically configured to send the service packet to the target system according to the corresponding relationship indicated by the first key value pair.
The sending unit 300 is specifically configured to send the service packet to the target system according to the corresponding relationship indicated by the second key value pair.
The sending unit 300 is specifically configured to send the service packet to the target system according to the corresponding relationship indicated by the third key value pair.
In summary, the preset distributed cache is read, and configuration information of a preset identifier of the service message is obtained. The configuration information comprises a key value pair, the key value pair is used for indicating the corresponding relation between a preset identifier and a target system, the target system comprises a local system or a remote system, the preset identifier comprises a device number, a mechanism number or a fragment number of a database fragment to which a service message belongs, and the preset identifier is preselected from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements, wherein the requirements comprise security, service distribution and operation and maintenance requirements. And sending the service message to the target system according to the corresponding relation indicated by the key value pair. As can be seen, in this embodiment, according to the configuration information of the preset identifier stored in the distributed cache, the preset identifier is preselected from the device number, the organization number or the fragment number of the database fragment to which the service message belongs according to the requirement, so as to realize the shunting of the service in different requirement dimensions according to the shunting modes of the device number, the organization number and the fragment number, with remarkable service shunting effect and strong applicability.
The application also provides a storage medium, wherein the storage medium comprises a stored program, and the program executes the service diversion method provided by the application.
The application also provides a service diversion device, which comprises: a processor, a memory, and a bus. The processor is connected with the memory through a bus, the memory is used for storing a program, and the processor is used for running the program, wherein the service diversion method provided by the application is executed when the program runs.
The functions described in the methods of the present application, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computing device readable storage medium. Based on such understanding, a portion of the embodiments of the present application that contributes to the prior art or a portion of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computing device (which may be a personal computer, a server, a mobile computing device or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (7)

1. A traffic splitting method, comprising:
reading a preset distributed cache, and obtaining configuration information of a preset identifier of a service message, wherein the configuration information comprises a key value pair, the key value pair is used for indicating a corresponding relation between the preset identifier and a target system, and the target system comprises a local system or a remote system; the preset identifier comprises a device number, a mechanism number or a fragment number of a database fragment to which the service message belongs, and is preselected from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements; the requirements include security, traffic splitting and operation and maintenance requirements;
According to the corresponding relation indicated by the key value pair, sending the service message to the target system;
the preset mark comprises:
the service message belongs to the fragment number of the database fragment;
the reading the preset distributed cache to obtain the configuration information of the preset identifier of the service message includes:
reading a preset distributed cache, and obtaining third configuration information of the fragment number; the third configuration information comprises a third key value pair, wherein the third key value pair is used for indicating the corresponding relation between the fragment number and the target system;
the sending the service message to the target system according to the corresponding relation indicated by the key value pair comprises the following steps:
according to the corresponding relation indicated by the third key value pair, sending the service message to the target system;
the reading the preset distributed cache, and obtaining the third configuration information of the fragment number includes:
under the condition that the database fragments of the remote system fail, acquiring a target service message from the remote system, wherein the target service message is a service message stored in the failure database fragments;
obtaining the equipment number of the target service message by unpacking the target service message;
Calculating the fragment number of the fault database fragment based on the equipment number;
acquiring third configuration information of the fragment number from a preset distributed cache according to the fragment number;
the calculating the fragment number of the fault database fragment based on the equipment number comprises the following steps:
obtaining the number of sub-tables and the total number of fragments of a database;
taking the number indicated by the target character as an integer value under the condition that the equipment number is the target character, wherein the target character comprises a number character;
under the condition that the equipment number is not the target character, carrying out hash calculation on the character indicated by the equipment number to obtain the integer value;
calculating the integer value by using the number of the sub-tables to obtain the number of the sub-table of the database to which the fault database fragment belongs;
and calculating the number by using the total number of fragments to obtain the fragment number of the fault database fragment.
2. The method of claim 1, wherein the preset identification further comprises:
a device number;
the reading the preset distributed cache, obtaining the configuration information of the preset identifier of the service message, and further includes:
Reading a preset distributed cache, and acquiring first configuration information of the equipment number; the first configuration information comprises a first key value pair, wherein the first key value pair is used for indicating the corresponding relation between the equipment number and the target system;
the step of sending the service message to the target system according to the corresponding relation indicated by the key value pair, and the method further comprises the following steps:
and sending the service message to the target system according to the corresponding relation indicated by the first key value pair.
3. The method of claim 1, wherein the preset identification further comprises:
a mechanism number;
the reading the preset distributed cache, obtaining the configuration information of the preset identifier of the service message, and further includes:
reading a preset distributed cache, and obtaining second configuration information of the mechanism number; the second configuration information comprises a second key value pair, wherein the second key value pair is used for indicating the corresponding relation between the mechanism number and the target system;
the step of sending the service message to the target system according to the corresponding relation indicated by the key value pair, and the method further comprises the following steps:
and sending the service message to the target system according to the corresponding relation indicated by the second key value pair.
4. A method according to any one of claims 1-3, wherein before said reading the preset distributed cache, further comprises:
and acquiring a service message, and unpacking the service message to obtain the equipment number and the mechanism number of the service message.
5. A traffic splitting device, comprising:
the system comprises an acquisition unit, a storage unit and a control unit, wherein the acquisition unit is used for reading a preset distributed cache and acquiring configuration information of a preset identifier of a service message, the configuration information comprises a key value pair, the key value pair is used for indicating the corresponding relation between the preset identifier and a target system, and the target system comprises a local system or a remote system; the preset identifier comprises a device number, a mechanism number or a fragment number of a database fragment to which the service message belongs, and is preselected from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements; the requirements include security, traffic splitting and operation and maintenance requirements;
the sending unit is used for sending the service message to the target system according to the corresponding relation indicated by the key value pair;
the preset mark comprises:
The service message belongs to the fragment number of the database fragment;
the obtaining unit reads a preset distributed cache to obtain configuration information of a preset identifier of a service message, and the method comprises the following steps:
the acquisition unit reads a preset distributed cache and acquires third configuration information of the fragment number; the third configuration information comprises a third key value pair, wherein the third key value pair is used for indicating the corresponding relation between the fragment number and the target system;
the sending unit sends the service message to the target system according to the corresponding relation indicated by the key value pair, and the sending unit comprises the following steps:
according to the corresponding relation indicated by the third key value pair, sending the service message to the target system;
the obtaining unit reads a preset distributed cache, obtains third configuration information of the fragment number, and includes:
under the condition that the database fragments of the remote system fail, acquiring a target service message from the remote system, wherein the target service message is a service message stored in the failure database fragments;
obtaining the equipment number of the target service message by unpacking the target service message;
calculating the fragment number of the fault database fragment based on the equipment number;
Acquiring third configuration information of the fragment number from a preset distributed cache according to the fragment number;
the calculating the fragment number of the fault database fragment based on the equipment number comprises the following steps:
obtaining the number of sub-tables and the total number of fragments of a database;
taking the number indicated by the target character as an integer value under the condition that the equipment number is the target character, wherein the target character comprises a number character;
under the condition that the equipment number is not the target character, carrying out hash calculation on the character indicated by the equipment number to obtain the integer value;
calculating the integer value by using the number of the sub-tables to obtain the number of the sub-table of the database to which the fault database fragment belongs;
and calculating the number by using the total number of fragments to obtain the fragment number of the fault database fragment.
6. A computer readable storage medium having stored thereon a computer program, characterized in that the computer program, when run on a computer, performs the traffic splitting method according to any of claims 1-4.
7. A traffic splitting device, comprising: a processor, a memory, and a bus; the processor is connected with the memory through the bus;
The memory is configured to store a program, and the processor is configured to execute the program, wherein the program executes the service splitting method according to any one of claims 1 to 4.
CN202010680188.4A 2020-07-15 2020-07-15 Service distribution method, device, equipment and storage medium Active CN111897791B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010680188.4A CN111897791B (en) 2020-07-15 2020-07-15 Service distribution method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010680188.4A CN111897791B (en) 2020-07-15 2020-07-15 Service distribution method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111897791A CN111897791A (en) 2020-11-06
CN111897791B true CN111897791B (en) 2024-01-12

Family

ID=73191728

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010680188.4A Active CN111897791B (en) 2020-07-15 2020-07-15 Service distribution method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111897791B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112929280A (en) * 2021-01-21 2021-06-08 中信银行股份有限公司 Application request processing method and system and computer readable storage medium
CN113961602B (en) * 2021-10-28 2022-08-19 中国西安卫星测控中心 Configuration method of distributed aerospace measurement and control data processing system

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7353196B1 (en) * 1999-10-29 2008-04-01 Computer Sciences Corporation Configuring dynamic database packageset switching for use in processing business transactions
WO2017012492A1 (en) * 2015-07-22 2017-01-26 阿里巴巴集团控股有限公司 Form identifier generation method, form shunting method and apparatus
CN106549878A (en) * 2016-10-26 2017-03-29 中国银联股份有限公司 A kind of service shunting method and device
WO2018059222A1 (en) * 2016-09-28 2018-04-05 杭州海康威视数字技术股份有限公司 File slice uploading method and apparatus, and cloud storage system
CN109379397A (en) * 2018-08-31 2019-02-22 阿里巴巴集团控股有限公司 Transaction common recognition processing method and processing device, electronic equipment based on block chain
WO2019149019A1 (en) * 2018-01-30 2019-08-08 深圳壹账通智能科技有限公司 Data interaction method and apparatus, computer device, and storage medium
CN110418379A (en) * 2019-07-23 2019-11-05 上海易点时空网络有限公司 Diversion processing method and device for mobile device
CN110601990A (en) * 2019-10-30 2019-12-20 杭州迪普科技股份有限公司 Message distribution method and device
CN111343181A (en) * 2020-02-26 2020-06-26 中国邮政储蓄银行股份有限公司 Message processing method and system, data pool and computer readable storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080031254A1 (en) * 2006-08-07 2008-02-07 Satish Kumar Veerapuneni Two-pronged receive fragment processing in a wireless network
US11356445B2 (en) * 2017-03-28 2022-06-07 Amazon Technologies, Inc. Data access interface for clustered devices

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7353196B1 (en) * 1999-10-29 2008-04-01 Computer Sciences Corporation Configuring dynamic database packageset switching for use in processing business transactions
WO2017012492A1 (en) * 2015-07-22 2017-01-26 阿里巴巴集团控股有限公司 Form identifier generation method, form shunting method and apparatus
WO2018059222A1 (en) * 2016-09-28 2018-04-05 杭州海康威视数字技术股份有限公司 File slice uploading method and apparatus, and cloud storage system
CN106549878A (en) * 2016-10-26 2017-03-29 中国银联股份有限公司 A kind of service shunting method and device
WO2019149019A1 (en) * 2018-01-30 2019-08-08 深圳壹账通智能科技有限公司 Data interaction method and apparatus, computer device, and storage medium
CN109379397A (en) * 2018-08-31 2019-02-22 阿里巴巴集团控股有限公司 Transaction common recognition processing method and processing device, electronic equipment based on block chain
CN110418379A (en) * 2019-07-23 2019-11-05 上海易点时空网络有限公司 Diversion processing method and device for mobile device
CN110601990A (en) * 2019-10-30 2019-12-20 杭州迪普科技股份有限公司 Message distribution method and device
CN111343181A (en) * 2020-02-26 2020-06-26 中国邮政储蓄银行股份有限公司 Message processing method and system, data pool and computer readable storage medium

Also Published As

Publication number Publication date
CN111897791A (en) 2020-11-06

Similar Documents

Publication Publication Date Title
CN109391645B (en) Block chain lightweight processing method, block chain node and storage medium
CN107493340B (en) Data distribution verification method, device and system in block chain network
CN111897791B (en) Service distribution method, device, equipment and storage medium
CN110908833A (en) Data backup method, device and equipment and computer readable storage medium
CN111262726B (en) Configuration information updating method and device and computer readable storage medium
CN109918261B (en) Fault monitoring method, device, equipment and computer readable storage medium
CN109102273B (en) Method and system for realizing distributed intelligent payment routing
CN110602108B (en) Data communication method, device, equipment and storage medium based on block chain network
CN112671928A (en) Equipment centralized management architecture, load balancing method, electronic equipment and storage medium
CN110111095B (en) Payment transaction weight judging method and payment system
CN111311254A (en) Service processing method, device and system based on block chain
CN111026711A (en) Block chain based data storage method and device, computer equipment and storage medium
CN111242754B (en) Account data updating method and device and electronic equipment
CN108874947B (en) Data processing system and data processing method
CN113326503A (en) Certificate management method and computing device
CN114422331A (en) Disaster tolerance switching method, device and system
CN112436962B (en) Block chain consensus network dynamic expansion method, electronic device, system and medium
CN111708835B (en) Block chain data storage method and device
CN112087497A (en) Data synchronization method and device, electronic equipment and readable storage medium
CN111309801A (en) Method and device for fragmenting alliance chain
CN107395772B (en) Management method and management system for repeated data
US9374474B1 (en) System, method, and computer program for detecting duplicated telecommunications events in a consumer telecommunications network
CN112486726B (en) Time rollback method and system for blockchain
CN110392104B (en) Data synchronization method, system, server and storage medium
CN113760519A (en) Distributed transaction processing method, device and system and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant