[go: up one dir, main page]

WO2025001842A1 - Distributed database, message processing method and apparatus, and electronic device - Google Patents

Distributed database, message processing method and apparatus, and electronic device Download PDF

Info

Publication number
WO2025001842A1
WO2025001842A1 PCT/CN2024/098686 CN2024098686W WO2025001842A1 WO 2025001842 A1 WO2025001842 A1 WO 2025001842A1 CN 2024098686 W CN2024098686 W CN 2024098686W WO 2025001842 A1 WO2025001842 A1 WO 2025001842A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
service component
service
main
component
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.)
Pending
Application number
PCT/CN2024/098686
Other languages
French (fr)
Chinese (zh)
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.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Publication of WO2025001842A1 publication Critical patent/WO2025001842A1/en
Anticipated expiration legal-status Critical
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/062Securing storage systems
    • G06F3/0623Securing storage systems in relation to content
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]

Definitions

  • the present application relates to but is not limited to the field of databases.
  • the database supports multi-tenancy, and the data access and data storage of different tenants are isolated to ensure data security.
  • Each tenant needs to have a corresponding tenant configuration, and the configuration information of the tenant configuration is used to specify the tenant ID, tenant name, primary and backup bureaus, and other information of the tenant.
  • the power-on and message interaction of each module of the database depends on the correctness of the configuration information.
  • Distributed databases need to back up data, so there are multiple copies of data.
  • Each tenant has a corresponding primary or backup office (for example, the primary and backup offices can be set up in different locations).
  • the current networking mode is generally: the database has two offices, the primary office and the backup office, and each office has two tenants who back up data to each other.
  • the business accesses the database through the client.
  • the client executes the power-on process, it needs to obtain the configuration message from the database management node of the active station, and then obtain the distribution information and status information of the corresponding tenant's data node based on the tenant ID, tenant name, active and standby station information contained in the obtained configuration message, and finally reach the power-on success state.
  • the management node needs to send 1,000 notification messages to the client to notify it. If the state of the shards within 50 nodes switches, the management node needs to send 1,000*50 messages to the client in a short period of time.
  • the present application provides a distributed database, a message processing method, a device and an electronic device.
  • the present application provides a distributed database, comprising: a database management node, a main service component control unit and multiple service components;
  • the database management node is communicatively connected to the main service component control unit, and is configured to send a first message to the main service component control unit, or to receive a second message from the main service component control unit;
  • the main service component control unit is communicatively connected to the multiple service components, and is configured to forward the first message to each of the service components, or to forward the second message from each of the service components to the database management node;
  • the service component is configured to receive the first message from the main service component control unit, or to send the second message to the main service component control unit.
  • the present application provides a message processing method, applied to a main service component control unit, comprising: receiving a first message from a database management node; forwarding the first message to each of the service components; or, receiving a second message from each of the service components; forwarding the second message from each of the service components to the database management node.
  • the present application provides a message processing method, applied to a service component, comprising: receiving the first message from the main service component control unit, the first message being received by the main service component control unit from a database management node; or, sending the second message to the main service component control unit so that the main service component control unit forwards the second message to the database management node.
  • the present application provides a message processing device, applied to a main service component control unit, comprising: a first receiving module, configured to receive a first message from a database management node; a first forwarding module, configured to forward the first message to each of the service components; or, a second receiving module, configured to receive a second message from each of the service components; a second forwarding module, configured to forward the second message from each of the service components to the database management node.
  • the present application provides a message processing device, applied to a service component, including: a third receiving module, configured to receive the first message from the main service component control unit, the first message is received by the main service component control unit from a database management node; or, a first sending module, configured to send the second message to the main service component control unit, so that the main service component control unit forwards the second message to the database management node.
  • the present application provides an electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; the memory is configured to store a computer program; and the processor is configured to implement the message processing method described in any one of the second aspect or the message processing method described in any one of the third aspect when executing the program stored in the memory.
  • the present application provides a computer-readable storage medium, on which a program of a message processing method is stored.
  • the program of the message processing method is executed by a processor, the message processing method described in any one of the second aspect, or the message processing method described in any one of the third aspect, is implemented.
  • FIG1 is a physical networking architecture of a distributed database provided in an embodiment of the present application.
  • FIG2 is a logical architecture of a service component provided in an embodiment of the present application.
  • FIG3 is a flow chart of a message processing method provided in an embodiment of the present application.
  • FIG4 is a flowchart of another message processing method provided in an embodiment of the present application.
  • FIG5 is a schematic diagram of a combination of multiple service components provided in an embodiment of the present application.
  • FIG6 is a structural diagram of an electronic device provided in an embodiment of the present application.
  • the embodiments of the present application provide a distributed database, message processing method, device and electronic device under the architecture of large-capacity networking, which can at least solve the problem of a surge in the number of message interactions and performance bottlenecks caused by distribution changes caused by state changes or expansion and contraction of database management nodes.
  • An embodiment of the present application provides a distributed database, which includes: a main station and a backup station, etc.
  • a distributed database which includes: a main station and a backup station, etc.
  • the networking architecture of the main station and the backup station is the same, wherein the main station or the backup station can be shown in Figure 1, including: a database management node 11, a main service component control unit 12 and multiple service components 13, and the service component 13 includes a client.
  • the database management node 11 is in communication connection with the main service component control unit 12 , and is used to send a first message to the main service component control unit 12 , or receive a second message from the main service component control unit 12 .
  • the main service component control unit 12 is in communication connection with a plurality of service components 13 , and is used to forward the first message to each of the service components 13 , or to forward the second message from each of the service components 13 to the database management node 11 .
  • the service component 13 is used to receive the first message from the main service component control unit 12, or send the second message to the main service component control unit 12.
  • the service component is managed by the main service component control unit.
  • the first message of the database management node is not sent directly to the service component, but is sent to the main service component control unit, and then forwarded to the service component by the main service component control unit; similarly, the service component
  • the second message of the component is not sent directly to the database management node, but is sent to the main service component control unit, and then forwarded to the database management node by the main service component control unit, so that messages from different offices can be isolated.
  • the embodiment of the present application realizes physical layering of the networking framework of the distributed database by using the main service component control unit, realizes message diversion through the main service component control unit, reduces the processing pressure of the database management node caused by message interaction, effectively solves the performance bottleneck problem of the database management node, improves the processing performance of the distributed database, and, since the occurrence of performance bottlenecks is avoided, it can be more convenient to expand the distributed capacity and increase the capacity of the distributed database.
  • each bureau in order to facilitate data backup, each bureau has a main service component control unit 12 and a backup service component control unit 14, that is, based on the aforementioned embodiment, the distributed database also includes: a backup service component control unit 14.
  • the backup service component control unit 14 is communicatively connected to multiple service components 13, and is used to forward the first message to each service component 13 when the main service component control unit 12 is not working, or forward the second message from each service component 13 to the database management node 11.
  • the main service component control unit 12 can automatically synchronize the received first message or second message to the backup service component control unit 14.
  • each service component combination includes: a main service component and several slave service components, and the main service component is responsible for interacting with the main service component control unit 12 and forwarding messages to the remaining slave service components in the group.
  • the master service component is used to forward the first message to each of the slave service components, or to forward the second message from each of the slave service components to the master service component Control unit 12.
  • the slave service component is used to receive the first message from the master service component, or to send the second message to the master service component.
  • each of the service components 13 includes: a main process and multiple auxiliary processes.
  • the main process is used to forward the first message to each of the auxiliary processes, or to forward the second message from each of the auxiliary processes to the main service component control unit 12.
  • the auxiliary process is used to receive the first message from the main process, or to send the second message to the main process.
  • a multi-threaded mode can be adopted in the service component 13.
  • the main thread is responsible for external message interaction, and the status information of the auxiliary thread is provided by the main thread. Therefore, as shown in Figure 2, in one embodiment of the present application, the main process includes: an external interaction thread, a first main thread, and multiple first auxiliary threads.
  • the external interaction thread is used to forward the first message to the first main thread and each auxiliary process, or to forward the second message from the first main thread or each auxiliary process to the main service component control unit 12.
  • the first main thread is used to forward the first message to each of the first auxiliary threads, or to forward the second message from each of the first auxiliary threads to the external interaction thread.
  • the first auxiliary thread is used to receive the first message from the first main thread, or to send the second message to the first main thread.
  • the auxiliary process may include only one main thread.
  • the auxiliary process includes: a second main thread.
  • the second main thread is used to receive the first message from the external interaction thread, or send the second message to the external interaction thread.
  • the auxiliary process includes not only a main thread but also an auxiliary thread.
  • the auxiliary process also includes: a second auxiliary thread.
  • the second main thread is further used to forward the first message from the external interaction thread to the second auxiliary thread, or send the second message to the external interaction thread.
  • the second auxiliary thread is used to receive the first message from the second main thread, or send the second message to the second main thread.
  • a message processing method is also provided, which is applied to the main service component control unit, including: step S101, receiving a first message from a database management node; step S102, forwarding the first message to each of the service components; or, step S202, receiving a second message from each of the service components; step S203, forwarding the second message from each of the service components to the database management node.
  • the main service component control unit Each time the main service component control unit sends the first message, it carries the grouping information (starting component identifier and terminating component identifier), and the service component does not need to store the grouping information.
  • the first message sent by the main service component control unit to all service components is the same, which can avoid repeated encoding and compression of messages. This requires that all grouping information must be carried in the first message.
  • the first message carries the starting component identifier and terminating component identifier of each service component combination, but does not carry the component identifier of each service component. Therefore, the memory occupied by the grouping information needs to be as small as possible.
  • the embodiment of the present application uses the main service component control unit as an intermediate role to realize the diversion of the first message or the second message, reduce the processing pressure of the database management node due to message interaction, effectively solve the performance bottleneck problem of the database management node, and improve the processing performance of the distributed database.
  • the occurrence of performance bottlenecks is avoided, it can be more convenient to expand the distributed capacity and increase the capacity of the distributed database.
  • the method also includes: obtaining a first number of the service components registered on itself; when the first number exceeds a minimum group number threshold, determining the number of groups based on the first number, the minimum group number threshold and the maximum group number threshold.
  • the number of packets min (maximum number of packets threshold, max (minimum number of packets threshold, sqrt (first number))).
  • the first number of service components are grouped according to the grouping quantity to obtain a plurality of service component combinations.
  • the number of service components registered on the main service component control unit exceeds 20, grouping is required, and the number of groupings is min(33, max(20, sqrt(SC number))), that is, at least 20 groups and at most 33 groups, so that the number of service components in each group is basically balanced.
  • the first number of service components are grouped according to the grouping quantity to obtain multiple service component combinations, including: obtaining a component identifier of each of the service components; sorting the first number of service components according to the component identifier; and grouping the identifier sequences obtained by sorting to obtain multiple service component combinations.
  • all registered service components are sorted and grouped according to the globally unique identifier, that is, the component identifier.
  • the method further includes: for each service component combination, obtaining the status parameters of each service component in the service component combination; and determining the main service component and the slave service component in the service component combination based on the status parameters of each service component.
  • the main service component control unit can only select a service component in normal status in the service component list as the group leader, that is, the main service component.
  • the method further includes: in the case where any of the service component combinations has a service component to be added or deleted, obtaining the time interval between the current moment and the moment when the second message was last received from the service component combination or the first message was last forwarded to the service component combination; When the preset time interval has passed, it is allowed to add the service component to be added to the service component combination, or to delete the service component to be deleted from the service component combination.
  • the two second messages will be sent through different paths, which may cause message disorder.
  • the change of the service component combination is restricted: if the time interval from the last message has exceeded the preset time interval (such as 5 seconds), the preset time interval is a safety interval and it can be regarded as no notification message in transit. Then the service components can be added and exited without restriction and regrouped.
  • the preset time interval such as 5 seconds
  • the method also includes: when the time interval does not exceed the preset time interval, determining whether the service component to be deleted is the main service component; the service component to be deleted refers to a service component that needs to exit the service component combination when it is deregistered due to timeout or the service component status is abnormal.
  • the service component to be deleted is the main service component, adjust the starting component identifier of the service component combination, and determine the service component corresponding to the starting component identifier as the new main service component; when the service component to be deleted is not the main service component, directly delete the service component.
  • the exiting service component is not the group leader, for example, service component 4 or service component 5 in Figure 5 (the gray box in Figure 5 is the service component that actually exists in the corresponding service component combination) exits group 1, there is no need to adjust the grouping immediately.
  • the grouping can be adjusted to balance the group size when the time interval condition is met later. If the exiting service component is the group leader, for example, service component 1 in Figure 5 exits group 1, the starting component identifier of group 1 can be adjusted (service component 4 becomes the new group leader), and no adjustments are made to other groups.
  • the grouping can be adjusted to balance the group size when the time interval condition is met later.
  • the method further includes: when the time interval does not exceed the preset time interval, determining whether the service component to be added is located between the starting component identifier and the terminating component identifier of the service component combination; when the service component to be added is located between the starting component identifier and the terminating component identifier of the service component combination, directly adding the service component to be added to the service component combination; when the service component to be added is not located between the starting component identifier and the terminating component identifier of the service component combination, adjusting the starting component identifier or the terminating component identifier based on the component identifier of the service component to be added, and adding the service component to be added to the service component combination.
  • Service components when the time interval does not exceed the preset time interval, determining whether the service component to be added is located between the starting component identifier and the terminating component identifier of the service component combination; when the service component to be added is located between the starting component identifier and the terminating component identifier of the service component combination, directly adding the service
  • the termination component identifier of group 1 can be adjusted (group 1 is expanded but the group leader of group 1 remains unchanged), and other groups are not adjusted.
  • the grouping can be adjusted to balance the group size when the time interval condition is met later.
  • a message processing method is also provided, which is applied to the service component, including: step S103, receiving the first message from the main service component control unit, the first message is received by the main service component control unit from the database management node; or, step S201, sending the second message to the main service component control unit, so that the main service component control unit forwards the second message to the database management node.
  • the embodiment of the present application realizes the main service component control unit as an intermediate role through message interaction between the service component and the main service component control unit, thereby diverting the first message or the second message, reducing the processing pressure of the database management node due to the message interaction, and effectively solving the performance bottleneck problem of the database management node, improving the processing performance of the distributed database, and because the occurrence of performance bottlenecks is avoided, it can be more convenient to expand the distributed capacity and increase the capacity of the distributed database.
  • the method also includes: when the first message is received, extracting grouping information about at least one service component combination in the first message, the grouping information including: a starting component identifier and an ending component identifier; comparing its own component identifier with each of the starting component identifiers; when its own component identifier is the same as any of the starting component identifiers, determining itself as the main service component of the service component combination to which the starting component identifier belongs; and forwarding the first message to the slave service components corresponding to each component identifier between the starting component identifier and the ending component identifier.
  • a service component When a service component receives a notification message, if its component ID matches the start component ID of a service component combination, then as the group leader, the main service component needs to forward the message to all members in the group, that is, the slave service components. All instantiated service components within the component identifier, default start component identifier and end component identifier range of the service component have been registered with the main service component control unit.
  • the main service component as the group leader does not forward messages depending on its own power-on status, tenants, and validity status of configuration information. If a group has only one service component, the grouping information of the group does not need to be included in the first message.
  • a message processing device is also provided, which is applied to the main service component control unit, including: a first receiving module, used to receive a first message from a database management node; a first forwarding module, used to forward the first message to each of the service components; or, a second receiving module, used to receive a second message from each of the service components; a second forwarding module, used to forward the second message from each of the service components to the database management node.
  • a message processing device is also provided, which is applied to the service component, including: a third receiving module, used to receive the first message from the main service component control unit, the first message is received by the main service component control unit from the database management node; or, a first sending module, used to send the second message to the main service component control unit, so that the main service component control unit forwards the second message to the database management node.
  • an electronic device including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the message processing method described in any of the aforementioned method embodiments when executing the program stored in the memory.
  • the processor realizes the diversion of the first message or the second message through the main service component control unit as an intermediate role by executing the program stored in the memory, thereby reducing the processing pressure of the database management node caused by message interaction, effectively solving the performance bottleneck problem of the database management node, and improving the processing performance of the distributed database.
  • the processor since the occurrence of performance bottlenecks is avoided, it is easier to expand the distributed capacity and increase the capacity of the distributed database.
  • the communication bus 1140 mentioned in the above electronic device can be a peripheral component interconnect standard (PCI) bus or an extended industrial standard bus.
  • the communication bus 1140 may be divided into an address bus, a data bus, a control bus, etc.
  • FIG6 only uses one thick line, but does not mean that there is only one bus or one type of bus.
  • the communication interface 1120 is used for communication between the above electronic device and other devices.
  • the memory 1130 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory.
  • the memory may also be at least one storage device located away from the aforementioned processor.
  • the above-mentioned processor 1110 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • CPU central processing unit
  • NP network processor
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • a computer-readable storage medium is further provided, on which a program of a message processing method is stored.
  • the program of the message processing method is executed by a processor, the steps of the message processing method described in any of the aforementioned method embodiments are implemented.

Landscapes

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

Abstract

The present application relates to a distributed database, a message processing method and apparatus, and an electronic device. The distributed database comprises: a database management node, a main service component control unit and a plurality of service components, wherein the database management node is in communication connection with the main service component control unit, and is configured to send a first message to the main service component control unit, or receive a second message from the main service component control unit; the main service component control unit is in communication connection with the plurality of service components, and is configured to forward the first message to each service component, or forward to the database management node a second message from each service component; and each service component is configured to receive the first message from the main service component control unit, or send the second message to the main service component control unit.

Description

分布式数据库、消息处理方法、装置及电子设备Distributed database, message processing method, device and electronic device

相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS

本申请要求2023年6月29日提交给中国专利局的第202310793030.1号专利申请的优先权,其全部内容通过引用合并于此。This application claims priority to patent application No. 202310793030.1 filed with the China Patent Office on June 29, 2023, the entire contents of which are incorporated herein by reference.

技术领域Technical Field

本申请涉及但不限于数据库领域。The present application relates to but is not limited to the field of databases.

背景技术Background Art

数据库支持多租户,不同租户的数据访问和数据存储都是隔离的,从而保证数据的安全。每个租户需要有对应的租户配置,租户配置的配置信息用于指定本租户的租户ID、租户名称、主备局等信息。数据库各模块的上电和消息交互依赖于配置信息的正确性。The database supports multi-tenancy, and the data access and data storage of different tenants are isolated to ensure data security. Each tenant needs to have a corresponding tenant configuration, and the configuration information of the tenant configuration is used to specify the tenant ID, tenant name, primary and backup bureaus, and other information of the tenant. The power-on and message interaction of each module of the database depends on the correctness of the configuration information.

分布式数据库需要对数据进行备份,因此存在多个副本的数据。每个租户有相应的主用局或者备用局(示例性的,主用局和备用局可以设置于不同地点)。当前组网模式一般为:数据库有主用局和备用局两个局,每个局存在2个租户互相备份数据。业务通过客户端访问到数据库。Distributed databases need to back up data, so there are multiple copies of data. Each tenant has a corresponding primary or backup office (for example, the primary and backup offices can be set up in different locations). The current networking mode is generally: the database has two offices, the primary office and the backup office, and each office has two tenants who back up data to each other. The business accesses the database through the client.

客户端执行上电流程时,需要从主用局的数据库管理节点获取到配置消息,然后针对获取到的配置消息中包含的租户ID、租户名称、主备局等信息获取对应租户的数据节点的分布信息和状态信息,最终达到上电成功状态。When the client executes the power-on process, it needs to obtain the configuration message from the database management node of the active station, and then obtain the distribution information and status information of the corresponding tenant's data node based on the tenant ID, tenant name, active and standby station information contained in the obtained configuration message, and finally reach the power-on success state.

假设有1000个客户端,则数据库数据单个节点发生一次状态的切换,通知到客户端,管理节点需要发送1000条通知消息至客户端,如果有50个节点内部的分片发生了状态切换,则短时间内管理节点需要发送1000*50条消息至客户端。Assuming there are 1,000 clients, when a single node of the database data switches state, the management node needs to send 1,000 notification messages to the client to notify it. If the state of the shards within 50 nodes switches, the management node needs to send 1,000*50 messages to the client in a short period of time.

可见,数据库管理节点和其他模块的交互消息总是很多,当数据库规模达到一定程度时,数据库管理节点因消息交互所带来的CPU 消耗将成为瓶颈,这极大的限制了数据库的容量和处理性能。It can be seen that there are always a lot of interactive messages between the database management node and other modules. When the database scale reaches a certain level, the CPU usage of the database management node due to message interaction will increase. Consumption will become a bottleneck, which greatly limits the capacity and processing performance of the database.

发明内容Summary of the invention

本申请提供了一种分布式数据库、消息处理方法、装置及电子设备。The present application provides a distributed database, a message processing method, a device and an electronic device.

第一方面,本申请提供了一种分布式数据库,包括:数据库管理节点、主服务组件控制单元和多个服务组件;所述数据库管理节点与所述主服务组件控制单元通信连接,配置为向所述主服务组件控制单元发送第一消息,或者,接收来自于所述主服务组件控制单元的第二消息;所述主服务组件控制单元与多个服务组件通信连接,配置为向各所述服务组件转发所述第一消息,或者,将来自于各所述服务组件的第二消息转发至所述数据库管理节点;所述服务组件,配置为接收来自于所述主服务组件控制单元的所述第一消息,或者,向所述主服务组件控制单元发送所述第二消息。In a first aspect, the present application provides a distributed database, comprising: a database management node, a main service component control unit and multiple service components; the database management node is communicatively connected to the main service component control unit, and is configured to send a first message to the main service component control unit, or to receive a second message from the main service component control unit; the main service component control unit is communicatively connected to the multiple service components, and is configured to forward the first message to each of the service components, or to forward the second message from each of the service components to the database management node; the service component is configured to receive the first message from the main service component control unit, or to send the second message to the main service component control unit.

第二方面,本申请提供了一种消息处理方法,应用于主服务组件控制单元,包括:接收来自于数据库管理节点的第一消息;向各所述服务组件转发所述第一消息;或者,接收来自于各所述服务组件的第二消息;将来自于各所述服务组件的第二消息转发至所述数据库管理节点。In a second aspect, the present application provides a message processing method, applied to a main service component control unit, comprising: receiving a first message from a database management node; forwarding the first message to each of the service components; or, receiving a second message from each of the service components; forwarding the second message from each of the service components to the database management node.

第三方面,本申请提供了一种消息处理方法,应用于服务组件,包括:接收来自于所述主服务组件控制单元的所述第一消息,所述第一消息是所述主服务组件控制单元从数据库管理节点接收到的;或者,向所述主服务组件控制单元发送所述第二消息,以使所述主服务组件控制单元将所述第二消息转发至所述数据库管理节点。In the third aspect, the present application provides a message processing method, applied to a service component, comprising: receiving the first message from the main service component control unit, the first message being received by the main service component control unit from a database management node; or, sending the second message to the main service component control unit so that the main service component control unit forwards the second message to the database management node.

第四方面,本申请提供了一种消息处理装置,应用于主服务组件控制单元,包括:第一接收模块,配置为接收来自于数据库管理节点的第一消息;第一转发模块,配置为向各所述服务组件转发所述第一消息;或者,第二接收模块,配置为接收来自于各所述服务组件的第二消息;第二转发模块,配置为将来自于各所述服务组件的第二消息转发至所述数据库管理节点。 In a fourth aspect, the present application provides a message processing device, applied to a main service component control unit, comprising: a first receiving module, configured to receive a first message from a database management node; a first forwarding module, configured to forward the first message to each of the service components; or, a second receiving module, configured to receive a second message from each of the service components; a second forwarding module, configured to forward the second message from each of the service components to the database management node.

第五方面,本申请提供了一种消息处理装置,应用于服务组件,包括:第三接收模块,配置为接收来自于所述主服务组件控制单元的所述第一消息,所述第一消息是所述主服务组件控制单元从数据库管理节点接收到的;或者,第一发送模块,配置为向所述主服务组件控制单元发送所述第二消息,以使所述主服务组件控制单元将所述第二消息转发至所述数据库管理节点。In the fifth aspect, the present application provides a message processing device, applied to a service component, including: a third receiving module, configured to receive the first message from the main service component control unit, the first message is received by the main service component control unit from a database management node; or, a first sending module, configured to send the second message to the main service component control unit, so that the main service component control unit forwards the second message to the database management node.

第六方面,本申请提供了一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器、通信接口、存储器通过通信总线完成相互间的通信;存储器,配置为存储计算机程序;处理器,配置为执行存储器上所存储的程序时,实现第二方面任一所述的消息处理方法,或者,第三方面任一所述的消息处理方法。In a sixth aspect, the present application provides an electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; the memory is configured to store a computer program; and the processor is configured to implement the message processing method described in any one of the second aspect or the message processing method described in any one of the third aspect when executing the program stored in the memory.

第七方面,本申请提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有消息处理方法的程序,所述消息处理方法的程序被处理器执行时实现第二方面任一所述的消息处理方法,或者,第三方面任一所述的消息处理方法。In the seventh aspect, the present application provides a computer-readable storage medium, on which a program of a message processing method is stored. When the program of the message processing method is executed by a processor, the message processing method described in any one of the second aspect, or the message processing method described in any one of the third aspect, is implemented.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

图1为本申请实施例提供的一种分布式数据库的物理组网架构;FIG1 is a physical networking architecture of a distributed database provided in an embodiment of the present application;

图2为本申请实施例提供的一种服务组件内的逻辑架构;FIG2 is a logical architecture of a service component provided in an embodiment of the present application;

图3为本申请实施例提供的一种消息处理方法的流程图;FIG3 is a flow chart of a message processing method provided in an embodiment of the present application;

图4为本申请实施例提供的另一种消息处理方法的流程图;FIG4 is a flowchart of another message processing method provided in an embodiment of the present application;

图5为本申请实施例提供的一种多个服务组件组合的示意图;FIG5 is a schematic diagram of a combination of multiple service components provided in an embodiment of the present application;

图6为本申请实施例提供的一种电子设备的结构图。 FIG6 is a structural diagram of an electronic device provided in an embodiment of the present application.

具体实施方式DETAILED DESCRIPTION

为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请的一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

由于当数据库规模达到一定程度时,数据库管理节点因消息交互所带来的CPU消耗将成为瓶颈,这极大的限制了数据库的容量和处理性能。为此,本申请实施例提供一种应用于大容量组网的架构下的分布式数据库、消息处理方法、装置及电子设备,至少可以解决数据库管理节点因状态变化或者弹缩引起的分布变化导致的消息交互数量激增,性能达到瓶颈的问题。When the database scale reaches a certain level, the CPU consumption of the database management node due to message interaction will become a bottleneck, which greatly limits the capacity and processing performance of the database. To this end, the embodiments of the present application provide a distributed database, message processing method, device and electronic device under the architecture of large-capacity networking, which can at least solve the problem of a surge in the number of message interactions and performance bottlenecks caused by distribution changes caused by state changes or expansion and contraction of database management nodes.

本申请实施例提供了一种分布式数据库,分布式数据库包括:主用局和备用局等,实际组网时可能会存在多个局的组网,以仅包含主用局和备用局为例,主用局和备用局的组网架构相同,其中,主用局或者备用局可以分别如图1所示,包括:数据库管理节点11、主服务组件控制单元12和多个服务组件13,服务组件13中包含客户端。An embodiment of the present application provides a distributed database, which includes: a main station and a backup station, etc. In actual networking, there may be a network of multiple stations. Taking only the main station and the backup station as an example, the networking architecture of the main station and the backup station is the same, wherein the main station or the backup station can be shown in Figure 1, including: a database management node 11, a main service component control unit 12 and multiple service components 13, and the service component 13 includes a client.

所述数据库管理节点11与所述主服务组件控制单元12通信连接,用于向所述主服务组件控制单元12发送第一消息,或者,接收来自于所述主服务组件控制单元12的第二消息。The database management node 11 is in communication connection with the main service component control unit 12 , and is used to send a first message to the main service component control unit 12 , or receive a second message from the main service component control unit 12 .

所述主服务组件控制单元12与多个服务组件13通信连接,用于向各所述服务组件13转发所述第一消息,或者,将来自于各所述服务组件13的第二消息转发至所述数据库管理节点11。The main service component control unit 12 is in communication connection with a plurality of service components 13 , and is used to forward the first message to each of the service components 13 , or to forward the second message from each of the service components 13 to the database management node 11 .

所述服务组件13,用于接收来自于所述主服务组件控制单元12的所述第一消息,或者,向所述主服务组件控制单元12发送所述第二消息。The service component 13 is used to receive the first message from the main service component control unit 12, or send the second message to the main service component control unit 12.

本申请实施例中,服务组件受主服务组件控制单元管理,数据库管理节点的第一消息不直接发送至服务组件,而是发送给主服务组件控制单元,再由主服务组件控制单元转发给服务组件;同理,服务组 件的第二消息也不直接发送至数据库管理节点,而是发送给主服务组件控制单元,再由主服务组件控制单元转发给数据库管理节点,这样可以将不同局的消息隔离开。In the embodiment of the present application, the service component is managed by the main service component control unit. The first message of the database management node is not sent directly to the service component, but is sent to the main service component control unit, and then forwarded to the service component by the main service component control unit; similarly, the service component The second message of the component is not sent directly to the database management node, but is sent to the main service component control unit, and then forwarded to the database management node by the main service component control unit, so that messages from different offices can be isolated.

本申请实施例通过使用主服务组件控制单元实现对分布式数据库的组网框架进行物理上的分层,通过主服务组件控制单元实现消息的分流,减少数据库管理节点因消息交互所带来的处理压力,有效的解决了数据库管理节点的性能瓶颈问题,提高分布式数据库的处理性能,并且,由于避免了性能瓶颈的出现,可以更加便于为分布式进行扩容,提高分布式数据库的容量。The embodiment of the present application realizes physical layering of the networking framework of the distributed database by using the main service component control unit, realizes message diversion through the main service component control unit, reduces the processing pressure of the database management node caused by message interaction, effectively solves the performance bottleneck problem of the database management node, improves the processing performance of the distributed database, and, since the occurrence of performance bottlenecks is avoided, it can be more convenient to expand the distributed capacity and increase the capacity of the distributed database.

在本申请的一种实施方式中,为了便于数据备份,每个局都有一个主服务组件控制单元12和备服务组件控制单元14,也就是说,在前述实施例的基础上,分布式数据库还包括:备服务组件控制单元14。In one implementation of the present application, in order to facilitate data backup, each bureau has a main service component control unit 12 and a backup service component control unit 14, that is, based on the aforementioned embodiment, the distributed database also includes: a backup service component control unit 14.

所述备服务组件控制单元14与多个服务组件13通信连接,用于在所述主服务组件控制单元12不工作的情况下,向各所述服务组件13转发所述第一消息,或者,将来自于各所述服务组件13的第二消息转发至所述数据库管理节点11。The backup service component control unit 14 is communicatively connected to multiple service components 13, and is used to forward the first message to each service component 13 when the main service component control unit 12 is not working, or forward the second message from each service component 13 to the database management node 11.

为了使备服务组件控制单元14中的数据与主服务组件控制单元12的数据一致,在主服务组件控制单元12工作的情况下,可以由主服务组件控制单元12自动向备服务组件控制单元14同步接收到的第一消息或者第二消息。In order to make the data in the backup service component control unit 14 consistent with the data in the main service component control unit 12, when the main service component control unit 12 is working, the main service component control unit 12 can automatically synchronize the received first message or second message to the backup service component control unit 14.

基于前述实施例的方案,由于作为“中间角色”,主服务组件控制单元12的性能负荷可能会升高,因此紧接着需要对服务组件13进行分组,由此,在本申请的一种实施方式中,多个所述服务组件13被划分为至少一个服务组件组合,示例性的,每20个(可调整)服务组件13一组,在逻辑上选举一个组长,即主服务组件,其余的服务组件13为从服务组件,也就是说,每个服务组件组合中包括:主服务组件和若干个从服务组件,由主服务组件负责与主服务组件控制单元12交互,并将消息转发至本组剩余的从服务组件。Based on the scheme of the aforementioned embodiment, since the performance load of the main service component control unit 12 may increase as an "intermediate role", the service components 13 need to be grouped immediately. Therefore, in one embodiment of the present application, multiple service components 13 are divided into at least one service component combination. Exemplarily, every 20 (adjustable) service components 13 are grouped together, and a group leader, i.e., the main service component, is logically elected, and the remaining service components 13 are slave service components. That is to say, each service component combination includes: a main service component and several slave service components, and the main service component is responsible for interacting with the main service component control unit 12 and forwarding messages to the remaining slave service components in the group.

所述主服务组件,用于向各所述从服务组件转发所述第一消息,或者,将来自于各所述从服务组件的第二消息转发至所述主服务组件 控制单元12。The master service component is used to forward the first message to each of the slave service components, or to forward the second message from each of the slave service components to the master service component Control unit 12.

所述从服务组件,用于接收来自于所述主服务组件的所述第一消息,或者,向所述主服务组件发送所述第二消息。The slave service component is used to receive the first message from the master service component, or to send the second message to the master service component.

为了进一步对分布式数据库的组网框架进行逻辑上的分层,可以在服务组件13中采用多进程的模式,多进程时由主进程负责对外消息交互,其他辅助进程与主进程消息交互。所以,如图2所示,在本申请的一种实施方式中,每个所述服务组件13中包括:主进程及多个辅助进程。In order to further logically layer the networking framework of the distributed database, a multi-process mode can be adopted in the service component 13. In the multi-process mode, the main process is responsible for external message interaction, and other auxiliary processes interact with the main process message. Therefore, as shown in Figure 2, in one embodiment of the present application, each of the service components 13 includes: a main process and multiple auxiliary processes.

所述主进程,用于向各所述辅助进程转发所述第一消息,或者,将来自于各所述辅助进程的第二消息转发至所述主服务组件控制单元12。The main process is used to forward the first message to each of the auxiliary processes, or to forward the second message from each of the auxiliary processes to the main service component control unit 12.

所述辅助进程,用于接收来自于所述主进程的所述第一消息,或者,向所述主进程发送所述第二消息。The auxiliary process is used to receive the first message from the main process, or to send the second message to the main process.

为了进一步对分布式数据库的组网框架进行逻辑上的分层,可以在服务组件13中采用进程下多线程的模式,多线程时由主线程负责对外消息交互,辅助线程的状态信息则由主线程提供。所以,如图2所示,在本申请的一种实施方式中,所述主进程中包括:对外交互线程、第一主线程及多个第一辅助线程。In order to further logically layer the networking framework of the distributed database, a multi-threaded mode can be adopted in the service component 13. In the multi-threaded mode, the main thread is responsible for external message interaction, and the status information of the auxiliary thread is provided by the main thread. Therefore, as shown in Figure 2, in one embodiment of the present application, the main process includes: an external interaction thread, a first main thread, and multiple first auxiliary threads.

所述对外交互线程,用于向所述第一主线程和各所述辅助进程转发所述第一消息,或者,将来自于所述第一主线程或者各所述辅助进程的第二消息转发至所述主服务组件控制单元12。The external interaction thread is used to forward the first message to the first main thread and each auxiliary process, or to forward the second message from the first main thread or each auxiliary process to the main service component control unit 12.

所述第一主线程,用于向各所述第一辅助线程转发所述第一消息,或者,将来自于各所述第一辅助线程的第二消息转发至所述对外交互线程。The first main thread is used to forward the first message to each of the first auxiliary threads, or to forward the second message from each of the first auxiliary threads to the external interaction thread.

所述第一辅助线程,用于接收来自于所述第一主线程的所述第一消息,或者,向所述第一主线程发送所述第二消息。The first auxiliary thread is used to receive the first message from the first main thread, or to send the second message to the first main thread.

如图2所示,辅助进程中可能仅包含一个主线程,在本申请的一种实施方式中,所述辅助进程中包括:第二主线程。As shown in FIG. 2 , the auxiliary process may include only one main thread. In one implementation of the present application, the auxiliary process includes: a second main thread.

所述第二主线程,用于接收来自于所述对外交互线程的所述第一消息,或者,向所述对外交互线程发送所述第二消息。 The second main thread is used to receive the first message from the external interaction thread, or send the second message to the external interaction thread.

如图2所示,辅助进程中除包含一个主线程外,还包含辅助线程,在本申请的一种实施方式中,所述辅助进程中还包括:第二辅助线程。As shown in FIG. 2 , the auxiliary process includes not only a main thread but also an auxiliary thread. In one embodiment of the present application, the auxiliary process also includes: a second auxiliary thread.

所述第二主线程,还用于将来自于所述对外交互线程的所述第一消息转发至所述第二辅助线程,或者,向所述对外交互线程发送所述第二消息。The second main thread is further used to forward the first message from the external interaction thread to the second auxiliary thread, or send the second message to the external interaction thread.

所述第二辅助线程,用于接收来自于所述第二主线程的所述第一消息,或者,向所述第二主线程发送所述第二消息。The second auxiliary thread is used to receive the first message from the second main thread, or send the second message to the second main thread.

经过以上的物理和逻辑上的分层,分布式数据库的组网框架中各个角色的消息交互压力都不高,有效的解决了数据库管理节点的性能瓶颈问题。After the above physical and logical layering, the message interaction pressure of each role in the distributed database networking framework is not high, which effectively solves the performance bottleneck problem of the database management node.

在本申请的又一实施例中,如图3和图4所示,还提供一种消息处理方法,应用于主服务组件控制单元,包括:步骤S101,接收来自于数据库管理节点的第一消息;步骤S102,向各所述服务组件转发所述第一消息;或者,步骤S202,接收来自于各所述服务组件的第二消息;步骤S203,将来自于各所述服务组件的第二消息转发至所述数据库管理节点。In another embodiment of the present application, as shown in Figures 3 and 4, a message processing method is also provided, which is applied to the main service component control unit, including: step S101, receiving a first message from a database management node; step S102, forwarding the first message to each of the service components; or, step S202, receiving a second message from each of the service components; step S203, forwarding the second message from each of the service components to the database management node.

主服务组件控制单元每次发送第一消息都携带分组信息(起始组件标识和终止组件标识),服务组件不需要存储分组信息。主服务组件控制单元发送给所有服务组件的第一消息都是相同的,可以避免消息的重复编码和压缩,这就要求第一消息中需要携带全部分组信息,第一消息中携带各服务组件组合的起始组件标识和终止组件标识,而不携带每个服务组件的组件标识,因此分组信息占用的内存需要尽可能小。Each time the main service component control unit sends the first message, it carries the grouping information (starting component identifier and terminating component identifier), and the service component does not need to store the grouping information. The first message sent by the main service component control unit to all service components is the same, which can avoid repeated encoding and compression of messages. This requires that all grouping information must be carried in the first message. The first message carries the starting component identifier and terminating component identifier of each service component combination, but does not carry the component identifier of each service component. Therefore, the memory occupied by the grouping information needs to be as small as possible.

本申请实施例通过主服务组件控制单元作为中间角色,实现第一消息或者第二消息的分流,减少数据库管理节点因消息交互所带来的处理压力,有效的解决了数据库管理节点的性能瓶颈问题,提高分布式数据库的处理性能,并且,由于避免了性能瓶颈的出现,可以更加便于为分布式进行扩容,提高分布式数据库的容量。 The embodiment of the present application uses the main service component control unit as an intermediate role to realize the diversion of the first message or the second message, reduce the processing pressure of the database management node due to message interaction, effectively solve the performance bottleneck problem of the database management node, and improve the processing performance of the distributed database. In addition, since the occurrence of performance bottlenecks is avoided, it can be more convenient to expand the distributed capacity and increase the capacity of the distributed database.

在本申请的又一实施例中,所述方法还包括:获取在自身上注册的所述服务组件的第一数量;在所述第一数量超过最小分组数量阈值的情况下,根据所述第一数量、最小分组数量阈值和最大分组数量阈值确定分组数量。In another embodiment of the present application, the method also includes: obtaining a first number of the service components registered on itself; when the first number exceeds a minimum group number threshold, determining the number of groups based on the first number, the minimum group number threshold and the maximum group number threshold.

进一步的,分组数量=min(最大分组数量阈值,max(最小分组数量阈值,sqrt(第一数量)))。Further, the number of packets = min (maximum number of packets threshold, max (minimum number of packets threshold, sqrt (first number))).

按照所述分组数量对第一数量个所述服务组件进行分组,得到多个服务组件组合。The first number of service components are grouped according to the grouping quantity to obtain a plurality of service component combinations.

作为一种示例,当主服务组件控制单元上注册的服务组件的数量超过20个时,则需要分组,分组数量为min(33,max(20,sqrt(SC数量))),即至少分为20个组,至多分为33个组,以使每个组的服务组件的数量基本均衡。As an example, when the number of service components registered on the main service component control unit exceeds 20, grouping is required, and the number of groupings is min(33, max(20, sqrt(SC number))), that is, at least 20 groups and at most 33 groups, so that the number of service components in each group is basically balanced.

进一步的,按照所述分组数量对第一数量个所述服务组件进行分组,得到多个服务组件组合,包括:获取每个所述服务组件的组件标识;按照所述组件标识对第一数量个所述服务组件进行排序;对排序得到的标识序列进行分组,得到多个服务组件组合。Furthermore, the first number of service components are grouped according to the grouping quantity to obtain multiple service component combinations, including: obtaining a component identifier of each of the service components; sorting the first number of service components according to the component identifier; and grouping the identifier sequences obtained by sorting to obtain multiple service component combinations.

也就是说,所有已注册的服务组件按全局唯一标识,即组件标识进行排序后分组。That is, all registered service components are sorted and grouped according to the globally unique identifier, that is, the component identifier.

在本申请的又一实施例中,所述方法还包括:针对每个服务组件组合,获取所述服务组件组合中各所述服务组件的状态参数;基于每个所述服务组件的状态参数确定该服务组件组合中的主服务组件和从服务组件。In another embodiment of the present application, the method further includes: for each service component combination, obtaining the status parameters of each service component in the service component combination; and determining the main service component and the slave service component in the service component combination based on the status parameters of each service component.

由于当主服务组件控制单元选择的主服务组件不可达时,这个组的所有从服务组件都无法收到第一消息,为了降低这种风险,主服务组件控制单元只能选择服务组件列表中状态正常的服务组件作为组长,即主服务组件。Because when the main service component selected by the main service component control unit is unreachable, all the slave service components of this group cannot receive the first message. In order to reduce this risk, the main service component control unit can only select a service component in normal status in the service component list as the group leader, that is, the main service component.

在本申请的又一实施例中,所述方法还包括:在任一所述服务组件组合存在待新增或者待删除的服务组件的情况下,获取当前时刻与最后一次从所述服务组件组合接收所述第二消息或者向所述服务组件组合转发所述第一消息的时刻之间的时间间隔;在所述时间间隔超 过预设时间间隔的情况下,允许向所述服务组件组合添加待新增的服务组件,或者,从所述服务组件组合删除待删除的服务组件。In another embodiment of the present application, the method further includes: in the case where any of the service component combinations has a service component to be added or deleted, obtaining the time interval between the current moment and the moment when the second message was last received from the service component combination or the first message was last forwarded to the service component combination; When the preset time interval has passed, it is allowed to add the service component to be added to the service component combination, or to delete the service component to be deleted from the service component combination.

当服务组件组合发生变化时,两个第二消息会通过不同的路径发送,可能导致消息乱序,为避免该情形的发生,服务组件组合的变化是受限的:如果距离最后一次消息的时间间隔已经超过预设时间间隔(如:5秒),预设时间间隔为安全间隔,可以视为没有在途的通知消息,则服务组件加入和退出都可以不受限制的执行重新分组。When the service component combination changes, the two second messages will be sent through different paths, which may cause message disorder. To avoid this situation, the change of the service component combination is restricted: if the time interval from the last message has exceeded the preset time interval (such as 5 seconds), the preset time interval is a safety interval and it can be regarded as no notification message in transit. Then the service components can be added and exited without restriction and regrouped.

在本申请的又一实施例中,所述方法还包括:在所述时间间隔未超过预设时间间隔的情况下,确定待删除的服务组件是否是主服务组件;待删除的服务组件指因超时而去注册或服务组件状态异常等时,需要退出服务组件组合的服务组件。In another embodiment of the present application, the method also includes: when the time interval does not exceed the preset time interval, determining whether the service component to be deleted is the main service component; the service component to be deleted refers to a service component that needs to exit the service component combination when it is deregistered due to timeout or the service component status is abnormal.

在待删除的服务组件是主服务组件的情况下,调整所述服务组件组合的起始组件标识,并将所述起始组件标识对应的服务组件确定为新的主服务组件;在待删除的服务组件不是主服务组件的情况下,直接删除所述服务组件。When the service component to be deleted is the main service component, adjust the starting component identifier of the service component combination, and determine the service component corresponding to the starting component identifier as the new main service component; when the service component to be deleted is not the main service component, directly delete the service component.

若退出的服务组件不是组长,例如图5(图5中灰色方框为实际存在于相应服务组件组合中的服务组件)中的服务组件4或服务组件5退出组1,不需要立即调整分组,后续满足时间间隔条件时再调整分组以平衡组大小;退出的服务组件是组长,例如图5中的服务组件1退出组1,则可以调整组1的起始组件标识(服务组件4成为新的组长),其他组不做调整,后续满足时间间隔条件时再调整分组以平衡组大小。If the exiting service component is not the group leader, for example, service component 4 or service component 5 in Figure 5 (the gray box in Figure 5 is the service component that actually exists in the corresponding service component combination) exits group 1, there is no need to adjust the grouping immediately. The grouping can be adjusted to balance the group size when the time interval condition is met later. If the exiting service component is the group leader, for example, service component 1 in Figure 5 exits group 1, the starting component identifier of group 1 can be adjusted (service component 4 becomes the new group leader), and no adjustments are made to other groups. The grouping can be adjusted to balance the group size when the time interval condition is met later.

在本申请的又一实施例中,所述方法还包括:在所述时间间隔未超过预设时间间隔的情况下,确定待增加的服务组件是否位于所述服务组件组合的起始组件标识和终止组件标识之间;在待增加的服务组件位于所述服务组件组合的起始组件标识和终止组件标识之间的情况下,直接向所述服务组件组合添加待新增的服务组件;在待增加的服务组件不位于所述服务组件组合的起始组件标识和终止组件标识之间的情况下,基于所述待增加的服务组件的组件标识调整所述起始组件标识或者终止组件标识,并向所述服务组件组合添加待新增的服 务组件。In another embodiment of the present application, the method further includes: when the time interval does not exceed the preset time interval, determining whether the service component to be added is located between the starting component identifier and the terminating component identifier of the service component combination; when the service component to be added is located between the starting component identifier and the terminating component identifier of the service component combination, directly adding the service component to be added to the service component combination; when the service component to be added is not located between the starting component identifier and the terminating component identifier of the service component combination, adjusting the starting component identifier or the terminating component identifier based on the component identifier of the service component to be added, and adding the service component to be added to the service component combination. Service components.

如果新加入的服务组件已经在某个服务组件组合的范围内,例如图5中的服务组件2或服务组件3加入组1,则不需要立即调整分组,后续满足时间间隔条件时再调整分组以平衡组大小;如果新加入的服务组件不在某个组的范围内,例如下图中服务组件的6或服务组件7加入组1,则可以调整组1的终止组件标识(扩大组1但是组1的组长不变),其他组不做调整,后续满足时间间隔条件时再调整分组以平衡组大小。If the newly added service component is already within the scope of a certain service component combination, such as service component 2 or service component 3 in Figure 5 joining group 1, there is no need to adjust the grouping immediately. The grouping can be adjusted to balance the group size when the time interval condition is met later. If the newly added service component is not within the scope of a certain group, such as service component 6 or service component 7 in the figure below joining group 1, the termination component identifier of group 1 can be adjusted (group 1 is expanded but the group leader of group 1 remains unchanged), and other groups are not adjusted. The grouping can be adjusted to balance the group size when the time interval condition is met later.

在本申请的又一实施例中,如图3和图4所示,还提供一种消息处理方法,应用于服务组件,包括:步骤S103,接收来自于所述主服务组件控制单元的所述第一消息,所述第一消息是所述主服务组件控制单元从数据库管理节点接收到的;或者,步骤S201,向所述主服务组件控制单元发送所述第二消息,以使所述主服务组件控制单元将所述第二消息转发至所述数据库管理节点。In another embodiment of the present application, as shown in Figures 3 and 4, a message processing method is also provided, which is applied to the service component, including: step S103, receiving the first message from the main service component control unit, the first message is received by the main service component control unit from the database management node; or, step S201, sending the second message to the main service component control unit, so that the main service component control unit forwards the second message to the database management node.

本申请实施例通过服务组件与主服务组件控制单元的消息交互,实现主服务组件控制单元作为中间角色,对第一消息或者第二消息的分流,减少数据库管理节点因消息交互所带来的处理压力,有效的解决了数据库管理节点的性能瓶颈问题,提高分布式数据库的处理性能,并且,由于避免了性能瓶颈的出现,可以更加便于为分布式进行扩容,提高分布式数据库的容量。The embodiment of the present application realizes the main service component control unit as an intermediate role through message interaction between the service component and the main service component control unit, thereby diverting the first message or the second message, reducing the processing pressure of the database management node due to the message interaction, and effectively solving the performance bottleneck problem of the database management node, improving the processing performance of the distributed database, and because the occurrence of performance bottlenecks is avoided, it can be more convenient to expand the distributed capacity and increase the capacity of the distributed database.

在本申请的又一实施例中,所述方法还包括:在接收到所述第一消息的情况下,在所述第一消息中提取关于至少一个服务组件组合的分组信息,所述分组信息包括:起始组件标识和终止组件标识;将自身的组件标识与各所述起始组件标识对比;在自身的组件标识与任一所述起始组件标识相同的情况下,将自身确定为该起始组件标识所属的服务组件组合的主服务组件;向所述起始组件标识和所述终止组件标识之间的各组件标识对应的从服务组件转发所述第一消息。In another embodiment of the present application, the method also includes: when the first message is received, extracting grouping information about at least one service component combination in the first message, the grouping information including: a starting component identifier and an ending component identifier; comparing its own component identifier with each of the starting component identifiers; when its own component identifier is the same as any of the starting component identifiers, determining itself as the main service component of the service component combination to which the starting component identifier belongs; and forwarding the first message to the slave service components corresponding to each component identifier between the starting component identifier and the ending component identifier.

服务组件收到通知消息时,如果自己的组件标识和某个服务组件组合的起始组件标识匹配,则作为组长,主服务组件需要转发消息给组内的所有成员,即从服务组件。组长从服务组件列表中获取从服 务组件的组件标识,默认起始组件标识和终止组件标识范围内所有已实例化的服务组件都已经向主服务组件控制单元注册。When a service component receives a notification message, if its component ID matches the start component ID of a service component combination, then as the group leader, the main service component needs to forward the message to all members in the group, that is, the slave service components. All instantiated service components within the component identifier, default start component identifier and end component identifier range of the service component have been registered with the main service component control unit.

作为组长的主服务组件,其转发消息不依赖于其自身的上电状态、租户和配置信息的有效性状态。如果一个组只有一个服务组件,则该组的分组信息不需要包含在第一消息中。The main service component as the group leader does not forward messages depending on its own power-on status, tenants, and validity status of configuration information. If a group has only one service component, the grouping information of the group does not need to be included in the first message.

在本申请的又一实施例中,还提供一种消息处理装置,应用于主服务组件控制单元,包括:第一接收模块,用于接收来自于数据库管理节点的第一消息;第一转发模块,用于向各所述服务组件转发所述第一消息;或者,第二接收模块,用于接收来自于各所述服务组件的第二消息;第二转发模块,用于将来自于各所述服务组件的第二消息转发至所述数据库管理节点。In another embodiment of the present application, a message processing device is also provided, which is applied to the main service component control unit, including: a first receiving module, used to receive a first message from a database management node; a first forwarding module, used to forward the first message to each of the service components; or, a second receiving module, used to receive a second message from each of the service components; a second forwarding module, used to forward the second message from each of the service components to the database management node.

在本申请的又一实施例中,还提供一种消息处理装置,应用于服务组件,包括:第三接收模块,用于接收来自于所述主服务组件控制单元的所述第一消息,所述第一消息是所述主服务组件控制单元从数据库管理节点接收到的;或者,第一发送模块,用于向所述主服务组件控制单元发送所述第二消息,以使所述主服务组件控制单元将所述第二消息转发至所述数据库管理节点。In another embodiment of the present application, a message processing device is also provided, which is applied to the service component, including: a third receiving module, used to receive the first message from the main service component control unit, the first message is received by the main service component control unit from the database management node; or, a first sending module, used to send the second message to the main service component control unit, so that the main service component control unit forwards the second message to the database management node.

在本申请的又一实施例中,还提供一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器,通信接口,存储器通过通信总线完成相互间的通信;存储器,用于存储计算机程序;处理器,用于执行存储器上所存储的程序时,实现前述任一方法实施例所述的消息处理方法。In another embodiment of the present application, an electronic device is provided, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; the memory is used to store computer programs; and the processor is used to implement the message processing method described in any of the aforementioned method embodiments when executing the program stored in the memory.

本申请实施例提供的电子设备,处理器通过执行存储器上所存放的程序实现了通过主服务组件控制单元作为中间角色,实现第一消息或者第二消息的分流,减少数据库管理节点因消息交互所带来的处理压力,有效的解决了数据库管理节点的性能瓶颈问题,提高分布式数据库的处理性能,并且,由于避免了性能瓶颈的出现,可以更加便于为分布式进行扩容,提高分布式数据库的容量。In the electronic device provided in the embodiment of the present application, the processor realizes the diversion of the first message or the second message through the main service component control unit as an intermediate role by executing the program stored in the memory, thereby reducing the processing pressure of the database management node caused by message interaction, effectively solving the performance bottleneck problem of the database management node, and improving the processing performance of the distributed database. In addition, since the occurrence of performance bottlenecks is avoided, it is easier to expand the distributed capacity and increase the capacity of the distributed database.

上述电子设备提到的通信总线1140可以是外设部件互连标准(PeripheralComponentInterconnect,简称PCI)总线或扩展工业标准结 构(ExtendedIndustryStandardArchitecture,简称EISA)总线等。该通信总线1140可以分为地址总线、数据总线、控制总线等。为便于表示,图6中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus 1140 mentioned in the above electronic device can be a peripheral component interconnect standard (PCI) bus or an extended industrial standard bus. The communication bus 1140 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, FIG6 only uses one thick line, but does not mean that there is only one bus or one type of bus.

通信接口1120用于上述电子设备与其他设备之间的通信。The communication interface 1120 is used for communication between the above electronic device and other devices.

存储器1130可以包括随机存取存储器(RandomAccessMemory,简称RAM),也可以包括非易失性存储器(non-volatilememory),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory 1130 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

上述的处理器1110可以是通用处理器,包括中央处理器(CentralProcessingUnit,简称CPU)、网络处理器(NetworkProcessor,简称NP)等;还可以是数字信号处理器(DigitalSignalProcessing,简称DSP)、专用集成电路(ApplicationSpecificIntegratedCircuit,简称ASIC)、现场可编程门阵列(Field-ProgrammableGateArray,简称FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。The above-mentioned processor 1110 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

在本申请的又一实施例中,还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有消息处理方法的程序,所述消息处理方法的程序被处理器执行时实现前述任一方法实施例所述的消息处理方法的步骤。In another embodiment of the present application, a computer-readable storage medium is further provided, on which a program of a message processing method is stored. When the program of the message processing method is executed by a processor, the steps of the message processing method described in any of the aforementioned method embodiments are implemented.

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

以上所述仅是本申请的示例性实施方式,使本领域技术人员能够理解或实现本申请。对这些实施例的多种修改对本领域的技术人员 来说将是显而易见的,本文中所定义的一般原理可以在不脱离本申请的精神或范围的情况下,在其它实施例中实现。因此,本申请将不会被限制于本文所示的这些实施例,而是要符合与本文所申请的原理和新颖特点相一致的最宽的范围。 The above description is only an exemplary embodiment of the present application, which enables those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be of great benefit to those skilled in the art. It will be apparent that the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features of the present application.

Claims (20)

一种分布式数据库,包括:数据库管理节点、主服务组件控制单元和多个服务组件;A distributed database comprises: a database management node, a main service component control unit and a plurality of service components; 所述数据库管理节点与所述主服务组件控制单元通信连接,配置为向所述主服务组件控制单元发送第一消息,或者,接收来自于所述主服务组件控制单元的第二消息;The database management node is in communication connection with the main service component control unit and is configured to send a first message to the main service component control unit, or receive a second message from the main service component control unit; 所述主服务组件控制单元与多个服务组件通信连接,配置为向各所述服务组件转发所述第一消息,或者,将来自于各所述服务组件的第二消息转发至所述数据库管理节点;The main service component control unit is in communication connection with a plurality of service components and is configured to forward the first message to each of the service components, or to forward the second message from each of the service components to the database management node; 所述服务组件,配置为接收来自于所述主服务组件控制单元的所述第一消息,或者,向所述主服务组件控制单元发送所述第二消息。The service component is configured to receive the first message from the main service component control unit, or to send the second message to the main service component control unit. 根据权利要求1所述的分布式数据库,还包括:备服务组件控制单元;The distributed database according to claim 1, further comprising: a backup service component control unit; 所述备服务组件控制单元与多个服务组件通信连接,配置为在所述主服务组件控制单元不工作的情况下,向各所述服务组件转发所述第一消息,或者,将来自于各所述服务组件的第二消息转发至所述数据库管理节点。The backup service component control unit is communicatively connected to multiple service components, and is configured to forward the first message to each service component when the main service component control unit is not working, or to forward the second message from each service component to the database management node. 根据权利要求1所述的分布式数据库,其中,多个所述服务组件被划分为至少一个服务组件组合,每个服务组件组合中包括:主服务组件和若干个从服务组件;The distributed database according to claim 1, wherein the plurality of service components are divided into at least one service component combination, each service component combination comprising: a master service component and a plurality of slave service components; 所述主服务组件,配置为向各所述从服务组件转发所述第一消息,或者,将来自于各所述从服务组件的第二消息转发至所述主服务组件控制单元;The master service component is configured to forward the first message to each of the slave service components, or to forward the second message from each of the slave service components to the master service component control unit; 所述从服务组件,配置为接收来自于所述主服务组件的所述第一消息,或者,向所述主服务组件发送所述第二消息。The slave service component is configured to receive the first message from the master service component, or to send the second message to the master service component. 根据权利要求1所述的分布式数据库,其中,每个所述服务组件中包括:主进程及多个辅助进程;The distributed database according to claim 1, wherein each of the service components comprises: a main process and a plurality of auxiliary processes; 所述主进程,配置为向各所述辅助进程转发所述第一消息,或者,将来自于各所述辅助进程的第二消息转发至所述主服务组件控制 单元;The main process is configured to forward the first message to each of the auxiliary processes, or forward the second message from each of the auxiliary processes to the main service component control unit; 所述辅助进程,配置为接收来自于所述主进程的所述第一消息,或者,向所述主进程发送所述第二消息。The auxiliary process is configured to receive the first message from the main process, or to send the second message to the main process. 根据权利要求4所述的分布式数据库,其中,所述主进程中包括:对外交互线程、第一主线程及多个第一辅助线程;The distributed database according to claim 4, wherein the main process includes: an external interaction thread, a first main thread and a plurality of first auxiliary threads; 所述对外交互线程,配置为向所述第一主线程和各所述辅助进程转发所述第一消息,或者,将来自于所述第一主线程或者各所述辅助进程的第二消息转发至所述主服务组件控制单元;The external interaction thread is configured to forward the first message to the first main thread and each of the auxiliary processes, or to forward the second message from the first main thread or each of the auxiliary processes to the main service component control unit; 所述第一主线程,配置为向各所述第一辅助线程转发所述第一消息,或者,将来自于各所述第一辅助线程的第二消息转发至所述对外交互线程;The first main thread is configured to forward the first message to each of the first auxiliary threads, or to forward the second message from each of the first auxiliary threads to the external interaction thread; 所述第一辅助线程,配置为接收来自于所述第一主线程的所述第一消息,或者,向所述第一主线程发送所述第二消息。The first auxiliary thread is configured to receive the first message from the first main thread, or to send the second message to the first main thread. 根据权利要求5所述的分布式数据库,其中,所述辅助进程中包括:第二主线程;The distributed database according to claim 5, wherein the auxiliary process includes: a second main thread; 所述第二主线程,配置为接收来自于所述对外交互线程的所述第一消息,或者,向所述对外交互线程发送所述第二消息。The second main thread is configured to receive the first message from the external interaction thread, or to send the second message to the external interaction thread. 根据权利要求6所述的分布式数据库,其中,所述辅助进程中还包括:第二辅助线程;The distributed database according to claim 6, wherein the auxiliary process further comprises: a second auxiliary thread; 所述第二主线程,还配置为将来自于所述对外交互线程的所述第一消息转发至所述第二辅助线程,或者,向所述对外交互线程发送所述第二消息;The second main thread is further configured to forward the first message from the external interaction thread to the second auxiliary thread, or send the second message to the external interaction thread; 所述第二辅助线程,配置为接收来自于所述第二主线程的所述第一消息,或者,向所述第二主线程发送所述第二消息。The second auxiliary thread is configured to receive the first message from the second main thread, or to send the second message to the second main thread. 一种消息处理方法,应用于主服务组件控制单元,包括:A message processing method, applied to a main service component control unit, comprising: 接收来自于数据库管理节点的第一消息;Receiving a first message from a database management node; 向各所述服务组件转发所述第一消息;Forwarding the first message to each of the service components; 或者,or, 接收来自于各所述服务组件的第二消息;receiving a second message from each of the service components; 将来自于各所述服务组件的第二消息转发至所述数据库管理节 点。Forward the second message from each of the service components to the database management node point. 根据权利要求8所述的消息处理方法,还包括:The message processing method according to claim 8, further comprising: 获取在自身上注册的所述服务组件的第一数量;Obtaining a first quantity of the service components registered on itself; 在所述第一数量超过最小分组数量阈值的情况下,根据所述第一数量、最小分组数量阈值和最大分组数量阈值确定分组数量;In the case where the first number exceeds a minimum group number threshold, determining the number of groups according to the first number, the minimum group number threshold and the maximum group number threshold; 按照所述分组数量对第一数量个所述服务组件进行分组,得到多个服务组件组合。The first number of service components are grouped according to the grouping quantity to obtain a plurality of service component combinations. 根据权利要求9所述的消息处理方法,其中,按照所述分组数量对第一数量个所述服务组件进行分组,得到多个服务组件组合,包括:The message processing method according to claim 9, wherein the first number of service components are grouped according to the number of groups to obtain a plurality of service component combinations, comprising: 获取每个所述服务组件的组件标识;Obtaining a component identifier of each of the service components; 按照所述组件标识对第一数量个所述服务组件进行排序;sorting the first number of the service components according to the component identifiers; 对排序得到的标识序列进行分组,得到多个服务组件组合。The sorted identification sequences are grouped to obtain multiple service component combinations. 根据权利要求9所述的消息处理方法,还包括:The message processing method according to claim 9, further comprising: 针对每个服务组件组合,获取所述服务组件组合中各所述服务组件的状态参数;For each service component combination, obtaining a state parameter of each service component in the service component combination; 基于每个所述服务组件的状态参数确定该服务组件组合中的主服务组件和从服务组件。A master service component and a slave service component in the service component combination are determined based on the state parameter of each of the service components. 根据权利要求9所述的消息处理方法,还包括:The message processing method according to claim 9, further comprising: 在任一所述服务组件组合存在待新增或者待删除的服务组件的情况下,获取当前时刻与最后一次从所述服务组件组合接收所述第二消息或者向所述服务组件组合转发所述第一消息的时刻之间的时间间隔;In the case that any of the service component combinations has a service component to be added or deleted, obtaining the time interval between the current moment and the moment when the second message was last received from the service component combination or the first message was last forwarded to the service component combination; 在所述时间间隔超过预设时间间隔的情况下,允许向所述服务组件组合添加待新增的服务组件,或者,从所述服务组件组合删除待删除的服务组件。In the case that the time interval exceeds the preset time interval, it is allowed to add the service component to be added to the service component combination, or to delete the service component to be deleted from the service component combination. 根据权利要求12所述的消息处理方法,还包括:The message processing method according to claim 12, further comprising: 在所述时间间隔未超过预设时间间隔的情况下,确定待删除的服务组件是否是主服务组件;If the time interval does not exceed the preset time interval, determining whether the service component to be deleted is a main service component; 在待删除的服务组件是主服务组件的情况下,调整所述服务组 件组合的起始组件标识,并将所述起始组件标识对应的服务组件确定为新的主服务组件;If the service component to be deleted is a main service component, adjust the service group The starting component identifier of the component combination, and determining the service component corresponding to the starting component identifier as a new main service component; 在待删除的服务组件不是主服务组件的情况下,直接删除所述服务组件。When the service component to be deleted is not the main service component, the service component is directly deleted. 根据权利要求12所述的消息处理方法,还包括:The message processing method according to claim 12, further comprising: 在所述时间间隔未超过预设时间间隔的情况下,确定待增加的服务组件是否位于所述服务组件组合的起始组件标识和终止组件标识之间;In the case that the time interval does not exceed the preset time interval, determining whether the service component to be added is located between the start component identifier and the end component identifier of the service component combination; 在待增加的服务组件位于所述服务组件组合的起始组件标识和终止组件标识之间的情况下,直接向所述服务组件组合添加待新增的服务组件;In the case where the service component to be added is located between the start component identifier and the end component identifier of the service component combination, directly adding the service component to be added to the service component combination; 在待增加的服务组件不位于所述服务组件组合的起始组件标识和终止组件标识之间的情况下,基于所述待增加的服务组件的组件标识调整所述起始组件标识或者终止组件标识,并向所述服务组件组合添加待新增的服务组件。When the service component to be added is not located between the starting component identifier and the ending component identifier of the service component combination, the starting component identifier or the ending component identifier is adjusted based on the component identifier of the service component to be added, and the service component to be added is added to the service component combination. 一种消息处理方法,应用于服务组件,包括:A message processing method, applied to a service component, comprising: 接收来自于主服务组件控制单元的第一消息,所述第一消息是所述主服务组件控制单元从数据库管理节点接收到的;Receiving a first message from a primary service component control unit, where the first message is received by the primary service component control unit from a database management node; 或者,or, 向所述主服务组件控制单元发送第二消息,以使所述主服务组件控制单元将所述第二消息转发至所述数据库管理节点。A second message is sent to the main service component control unit so that the main service component control unit forwards the second message to the database management node. 根据权利要求15所述的消息处理方法,还包括:The message processing method according to claim 15, further comprising: 在接收到所述第一消息的情况下,在所述第一消息中提取关于至少一个服务组件组合的分组信息,所述分组信息包括:起始组件标识和终止组件标识;Upon receiving the first message, extracting grouping information about at least one service component combination from the first message, the grouping information including: a start component identifier and an end component identifier; 将自身的组件标识与各所述起始组件标识对比;Comparing the component identification of the self with the identification of each starting component; 在自身的组件标识与任一所述起始组件标识相同的情况下,将自身确定为该起始组件标识所属的服务组件组合的主服务组件;When its component identifier is the same as any of the starting component identifiers, it determines itself as the main service component of the service component combination to which the starting component identifier belongs; 向所述起始组件标识和所述终止组件标识之间的各组件标识对应的从服务组件转发所述第一消息。 The first message is forwarded to slave service components corresponding to each component identifier between the start component identifier and the end component identifier. 一种消息处理装置,应用于主服务组件控制单元,包括:A message processing device, applied to a main service component control unit, comprising: 第一接收模块,配置为接收来自于数据库管理节点的第一消息;A first receiving module, configured to receive a first message from a database management node; 第一转发模块,配置为向各所述服务组件转发所述第一消息;A first forwarding module, configured to forward the first message to each of the service components; 或者,or, 第二接收模块,配置为接收来自于各所述服务组件的第二消息;A second receiving module, configured to receive a second message from each of the service components; 第二转发模块,配置为将来自于各所述服务组件的第二消息转发至所述数据库管理节点。The second forwarding module is configured to forward the second message from each of the service components to the database management node. 一种消息处理装置,应用于服务组件,包括:A message processing device, applied to a service component, comprising: 第三接收模块,配置为接收来自于主服务组件控制单元的第一消息,所述第一消息是所述主服务组件控制单元从数据库管理节点接收到的;A third receiving module is configured to receive a first message from the main service component control unit, where the first message is received by the main service component control unit from the database management node; 或者,or, 第一发送模块,配置为向所述主服务组件控制单元发送第二消息,以使所述主服务组件控制单元将所述第二消息转发至所述数据库管理节点。The first sending module is configured to send a second message to the main service component control unit, so that the main service component control unit forwards the second message to the database management node. 一种电子设备,包括处理器、通信接口、存储器和通信总线,其中,处理器、通信接口、存储器通过通信总线完成相互间的通信;An electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; 存储器,配置为存储计算机程序;a memory configured to store a computer program; 处理器,配置为执行存储器上所存储的程序时,实现权利要求8~14任一所述的消息处理方法,或者,权利要求15~16任一所述的消息处理方法。The processor is configured to implement the message processing method described in any one of claims 8 to 14, or the message processing method described in any one of claims 15 to 16 when executing the program stored in the memory. 一种计算机可读存储介质,其上存储有程序,所述程序被处理器执行时实现权利要求8~14任一所述的消息处理方法,或者,权利要求15~16任一所述的消息处理方法。 A computer-readable storage medium having a program stored thereon, wherein when the program is executed by a processor, the message processing method described in any one of claims 8 to 14 or the message processing method described in any one of claims 15 to 16 is implemented.
PCT/CN2024/098686 2023-06-29 2024-06-12 Distributed database, message processing method and apparatus, and electronic device Pending WO2025001842A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202310793030.1 2023-06-29
CN202310793030.1A CN119271737A (en) 2023-06-29 2023-06-29 Distributed database, message processing method, device and electronic device

Publications (1)

Publication Number Publication Date
WO2025001842A1 true WO2025001842A1 (en) 2025-01-02

Family

ID=93937572

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2024/098686 Pending WO2025001842A1 (en) 2023-06-29 2024-06-12 Distributed database, message processing method and apparatus, and electronic device

Country Status (2)

Country Link
CN (1) CN119271737A (en)
WO (1) WO2025001842A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140214875A1 (en) * 2013-01-31 2014-07-31 Electronics And Telecommunications Research Institute Node search system and method using publish-subscribe communication middleware
CN104408071A (en) * 2014-10-30 2015-03-11 北京思特奇信息技术股份有限公司 Distributive database high-availability method and system based on cluster manager
CN108737543A (en) * 2018-05-21 2018-11-02 天津中兴智联科技有限公司 A kind of distribution Internet of things middleware and working method
CN112035563A (en) * 2020-08-28 2020-12-04 南京华盾电力信息安全测评有限公司 Real-time database system based on shared storage

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140214875A1 (en) * 2013-01-31 2014-07-31 Electronics And Telecommunications Research Institute Node search system and method using publish-subscribe communication middleware
CN104408071A (en) * 2014-10-30 2015-03-11 北京思特奇信息技术股份有限公司 Distributive database high-availability method and system based on cluster manager
CN108737543A (en) * 2018-05-21 2018-11-02 天津中兴智联科技有限公司 A kind of distribution Internet of things middleware and working method
CN112035563A (en) * 2020-08-28 2020-12-04 南京华盾电力信息安全测评有限公司 Real-time database system based on shared storage

Also Published As

Publication number Publication date
CN119271737A (en) 2025-01-07

Similar Documents

Publication Publication Date Title
CN110830283B (en) Fault detection method, apparatus, equipment and system
CN108804119A (en) Configure update method, device, system, configuration center, application node and medium
CN104980519A (en) Multi-computer room storage system
KR20150111952A (en) Method and system for using a recursive event listener on a node in hierarchical data structure
CN114063936B (en) A method, system, device and storage medium for optimizing timing tasks
CN114265753A (en) Management method and management system of message queue and electronic equipment
CN114900449A (en) Resource information management method, system and device
CN110519354A (en) Distributed object storage system and service processing method and storage medium thereof
CN108512782A (en) Accesses control list is grouped method of adjustment, the network equipment and system
CN113867915A (en) Task scheduling method, electronic device and storage medium
CN113765690A (en) Cluster switching method, system, device, terminal, server and storage medium
WO2025001842A1 (en) Distributed database, message processing method and apparatus, and electronic device
CN108718285B (en) Flow control method and device of cloud computing cluster and server
CN116028234B (en) A distributed database load balancing method, device, equipment and storage medium
CN118802743A (en) A flow table updating method, device, network system and electronic device
CN118069719A (en) Cloud database virtual IP binding method suitable for composite morphology
CN113220759B (en) Big data storage service sharing method, device, computer equipment and storage medium
CN118642897A (en) Controller switching method, device, electronic device and storage medium
CN115695169B (en) A method, device and storage medium for sending configuration information
CN113992566B (en) Message broadcasting method and device
CN113595937A (en) Message sending method and device and switching network chip
CN115842973B (en) Optical network unit management and control method, device, related functional equipment and storage medium
CN115134217B (en) Data processing method, device, equipment and storage medium
CN120144846A (en) User tag query method, device, electronic device and storage medium
CN105227370B (en) A kind of method of the virtual LAN full configuration of optical network unit

Legal Events

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

Ref document number: 24830488

Country of ref document: EP

Kind code of ref document: A1