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

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

Info

Publication number
CN111897791A
CN111897791A CN202010680188.4A CN202010680188A CN111897791A CN 111897791 A CN111897791 A CN 111897791A CN 202010680188 A CN202010680188 A CN 202010680188A CN 111897791 A CN111897791 A CN 111897791A
Authority
CN
China
Prior art keywords
fragment
service
value pair
configuration information
service message
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.)
Granted
Application number
CN202010680188.4A
Other languages
Chinese (zh)
Other versions
CN111897791B (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

Images

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a service distribution method, a device, equipment and a storage medium, which are 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 a preset identifier and a target system, the target system comprises a local system or a remote system, and the preset identifier is selected in advance from a device number, an organization number or a fragment number of a database fragment to which the service message belongs according to requirements. And sending the service message to a target system according to the corresponding relation indicated by the key value pair. Therefore, according to the configuration information of the preset identifier stored in the distributed cache, the preset identifier is pre-selected from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to the requirement, so that the service is shunted in different requirement dimensions according to the shunting mode of the device number, the mechanism number and the fragment number, the service shunting effect is obvious, and the applicability is strong.

Description

Service distribution method, device, equipment and storage medium
Technical Field
The present application relates to the field of information processing technologies, and in particular, to a method, an apparatus, a device, and a storage medium for service offloading.
Background
The remote dual-active system refers to that two systems are respectively deployed at two places, which can be called as 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 using the remote live system for transaction, since the system is deployed in two different areas (for example, shanghai and wuhan), how to effectively distribute services (for example, transaction services) to the systems in different areas is an inevitable problem in using the remote live system.
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 regions.
In order to achieve the above object, the present application provides the following technical solutions:
a service distribution method comprises the following steps:
reading a preset distributed cache, and acquiring 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 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 identification comprises a device number, an organization number or a fragment number of a database fragment to which the service message belongs, and is selected in advance from the device number, the organization number or the fragment number of the database fragment to which the service message belongs according to requirements; the requirements comprise safety, 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.
Optionally, the preset identifier includes:
a device number;
the reading of the preset distributed cache to obtain the configuration information of the preset identifier of the service packet includes:
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 device number and a target system;
the sending the service message to the target system according to the corresponding relationship indicated by the key value pair includes:
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:
an organization number;
the reading of the preset distributed cache to obtain the configuration information of the preset identifier of the service packet includes:
reading a preset distributed cache to obtain second configuration information of the organization number; wherein the second configuration information comprises a second key-value pair, the second key-value pair being used for indicating a correspondence relationship between the organization number and the target system;
the sending the service message to the target system according to the corresponding relationship indicated by the key value pair includes:
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 fragment number of the database fragment to which the service message belongs;
the reading of the preset distributed cache to obtain the configuration information of the preset identifier of the service packet includes:
reading a preset distributed cache to obtain third configuration information of the fragment number; wherein the third configuration information comprises a third key-value pair indicating a correspondence of the slice number with the target system;
the sending the service message to the target system according to the corresponding relationship indicated by the key value pair includes:
and sending the service message to the target system according to the corresponding relation indicated by the third key value pair.
Optionally, the reading a preset distributed cache, and obtaining third configuration information of the fragment number includes:
under the condition that a database fragment of a remote system fails, acquiring a target service message from the remote system, wherein the target service message is a service message stored in the failed database fragment;
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 segment number of the failure database segment based on the device number includes:
acquiring the sub-table number and the total fragment number of a database;
taking the number indicated by the target character as an integer value when the device number is the target character, wherein the target character comprises a numeric 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;
utilizing the sub-table number to carry out complementation on the integer value to obtain the serial number of the sub-table of the database to which the fault database fragment belongs;
and utilizing the total fragment number to carry out complementation on the serial number to obtain the fragment number of the fault database fragment.
Optionally, before 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 apparatus, comprising:
an obtaining unit, configured to read a preset distributed cache, and 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, where the target system includes a local system or a remote system; the preset identification comprises a device number, an organization number or a fragment number of a database fragment to which the service message belongs, and is selected in advance from the device number, the organization number or the fragment number of the database fragment to which the service message belongs according to requirements; the requirements comprise safety, service distribution 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, on which a computer program is stored, which, when run on a computer, performs the traffic offloading method.
A traffic offloading device, comprising: a processor, a memory, and a bus; the processor and the memory are connected through the bus;
the memory is used for storing programs, and the processor is used for executing programs, wherein the programs execute the service distribution method during running.
According to the technical scheme, the preset distributed cache is read, and the configuration information of the preset identification 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, the preset identifier is selected in advance from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements, and the requirements comprise safety, service distribution and operation and maintenance requirements. And sending the service message to a target system according to the corresponding relation indicated by the key value pair. Therefore, according to the configuration information of the preset identifier stored in the distributed cache, the preset identifier is pre-selected from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to the requirement, so that the service is shunted in different requirement dimensions according to the shunting mode of the device number, the mechanism number and the fragment number, the service shunting effect is obvious, and the applicability is strong.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic diagram of a service offloading method provided in an embodiment of the present application;
fig. 2 is a schematic diagram of a fragment number calculation method according to an embodiment of the present application;
fig. 3 is a schematic diagram of another service offloading method provided in an embodiment of the present application;
fig. 4 is a schematic flowchart of a process of obtaining third configuration information of a slice number according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a service offloading device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The flow provided by the embodiment of the application is applied to the remote dual-active system and is used for effectively shunting the service to systems in different areas.
In the practical application process of service distribution, 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 has been used for a long time, and the security trust level is higher, so that in consideration of security trust, and in order to ensure the processing efficiency and stability of the service, only a small amount of services are shunted aiming at the initial stage of the deployment of the remote system, that is, the services with small amount are switched from the local system to the remote system to be executed, so as to verify whether the remote system has the capability of undertaking service shunting. In the process of service initiation, a service initiation device (e.g., pos machine) or a service initiation merchant (e.g., a merchant at some place) is usually used as a service initiator. For the service initiating device, the number of service initiations is small, and one service initiating device usually initiates only one service in a limited time. For the service initiating merchant, because the service initiating merchant includes a larger number of service initiating devices, the number of initiated services is larger compared to the case where the service initiating device is used as a service initiating party.
Therefore, for the distribution situation of a small amount of services, it can be realized to distribute a small amount of services to a different-place system by using one service as a distribution dimension in a manner of distributing the service according to the equipment number (i.e. the number of the service initiating equipment, for example, the number of the pos machine: 0123). For example, 100 service initiating devices each initiate two services within one hour. And sending 400 services after carrying out service initiation for 2 hours in total, selecting a small amount of services (for example, 50 services) from the 400 services, distributing the 50 services to a remote system according to a device number distribution mode, and distributing the remaining 120 services to a local system.
After the shunting verification of a small amount of services is performed, it is determined that the remote system has the capability of undertaking service shunting, and then a large amount of services can be shunted to the remote system by using a service set as a shunting dimension in a shunting manner of an organization number (a code of a region to which a service initiating merchant belongs, such as 1020000-Anhui). For example, 10 service-initiating merchants respectively initiate 1000 services within one hour, 10000 services are initiated within 1 hour in total, and the local system and the remote system respectively 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 mechanism number distribution mode.
In addition, whether the local system or the remote system is used, the database fragment for storing the service packet (usually, the service initiator specifically sends the service packet to the local system or the remote system in the process of initiating the service) may be unusable due to individual reasons. In the operation and maintenance process of the remote dual-active system, aiming at the condition that the database fragments in the remote system cannot be used, the service messages stored by the fault database fragments can be switched to the local system for processing according to the fragment number distribution mode. Of course, when the local system fails, the service message stored in the local system may also be sent to the remote system in a split number splitting manner. In addition, under the condition that the database fragments in the local system or the remote system are not in fault, in order to realize the operation and maintenance requirements, the service message stored by the database fragment of any system can be sent to another system in a fragment number distribution mode. For example, a mysql database is adopted by the remote system, a certain database fragment of the mysql database cannot be used, and in the process of operation and maintenance of the remote system, a service message stored under the failed 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 above findings of the applicant, the embodiments of the present application provide the following technical solutions: fig. 1 is a schematic view of a service offloading method provided in an embodiment of the present application, and a transaction service is taken as an example in the method shown in fig. 1 for description.
The process shown in fig. 1 may be executed by a server, specifically, the server receives a transaction packet sent by a service initiator, and determines a sending object of the transaction packet according to configuration information stored in a distributed cache, in this embodiment, fig. 1 includes the following steps:
s101: and acquiring a transaction message.
S102: and unpacking the transaction message to obtain the equipment number and the organization number.
The transaction message includes the device number and the institution number, and the specific implementation process of unpacking the transaction message to obtain the device number and the institution number is common general knowledge familiar to those skilled in the art and will not be described herein again.
S103: and reading a preset distributed cache, and judging whether the configuration information of the equipment number exists in the distributed cache. If the configuration information of the device number exists in the distributed cache, executing S104, otherwise executing S105.
The configuration information of the device number includes a first Key-Value pair (Key-Value) used to indicate a correspondence between the device number and a cluster name, where 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 shanghai south cluster, and the cluster name of the remote system is wuhan south cluster).
It should be noted that, the cluster is a commonly used technology of the existing service system, the cluster is a group of mutually independent computers interconnected through a high-speed network, the computers form a group and are managed in the 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 is the equipment number: value is the name of the cluster.
By the first key value pair "abcdefgh": for "whsouthwgroup" as an example, the first key-value pair represents: device number abcdefgh: wuhan southern 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, each cache node is equal, the problem of cache failure 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.
By the first key value pair "abcdefgh": "whSouthGroup" and "abd": for example, "shSouthGroup" indicates the correspondence between the device number abcdefgh and the southern wuhan cluster, and the device number abd and the southern shanghai cluster, where the southern wuhan cluster belongs to a foreign system and the southern shanghai cluster belongs to a local system, and thus, the transaction message of the device number abcdefgh is sent to the foreign system. And sending the transaction message of the equipment number abd to a local system.
Obviously, the sending object of the transaction message is determined according to the corresponding relation indicated by the first key value pair, so that a small amount of services can be distributed to a remote system by taking one service as a distribution dimension, in other words, the services can be distributed to the remote system according to the equipment number distribution mode.
S105: and judging whether the configuration information of the organization number exists in the distributed cache. If the configuration information of the organization number exists in the distributed cache, S106 is executed, otherwise S107 is executed.
The configuration information of the organization number comprises a second key value pair, and the second key value pair is used for indicating the corresponding relation between the organization number and the cluster name.
Specifically, the data format of the second key-value pair includes:
key is the mechanism number: value is the name of the cluster.
With the second key-value pair "101600": for example, "shSouthGroup," the second key-value pair represents: agency No. 101600: shanghai south 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, "southwgroup" indicates the correspondence between organization number 101 and the south wuhan cluster, which belongs to a foreign system, and organization number 101600 and the south shanghai cluster, which belongs to a local system. The number of transaction messages with organization number 101 is 1000, and the number of transaction messages with organization number 101600 is 1000. Therefore, 1000 transaction messages of the organization number 101 are sent to the remote system. And sending 1000 transaction messages of the organization number 101600 to the local system.
Obviously, the sending object of the transaction message is determined according to the corresponding relation indicated by the second key value pair, so that a large number of services can be distributed to a different-place system by taking the service set as a distribution dimension, in other words, the services can be distributed to the different-place system according to the equipment number distribution mode.
S107: and sending the transaction message to a local system.
Since the distributed cache does not have the configuration information of the device number and the mechanism number, the transaction message can only be sent to the local system, that is, the service distribution is not performed.
S108: and under the condition that the database fragment of the remote system has a fault, acquiring a target transaction message from the remote system, and calculating the fragment number of the database fragment to which the target transaction message belongs through the equipment number obtained by unpacking the target transaction message.
The specific implementation process of calculating the fragment number of the database fragment to which the target transaction message belongs through the device number of the target transaction message may refer to the following steps shown in fig. 2 and an explanation of the steps.
Optionally, when a 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 device number obtained by unpacking the transaction message.
S109: and changing the configuration information of the fragment number prestored in the distributed cache, so that the changed configuration information indicates the corresponding relation between the fragment number and the local system.
The configuration information of the slicing number comprises a third key value pair, the third key value pair is used for indicating the corresponding relation between the slicing number and a preset numerical value, and the preset numerical value indicates 0 or 1.
It should be noted that, when the preset value indicates 0, it indicates that the target transaction message stored in the database segment to which the segment number belongs in the remote system is sent to the local system. And when the preset numerical value indicates 1, the identifier sends a 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 is the number of fragmentation: value is 0 or 1.
"0" by third key value: "1" is an example, and the third key value pair represents: fragment number 0: 1.
s110: and sending the target transaction message to a local system according to the corresponding relation indicated by the third key value pair.
"0" by third key value: "1", "10": "1" and "20": "0" is an example, and the third key value pair indicates the correspondence of the slice numbers 0 and 1, the slice numbers 10 and 1, and the slice numbers 20 and 0. Therefore, the target transaction message stored in the database fragment to which the fragment number 0 and the fragment number 10 belong is sent to the local system. And keeping storing the target transaction message of which the data to which the fragment number 20 belongs can be stored in a remote system in a fragment mode.
Obviously, under the condition of a fault of the remote system, the target transaction message in the remote system is determined according to the indicated corresponding relation of the third key value pair and is sent to the local system, and the local system carries out isolated storage on the target transaction message, so that the target transaction message stored in the fault database in the remote system in a fragmentation mode is prevented from being lost.
It should be emphasized that, in this embodiment, in the case that the database fragment of the remote system or the local system has 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 fragment of any one of the remote dual-active systems to the other system.
In summary, the transaction message is sent to the local system or the remote system according to the corresponding relationship indicated by the first key value pair stored in the preset distributed cache, so that the transaction service is distributed according to the equipment number distribution 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, thereby realizing the shunting of transaction services according to the mechanism number shunting mode. And setting the corresponding relation indicated by the third key value pair stored in the distributed cache according to the operation and maintenance requirements, and sending the transaction message stored in the database in a fragmentation mode under any one system in the remote dual-active system to the other system, thereby realizing the shunting of transaction services according to the fragmentation number shunting mode. As can be seen, in this embodiment, 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 shunted in different demand dimensions according to the shunting manner of the device number, the organization number, and the fragmentation number, and the service shunting effect is significant, and the applicability is strong.
As shown in fig. 2, a schematic diagram of a fragment number calculation method provided in the embodiment of the present application includes the following steps:
s201: and acquiring the sub-table number and the total fragment number of the database.
In practical application, no matter a local system or a remote system, the databases are divided into tables, the general table is divided into a plurality of database sub-tables, the access data is 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, that is, the database is divided into 128 database sub-tables, and each database sub-table is labeled with a unique sub-table number.
In addition, in practical application, no matter a local system or a remote system, the database is also fragmented, the database is divided into a plurality of database fragments, the transaction message is stored in the database fragments, and each database fragment has a unique fragment number.
The specific implementation process for obtaining the number of the sub-tables and the total number of the sub-tables of the database is common knowledge familiar to those skilled in the art, and will not be described herein again.
S202: and judging whether the characters indicated by the equipment number of the transaction message are all numbers.
If all the characters indicated by the device number of the transaction message are numbers, executing S203, otherwise executing S204.
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 characters indicated by the equipment numbers to obtain integer values.
For a specific implementation process of obtaining an integer value by performing hash calculation on a character indicated by a device number, it is common knowledge familiar to those skilled in the art that specifically, the character indicated by the device number is mapped into a unique integer (i.e., a hash value) by a hash function, and finally, the hash value is used as the integer value.
S205: and (4) carrying out remainder on the whole numerical value by utilizing the number of the sub-tables of the database to obtain the serial number of the sub-tables of the database to which the database fragments belong.
S206: and (4) the total number of the fragments of the database is utilized to carry out remainder on the serial number to obtain the fragment number of the database fragment to which the transaction message belongs.
To sum up, the number indicated by the device number is used as an integer value, or the hash calculation is performed on the character indicated by the device number to obtain an integer value. And (4) carrying out remainder on the whole numerical value by utilizing the number of the sub-tables of the database to obtain the serial number of the sub-tables of the database to which the database fragments belong. And (4) the total number of the fragments of the database is utilized to carry out remainder on the serial number to obtain the fragment number of the database fragment to which the transaction message belongs. Therefore, in this embodiment, the fragment number of the database fragment to which the transaction message belongs may be calculated and obtained through the device number of the transaction message.
It should be noted that the steps provided in fig. 1 can be summarized as the flow shown in fig. 3.
As shown in fig. 3, a schematic diagram of another service offloading method provided in the embodiment of the present application includes the following steps:
s301: and reading the preset distributed cache, and acquiring the configuration information of the 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, the preset identifier is selected in advance from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements, and the requirements comprise safety, service distribution and operation and maintenance requirements.
Optionally, before reading the preset distributed cache, the service packet may also be obtained, and the service packet is unpacked to obtain the device number and the mechanism number of the service packet.
S302: and sending the service message to a target system according to the corresponding relation indicated by the key value pair.
Optionally, if the preset identifier is the device number, the preset distributed cache is read, and the first configuration information of the device number is obtained. 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 device number and the target system. And sending the service message to a target system according to the corresponding relation indicated by the first key value pair.
Optionally, if the preset identifier is the mechanism number, reading the preset distributed cache, and acquiring 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. 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 packet belongs, reading the preset distributed cache, and acquiring third configuration information of the fragment number. And 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, for a specific implementation process of reading the preset distributed cache and acquiring the third configuration information of the slice number, reference may be made to the following steps shown in fig. 4 and an explanation of the steps.
In summary, the preset distributed cache is read, and the configuration information of the preset identifier of the service packet 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, the preset identifier is selected in advance from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements, and the requirements comprise safety, service distribution and operation and maintenance requirements. And sending the service message to a target system according to the corresponding relation indicated by the key value pair. It can be seen that, in this embodiment, according to configuration information of a preset identifier stored in a distributed cache, the preset identifier is pre-selected from a device number, an organization number, or a fragment number of a database fragment to which a service packet belongs according to a requirement, so that a service is shunted in different requirement dimensions according to a shunting manner of the device number, the organization number, and the fragment number, and the service shunting effect is significant and the applicability is strong.
As shown in fig. 4, a flowchart for acquiring the third configuration information of the tile number provided in the embodiment of the present application includes the following steps:
s401: and under the condition that the database fragment of the remote system has a fault, acquiring a target service message from the remote system.
The target service message is a service message stored in a fault database in a fragmentation mode.
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 common general knowledge familiar to those skilled in the art, and is not described herein again.
S403: and calculating the fragment number of the fault database fragment based on the equipment number.
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 may be summarized as the following steps:
1. and acquiring the sub-table number and the total fragment number of the database.
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 numeric 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 (4) utilizing the number of the sub-tables to carry out remainder on the whole numerical value to obtain the serial number of the sub-tables of the database to which the fault database fragment belongs.
5. And (4) the total number of the fragments is used for carrying out redundancy on the serial numbers to obtain the fragment numbers of the fault database fragments.
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 process 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 that the service is shunted in different operation and maintenance requirement dimensions according to the shunting manner of the fragment number, and the applicability of service shunting is improved.
Corresponding to the service offloading method provided by the present application, an embodiment of the present application further provides a service offloading device.
As shown in fig. 5, a schematic structural diagram of a service offloading device provided in an embodiment of the present application includes:
and the unpacking unit 100 is configured to obtain the service packet, and unpack the service packet to obtain the device number and the mechanism number of the service packet.
The obtaining unit 200 is configured to read a preset distributed cache, and 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, an organization number or a fragment number of a database fragment to which the service message belongs, and is selected in advance from the device number, the organization number or the fragment number of the database fragment to which the service message belongs according to requirements. The requirements include security, traffic offload, 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 correspondence 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 organization 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 corresponding relationship between the fragment number and the target system.
The specific implementation process of the obtaining unit 200, configured to read a preset distributed cache and obtain the third configuration information of the slice number, includes: and under the condition that the database fragment of the remote system has a fault, acquiring a target service message from the remote system, wherein the target service message is a service message stored in the fault database fragment. And obtaining the equipment number of the target transaction message by unpacking the target service message. And 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.
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 acquiring the sub-table number and the total fragment number of the database, and 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 the numeric 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 (4) utilizing the number of the sub-tables to carry out remainder on the whole numerical value to obtain the serial number of the sub-tables of the database to which the fault database fragment belongs. And (4) the total number of the fragments is used for carrying out redundancy on the serial numbers to obtain the fragment numbers of the fault database fragments.
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 the configuration information of the preset identifier of the service packet 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, the preset identifier is selected in advance from the device number, the mechanism number or the fragment number of the database fragment to which the service message belongs according to requirements, and the requirements comprise safety, service distribution and operation and maintenance requirements. And sending the service message to a target system according to the corresponding relation indicated by the key value pair. It can be seen that, in this embodiment, according to configuration information of a preset identifier stored in a distributed cache, the preset identifier is pre-selected from a device number, an organization number, or a fragment number of a database fragment to which a service packet belongs according to a requirement, so that a service is shunted in different requirement dimensions according to a shunting manner of the device number, the organization number, and the fragment number, and the service shunting effect is significant and the applicability is strong.
The application also provides a storage medium, where the storage medium includes a stored program, and the program executes the service offloading method provided by the application.
The present application further provides a service offloading device, including: a processor, a memory, and a bus. The processor is connected with the memory through a bus, the memory is used for storing programs, and the processor is used for running the programs, wherein the service distribution method provided by the application is executed when the programs are run.
The functions described in the method of the embodiment of the present application, if implemented in the form of software functional units and sold or used as independent products, may be stored in a storage medium readable by a computing device. Based on such understanding, part of the contribution to the prior art of the embodiments of the present application or part of the technical solution may be embodied in the form of a software product stored in a storage medium and including several instructions for causing a computing device (which may be a personal computer, a server, a mobile computing device or a network device) to execute all or part of the steps of the method 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), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among 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 (10)

1. A service offloading method, comprising:
reading a preset distributed cache, and acquiring 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 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 identification comprises a device number, an organization number or a fragment number of a database fragment to which the service message belongs, and is selected in advance from the device number, the organization number or the fragment number of the database fragment to which the service message belongs according to requirements; the requirements comprise safety, 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.
2. The method of claim 1, wherein the preset identification comprises:
a device number;
the reading of the preset distributed cache to obtain the configuration information of the preset identifier of the service packet includes:
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 device number and a target system;
the sending the service message to the target system according to the corresponding relationship indicated by the key value pair includes:
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 comprises:
an organization number;
the reading of the preset distributed cache to obtain the configuration information of the preset identifier of the service packet includes:
reading a preset distributed cache to obtain second configuration information of the organization number; wherein the second configuration information comprises a second key-value pair, the second key-value pair being used for indicating a correspondence relationship between the organization number and the target system;
the sending the service message to the target system according to the corresponding relationship indicated by the key value pair includes:
and sending the service message to the target system according to the corresponding relation indicated by the second key value pair.
4. The method of claim 1, wherein the preset identification comprises:
the fragment number of the database fragment to which the service message belongs;
the reading of the preset distributed cache to obtain the configuration information of the preset identifier of the service packet includes:
reading a preset distributed cache to obtain third configuration information of the fragment number; wherein the third configuration information comprises a third key-value pair indicating a correspondence of the slice number with the target system;
the sending the service message to the target system according to the corresponding relationship indicated by the key value pair includes:
and sending the service message to the target system according to the corresponding relation indicated by the third key value pair.
5. The method according to claim 4, wherein the reading the preset distributed cache to obtain the third configuration information of the slice number includes:
under the condition that a database fragment of a remote system fails, acquiring a target service message from the remote system, wherein the target service message is a service message stored in the failed database fragment;
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.
6. The method of claim 5, wherein the calculating the shard number of the failed database shard based on the device number comprises:
acquiring the sub-table number and the total fragment number of a database;
taking the number indicated by the target character as an integer value when the device number is the target character, wherein the target character comprises a numeric 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;
utilizing the sub-table number to carry out complementation on the integer value to obtain the serial number of the sub-table of the database to which the fault database fragment belongs;
and utilizing the total fragment number to carry out complementation on the serial number to obtain the fragment number of the fault database fragment.
7. The method according to any one of claims 1 to 6, wherein before reading the preset distributed cache, the method 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.
8. A traffic splitting apparatus, comprising:
an obtaining unit, configured to read a preset distributed cache, and 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, where the target system includes a local system or a remote system; the preset identification comprises a device number, an organization number or a fragment number of a database fragment to which the service message belongs, and is selected in advance from the device number, the organization number or the fragment number of the database fragment to which the service message belongs according to requirements; the requirements comprise safety, service distribution 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.
9. A computer-readable storage medium, on which a computer program is stored, which, when run on a computer, performs the traffic offloading method of claims 1-7.
10. A traffic offload device, comprising: a processor, a memory, and a bus; the processor and the memory are connected through the bus;
the memory is used for storing a program, and the processor is used for executing the program, wherein the program executes the traffic offload method according to claims 1-7.
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 true CN111897791A (en) 2020-11-06
CN111897791B 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)

Cited By (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
CN113961602A (en) * 2021-10-28 2022-01-21 中国西安卫星测控中心 Configuration method of distributed aerospace measurement and control data processing system

Citations (11)

* 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
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
US20180288049A1 (en) * 2017-03-28 2018-10-04 Amazon Technologies, Inc. Data access interface for clustered devices
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

Patent Citations (11)

* 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
US20080031254A1 (en) * 2006-08-07 2008-02-07 Satish Kumar Veerapuneni Two-pronged receive fragment processing in a wireless network
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
US20180288049A1 (en) * 2017-03-28 2018-10-04 Amazon Technologies, Inc. Data access interface for clustered devices
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

Cited By (3)

* 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
CN113961602A (en) * 2021-10-28 2022-01-21 中国西安卫星测控中心 Configuration method of distributed aerospace measurement and control data processing system
CN113961602B (en) * 2021-10-28 2022-08-19 中国西安卫星测控中心 Configuration method of distributed aerospace measurement and control data processing system

Also Published As

Publication number Publication date
CN111897791B (en) 2024-01-12

Similar Documents

Publication Publication Date Title
CN107493340B (en) Data distribution verification method, device and system in block chain network
WO2020143317A1 (en) Fragmented file verification method and terminal device
CN111897791A (en) Service distribution method, device, equipment and storage medium
CN110602108B (en) Data communication method, device, equipment and storage medium based on block chain network
CN112671928B (en) Equipment centralized management architecture, load balancing method, electronic equipment and storage medium
CN111526216B (en) Consensus method and system in alliance chain
CN110618890B (en) Fault processing method and device, electronic equipment and computer readable storage medium
WO2020048054A1 (en) Data storage method, computer-readable storage medium, server, and apparatus
WO2020119328A1 (en) Data transmission method, apparatus and device, and storage medium
EP3093789B1 (en) Storing structured information
CN114268957A (en) Abnormal business data processing method, device, server and storage medium
CN114422331B (en) Disaster recovery switching method, device and system
CN112436962B (en) Block chain consensus network dynamic expansion method, electronic device, system and medium
CN108874947B (en) Data processing system and data processing method
CN112087497B (en) Data synchronization method and device, electronic equipment and readable storage medium
CN112052141B (en) Data fragment verification method and device, computer equipment and readable storage medium
CN111783918B (en) Safe two-dimensional code distribution method and system
CN111309801A (en) Method and device for fragmenting alliance chain
US8995632B1 (en) System, method, and computer program for detecting duplicated telecommunications events in a consumer telecommunications network
CN110392104B (en) Data synchronization method, system, server and storage medium
CN111768196A (en) Transaction information confirmation method and device
CN113824755A (en) Method, system and related device for processing block chain data
CN111464581A (en) Multimedia file distributed distribution method for advertising player
CN113660346B (en) Method for broadcasting blocks on alliance chain
CN112468471B (en) Remote authorization method and device

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