Data writing method, device, electronic device and storage medium

By recording the data storage architecture configuration information of different application scenarios in the configuration file and dynamically loading the corresponding architecture, it solves the problem of bloated data writing service code and difficulty in maintenance in the server, achieves code simplification and scalability, and supports data Hot update and disaster recovery downgrade of storage architecture.

CN114077639BActive Publication Date: 2024-08-23DOUYIN VISION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010843797.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-20
Publication Date
2024-08-23
Estimated Expiration
2040-08-20

AI Technical Summary

Technical Problem

In servers that provide services with high query rates per second, the existing technology requires multiple data storage architectures to be pre-set in the program code of the data writing service, resulting in bloated code and difficulty in maintaining, especially when the data storage architecture has many layers. And when complicated.

Method used

By recording the target architecture configuration information of different application scenarios in the configuration file, and when receiving a data write request, load the corresponding data storage architecture according to the scenario information, control the storage node to write data, and avoid hard coding in the program code. Data storage architecture configuration.

Benefits of technology

It simplifies the program code for the server to provide data writing services, reduces the difficulty of code maintenance, and enhances the scalability of the program code through scenario-based configuration, realizing hot update and disaster recovery and downgrade management of the data storage architecture.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114077639B
    Figure CN114077639B
Patent Text Reader

Abstract

The embodiments of the present disclosure provide a data writing method, device, electronic device and storage medium. The method includes: when a data writing request is received, obtaining the scenario information of the data writing request and the target architecture configuration information corresponding to the scenario information, wherein the target architecture configuration information is recorded in a configuration file; loading the target data storage architecture according to the target architecture configuration information; controlling the storage nodes in the target data storage architecture to write the target data, wherein the target data is the data requested to be written by the data writing request. The embodiments of the present disclosure adopt the above-mentioned technical solution to record the architecture configuration information of the data storage architecture used by the server when writing data in different application scenarios in the configuration file of the server instead of the program code of the server providing data writing service, thereby streamlining the program code of the server providing data writing service and reducing the difficulty of maintaining the program code.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present disclosure relate to data writing technology, and more particularly to a data writing method, device, electronic device and storage medium. Background Art

[0002] When a user needs to write data, the server needs to provide the user with data writing services.

[0003] In servers that provide high-Query Per Second (QPS) services, the underlying layer needs to be supported by multiple data storage services (such as MySQL, Redis, MongoDB, local cache, etc.). Since the performance of different storage services varies, and the position and role of the same data storage service in the data storage architecture in different data writing scenarios may also be different, it is necessary to pre-set the data storage architecture for each data writing scenario.

[0004] The prior art mainly specifies the data storage architecture of several common scenarios in the program code of the data writing service during the program writing stage. However, when the data storage architecture has many levels and is more complex, this configuration method will make the program code bloated and difficult to maintain. Summary of the invention

[0005] The embodiments of the present disclosure provide a data writing method, device, electronic device and storage medium to simplify the program code of a server providing data writing services and reduce the difficulty of maintaining the program code.

[0006] In a first aspect, an embodiment of the present disclosure provides a data writing method, comprising:

[0007] When a data write request is received, scene information of the data write request and target architecture configuration information corresponding to the scene information are obtained, wherein the target architecture configuration information is recorded in a configuration file;

[0008] Loading a target data storage architecture according to the target architecture configuration information;

[0009] The storage nodes in the target data storage architecture are controlled to write target data, where the target data is the data requested to be written by the data write request.

[0010] In a second aspect, the present disclosure also provides a data writing device, including:

[0011] An information acquisition module, used for acquiring, upon receiving a data write request, scenario information of the data write request and target architecture configuration information corresponding to the scenario information, wherein the target architecture configuration information is recorded in a configuration file;

[0012] An architecture loading module, used to load a target data storage architecture according to the target architecture configuration information;

[0013] The data writing module is used to control the storage nodes in the target data storage architecture to write target data, where the target data is the data requested to be written by the data writing request.

[0014] In a third aspect, an embodiment of the present disclosure further provides an electronic device, including:

[0015] one or more processors;

[0016] a memory for storing one or more programs,

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the data writing method as described in the embodiment of the present disclosure.

[0018] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the data writing method as described in the embodiment of the present disclosure is implemented.

[0019] The data writing method, device, electronic device and storage medium provided by the embodiments of the present disclosure, when receiving a data writing request, obtain the scenario information of the data writing request and the target architecture configuration information corresponding to the scenario information recorded in the configuration file, and load the target data storage architecture according to the target architecture configuration information, and then control the storage nodes in the target data storage architecture to write the target data requested to be written by the data writing request. The embodiments of the present disclosure adopt the above-mentioned technical scheme to record the architecture configuration information of the data storage architecture used by the server when writing data in different application scenarios in the configuration file of the server instead of the program code of the server providing data writing service, so as to streamline the program code of the server providing data writing service and reduce the difficulty of maintaining the program code. In addition, by configuring the storage architecture in a scenario-based manner in the configuration file and setting different data storage architectures for different application scenarios, the scalability of the program code can also be enhanced. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.

[0021] Figure 1 A flowchart of a data writing method provided by an embodiment of the present disclosure;

[0022] Figure 2 A schematic diagram of a flow chart of another data writing method provided by an embodiment of the present disclosure;

[0023] Figure 3 A schematic diagram of the structure of a linked list corresponding to a data storage architecture provided in an embodiment of the present disclosure;

[0024] Figure 4 A schematic diagram of the structure of a linked list corresponding to an updated data storage architecture provided in an embodiment of the present disclosure;

[0025] Figure 5 A schematic diagram of the structure of a linked list corresponding to another updated data storage architecture provided in an embodiment of the present disclosure;

[0026] Figure 6 A structural block diagram of a data writing device provided by an embodiment of the present disclosure;

[0027] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0028] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0029] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0030] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0031] It should be noted that the concepts of "first", "second", etc. mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units. [Ordinal Number]

[0032] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0033] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0034] Figure 1 A flowchart of a data writing method provided in an embodiment of the present disclosure. The method can be executed by a data writing device, wherein the device can be implemented by software and / or hardware, and can be configured in an electronic device, typically, can be configured in a server. Optionally, the data writing method provided in an embodiment of the present disclosure is applicable to the case of writing data based on a received data writing request, and is particularly applicable to the case of writing data to a data storage architecture in which data is stored in a key-value pair storage manner in a storage node after receiving a data writing request. Figure 1 As shown, the data writing method provided by the embodiment of the present disclosure may include:

[0035] S101. When a data write request is received, scene information of the data write request and target architecture configuration information corresponding to the scene information are obtained, wherein the target architecture configuration information is recorded in a configuration file.

[0036] Among them, the data write request can be a write data request sent by the terminal device to the local end when the user has a data write demand, for requesting the local end to write a certain piece of data, such as a data deletion request for requesting to delete a certain piece of data, a data update request for requesting to update a certain piece of data, or a data insertion request for requesting to insert a certain piece of data. The data write request may or may not carry the identity of the data requested to be written, such as a data ID. The scenario information of the data write request can be understood as information describing the application scenario of the data write request, such as the identity of its application scenario (such as a scenario ID), or the upstream business party, service cluster and / or scenario parameters such as the sending time of the data write request. The target architecture configuration information is the configuration information of the target data storage architecture applicable to the application scenario to which the data write request belongs. When the application scenario is different, the storage architecture used when writing data may be different. The configuration file can be understood as a file used to record the architecture configuration information of each data storage architecture configured by the server to realize data writing. The architecture configuration information recorded in the configuration file can be set by the server developer or operation and maintenance personnel before the server runs and / or updated during the server operation.

[0037] Specifically, after receiving the data write request sent by the terminal device, the server parses the data write request to obtain the scene parameters of the application scenario of the data write request. Furthermore, when the configuration file contains corresponding records of the scene parameters of each application scenario and the architecture configuration information of the corresponding application scenario, the architecture configuration information corresponding to the scene parameters can be queried and obtained as the target architecture configuration information according to the correspondence between each scene parameter and each architecture configuration information recorded in the configuration file; when the configuration file contains corresponding records of the identity identifier of each application scenario and the architecture configuration information of the corresponding application scenario, the identity identifier of the application scenario corresponding to the scene parameter can be queried according to the pre-set correspondence table between the scene parameter and the scene identity identifier, and the architecture configuration information of the application scenario to which the data write request belongs can be queried and obtained as the target architecture configuration information.

[0038] S102: Load the target data storage architecture according to the target architecture configuration information.

[0039] Among them, the target data storage architecture can be understood as the storage architecture adopted when writing the data requested by the data write request, and accordingly, the target architecture configuration information is the architecture configuration information of the target data storage architecture. The target data storage architecture may include multiple storage nodes that can provide data storage services, and the node type of each storage node may be the same or different. For example, the target storage architecture may be provided with multiple storage nodes of the same type, or only storage nodes of different types may be provided. The target data storage architecture can be abstracted as a linked list, that is, the target data storage architecture can be presented in the memory in the form of a linked list, and accordingly, each storage node in the target data storage architecture can be abstracted as a node in the linked list. The node type of the storage node can be Redis, MySQL or MongoDB, etc., and accordingly, the target data storage node can be provided with one or more Redis databases, one or more MySQL databases and / or one or more MongoDB databases, etc.

[0040] Specifically, the server reads the target architecture configuration information in the configuration file, and loads the data storage architecture corresponding to the target architecture configuration information into the memory according to the read target architecture configuration information, that is, the target data storage architecture.

[0041] In this embodiment, the server may execute the operation of loading the target data storage architecture each time it receives a data write request; or it may execute the operation of loading the target data storage architecture only when the data storage architecture corresponding to the application scenario to which the received data write request belongs is not loaded in the memory or the architecture configuration information of the data storage architecture corresponding to the application scenario to which the received data write request belongs loaded in the memory is different from the acquired target architecture configuration information. This embodiment does not limit this.

[0042] S103: Control the storage nodes in the target data storage architecture to write target data, where the target data is the data requested to be written by the data write request.

[0043] Among them, the target data is the data requested to be written by the data write request, that is, when the data write request is a data deletion request, the target data is the data requested to be deleted by the data write request; when the data write request is a data update request, the target data is the data after the data is updated as requested by the data write request. At this time, the data write request can further include the data to be updated before the data requested to be updated by the data write request; when the data write request is a data insertion request, the target data is the data requested to be inserted by the data write request.

[0044] Specifically, the server pre-parses the received data write request to determine the target data of the data write request. Thus, after the target data storage node is loaded, the server can simultaneously control each storage node in the target data storage architecture to write the target data; or, control each storage node in the target storage architecture to write the target data randomly or in a certain order (such as in the order of the hierarchy of each storage node in the target data storage architecture from high to low, etc.).

[0045] Exemplarily, when a data write request is a data delete request, the data write request may carry the target data that it requests to delete, or may not carry the target data that it requests to delete, but only carry the data identifier of the target data that it requests to delete; accordingly, when the server controls a storage node to write target data, it can control the storage node to determine the storage location of the target data in the storage node based on the target data or the data identifier of the target data carried in the data write request, and delete the target data stored in it.

[0046] When a data write request is a data update request, the data write request may carry the target data to be updated before the update and the target data after the update, or carry the data identifier of the target data to be updated and the updated target data; accordingly, when the server controls a storage node to write target data, it can control the storage node to determine the storage location of the data to be updated in the storage node according to the data to be updated or the data identifier carried in the data write request, delete the original data, and write the target data to the storage location.

[0047] When the data write request is a data insert request, the data write request may carry the target data requested to be inserted; accordingly, when the server controls a storage node to write the target data, it may obtain a storage location that can store the target data and write the target data at the storage location.

[0048] The data writing method provided in this embodiment, when receiving a data writing request, obtains the scenario information of the data writing request and the target architecture configuration information corresponding to the scenario information recorded in the configuration file, and loads the target data storage architecture according to the target architecture configuration information, and then controls the storage nodes in the target data storage architecture to write the target data requested to be written by the data writing request. This embodiment adopts the above technical solution to record the architecture configuration information of the data storage architecture used by the server when writing data in different application scenarios in the configuration file of the server instead of the program code of the server providing data writing service, which can streamline the program code of the server providing data writing service and reduce the difficulty of maintaining the program code. In addition, by configuring the storage architecture in a scenario-based manner in the configuration file and setting different data storage architectures for different application scenarios, the scalability of the program code can also be enhanced.

[0049] Figure 2 A flow chart of a data writing method provided for an embodiment of the present disclosure, the scheme in this embodiment can be combined with one or more optional schemes in the above embodiments. In this embodiment, optionally, the root node of the target data storage architecture is determined as the current node; whether the current node is a non-virtual node is determined; if the current node is a non-virtual node, the target data writing function of the current node is determined according to the target architecture configuration information, and the target data writing function corresponds to the data writing request; the target data writing function is called to control the current node to write the target data; the next node is determined as the current node, and the operation of determining whether the current node is a non-virtual node is returned to execute until there is no next node.

[0050] Optionally, before determining the target data write function of the current node according to the target architecture configuration information, it also includes: determining that the current node has no fallback flag set, and the fallback flag is used to indicate that this end directly controls the fallback node of the current node to write the target data; accordingly, the method also includes: if the current node is set with a fallback flag, the fallback node of the current node recorded in the target architecture configuration information is determined as the current node, and returns to execute the operation of determining whether the current node is a non-virtual node.

[0051] Optionally, the data writing method provided in this embodiment also includes: if the current node is a virtual node, determining the next write node of the current node recorded in the target architecture configuration information as the current node, and returning to execute the operation of determining whether the current node is a non-virtual node.

[0052] Optionally, before loading the target data storage architecture according to the target architecture configuration information, it also includes: determining that the original data storage architecture is not loaded in the memory or the original architecture configuration information of the original data storage architecture loaded in the memory is different from the target architecture configuration information, wherein the original data storage architecture corresponds to the scene information.

[0053] Correspondingly, such as Figure 2 As shown, the data writing method provided in this embodiment may include:

[0054] S201. When a data write request is received, scene information of the data write request and target architecture configuration information corresponding to the scene information are obtained, and the target architecture configuration information is recorded in a configuration file.

[0055] S202. Determine whether the original data storage architecture is not loaded in the memory or the original architecture configuration information of the original data storage architecture loaded in the memory is different from the target architecture configuration information, wherein the original data storage architecture corresponds to the scenario information.

[0056] Correspondingly, if the original configuration information of the original data storage architecture loaded in the memory is the same as the target architecture configuration information, the original data storage architecture can be determined as the target data storage architecture, and the target data requested by the data write request can be written based on the target data storage architecture.

[0057] Among them, the memory can be understood as the memory space of the server, that is, the internal memory of the computer device that hosts the server; the original architecture configuration information can be understood as the data storage architecture corresponding to the application scenario of the data write request loaded before the current moment.

[0058] In this embodiment, the server loads the target data storage architecture only when the original data storage architecture corresponding to the application scenario of the data write request is not loaded in the memory (that is, the original data storage architecture corresponding to the scenario information of the data write request is not loaded) or the original architecture configuration information of the original data storage architecture loaded in the memory is different from the target architecture configuration information recorded in the configuration file; when the original data storage architecture is loaded in the memory and the original architecture configuration information of the original data storage architecture is the same as the target architecture configuration information recorded in the configuration file, the operation of loading the target data storage architecture is no longer performed, but the storage nodes in the original data storage architecture are directly controlled to write data, thereby further simplifying the operations required to be performed when writing data and improving the response speed of the server.

[0059] Specifically, after obtaining the scene information and target architecture configuration information of the data write request, the server determines whether there is an original data storage architecture corresponding to the scene information in the memory. If not, the target data storage architecture is loaded according to the target architecture configuration information; if it exists, the architecture configuration information of the original data storage architecture is obtained, and further determined whether the architecture configuration information of the original data storage architecture is the same as the target architecture configuration information. If they are the same, the original data storage architecture is directly determined as the target data storage architecture; if they are not the same, the target data storage architecture is loaded according to the target architecture configuration information, and after all original data write requests for data writing based on the original data storage architecture received before the data write request are processed, the original storage architecture is deleted from the memory to avoid useless data storage architectures occupying memory.

[0060] In one embodiment, the developer or operation and maintenance personnel of the server can modify the configuration information of the data storage architecture recorded in the configuration file of the server. Thus, when the server receives the configuration update instruction, it can update the target architecture configuration information according to the configuration update instruction.

[0061] Specifically, when the server detects that the developer or operation and maintenance personnel has triggered an operation to modify the architecture configuration information (such as the target architecture configuration information) in the configuration file, it determines that it has received a configuration update instruction, and updates the architecture configuration information in the configuration file based on the input operation of the developer or operation and maintenance personnel, such as adding, deleting or modifying the architecture configuration information recorded in the configuration file, thereby realizing the addition, deletion or modification of the data storage architecture corresponding to the server.

[0062] In this embodiment, server developers and operation and maintenance personnel can change the architecture configuration information recorded in the configuration file when encountering an emergency (such as a surge in traffic, Redis avalanche or MySQL blocking, etc.), thereby changing the corresponding data storage architecture of the server, thereby realizing hot updates of the server's data storage architecture, meeting the needs of rapid and emergency degradation, current limiting, diversion, cleanup and side effects of storage nodes in the data storage architecture, and converging the management of the architecture information of the data storage architecture, and the disaster recovery, degradation, current limiting, diversion, cleanup and side effects of the data storage architecture.

[0063] For example, assume that a data storage structure of a server is abstracted into a linked list such as Figure 3 As shown in the figure, the data storage architecture includes three storage nodes: MySQL, Redis, and MongoDB. MongoDB is the backup node of MySQL, and Redis is located at the next layer of MySQL. When the server writes data, it first controls MySQL to write data. If the writing is successful, it continues to control Redis to write data; if the writing fails, it controls MongoDB to write data. If MySQL crashes at a certain moment, causing a large number of slow SQLs, continuing to control MySQL to write data will cause a large amount of data to fail to write. At this time, the operation and maintenance personnel can update the data storage architecture by changing the architecture configuration information of the data storage architecture and move MySQL outside the data storage architecture (such as Figure 4 Or, perform a disaster recovery switch and switch MySQL to MongoDB (as shown in Figure 5 shown).

[0064] It is understandable that the present embodiment may not obtain the original architecture configuration information of the original data storage architecture, but directly determine whether the original architecture configuration information of the original storage architecture is the same as the target architecture configuration information based on the loading time of the original storage architecture and the update time of the target architecture configuration information. For example, the server may record the update time of the target architecture configuration information when updating the target architecture configuration information, and record the loading time of the original data storage architecture when loading the original data storage architecture. Thus, after determining that the original data storage architecture corresponding to the scene information of the data write request is loaded in the memory, it can be determined whether the update time of the target architecture configuration information is later than the loading time of the original data storage architecture. If so, it is determined that the original architecture configuration information of the original data storage architecture is different from the target architecture configuration information; if not, it is determined that the original architecture configuration information of the original data storage architecture is the same as the target architecture configuration information.

[0065] S203: Load the target data storage architecture according to the target architecture configuration information.

[0066] S204: Determine the root node of the target data storage architecture as the current node.

[0067] The current node may be understood as a storage node in the target data storage architecture that currently needs to be controlled to write target data.

[0068] S205, determining whether the current node is a non-virtual node, if so, executing S206 or S207; if not, executing S209.

[0069] In this embodiment, in order to facilitate the control of each storage node, each storage node can be set as an ordinary node or a virtual node according to whether each storage node has a data writing function. Among them, an ordinary node is a storage node with a data writing function; a virtual node is a storage node without a data writing function. Thus, the target architecture configuration information may include the configuration information of each storage node in the target storage architecture, that is, the node configuration information. The node configuration information of a certain storage node may record the node type information of the storage node and the next write node. When a certain storage node cannot provide the data writing function normally, the developer or operation and maintenance personnel of the server can set the storage node as a virtual node, that is, change the type information of the storage node recorded in the node configuration information of the storage node to a virtual node. Correspondingly, if the node type of a certain storage node is a virtual node, it means that the storage node cannot provide data writing services normally. Among them, the next write node can be understood as a node that needs to continue writing target data when the current node is a virtual node or the current node writes the target data without exception.

[0070] Specifically, after determining the current node, the server determines whether the current node is a virtual node based on the node configuration information of the current node. If the current node is a virtual node, it is further determined whether the current node has a next write node based on the node configuration information of the current node. If there is a next write node, the next write node of the current node is determined as the current node, and the process returns to S205; if there is no next write node, it is determined that the target data has been written and the operation ends. Correspondingly, if the current node is not a virtual node, it is possible to continue to determine whether the current node is set with a fallback flag and perform corresponding operations.

[0071] S206. If the current node is set with a fallback flag, the fallback node of the current node recorded in the target architecture configuration information is determined as the current node, and the process returns to execute S205. The fallback flag is used to instruct the local end to directly control the fallback node of the current node to write target data.

[0072] In this embodiment, the node configuration information of each storage node in the target data storage architecture may also include the fallback node and fallback identification information of the corresponding storage node. Among them, the fallback node of the storage node can be understood as the storage node to which the data is further written when the server fails to write data in the storage node (i.e., an exception occurs during the process of writing data), that is, when an exception occurs when controlling the storage node to write data, the server further controls the fallback node of the storage node to write data; the fallback identification information can be understood as information indicating whether the server directly skips the storage node and controls the fallback node of the storage node to write data, that is, when the fallback identification information of the storage node is not empty, that is, when the storage node is provided with a fallback identification, the server directly jumps the storage node and directly controls the fallback node of the storage node to write data, thereby realizing the hot degradation of the data storage architecture in an emergency.

[0073] Specifically, after determining that the current node is not a virtual node, the server determines whether the fallback identification information in the node configuration information of the current node is empty. If so, it is determined that the current node has not set the fallback identification and executes subsequent operations; if not, it is determined that the current node has a fallback identification, and the fallback node of the current node recorded in the node configuration information of the current node is determined as the current node, and returns to execute S205.

[0074] It can be understood that the present embodiment does not restrict the execution order of the two judgment operations of judging whether the current node is a virtual node and judging whether the current node is set with a fallback identifier. For example, after determining the current node, the present embodiment may first judge whether the current node is set with a fallback identifier. If so, the fallback node of the current node recorded in the node configuration information of the current node is directly determined as the current node, and the operation of judging whether the current node is set with a fallback identifier is returned to be executed; if not, whether the current node is a virtual node is further judged. If the current node is a virtual node, the next write node of the current node is determined as the current node, and the operation of judging whether the current node is set with a fallback identifier is returned to be executed; if the current node is not a virtual node, the current node can be controlled to write the target data.

[0075] S207: If the current node does not have a fallback flag set, determine the target data write function of the current node according to the target architecture configuration information, where the target data write function corresponds to the data write request.

[0076] In this embodiment, the node configuration information of each storage node in the target data storage architecture may also include the object name of the data access object of the corresponding storage node. Wherein, the data access object is an interface object for accessing the corresponding storage node (such as the corresponding database). The object information of the data access object can be set in advance by the server or database developer and stored in the server or the corresponding storage node, which may include the object name of the data access object and the data write function; it may further include the pointer type of the data access object. The object name of the data access object is the unique identifier of the data access object when the server writes data; the data write function can be used to write data to the corresponding storage node, such as deleting or updating the data stored in the corresponding storage node or inserting new data in the corresponding storage node. Accordingly, the data write function can be a data deletion function, a data update function or a data insertion function; the pointer type can be used to characterize the specific type of data written by the data access object.

[0077] Specifically, when the current node does not have a fallback flag set, it means that the server can control the current node to write the target data without skipping the current node and directly controlling the fallback node of the current node to perform the data write operation. Therefore, when the current node does not have a fallback flag set, the server can determine the data access object of the current node based on the name of the data access object of the current node recorded in the node configuration information of the current node, and then determine the data write function recorded in the object information of the data access object and corresponding to the data write request as the data write function of the current node when processing the data write request, such as when the data write request is data deletion, the data deletion function in the data access object of the current node is used as the data write function; when the data write request is a data update request, the data update function of the data access object of the current node is used as the data write function; when the data write request is a data insert request, the data insert function of the data access object of the current node is used as the data write function.

[0078] S208: Call the target data writing function to control the current node to write the target data.

[0079] Specifically, the server sends the target data and / or the identity of the target data to the current node; correspondingly, the current node executes its own data writing function according to the target data and / or the identity of the target data.

[0080] In one implementation, the data writing method provided in this embodiment may further include: if the current node is set with a cleanup flag, determining a target node corresponding to the cleanup flag, and controlling the target node to delete the stored original data, the original data corresponding to the target data.

[0081] Among them, the original data can be data related to the target data and data that will cause calculation errors after the target data changes, such as data calculated based on the target data, data to be updated before the target data is updated, or data that needs to be further deleted in other nodes after deleting the target data, etc.

[0082] In the above implementation, the node configuration information of the storage node in the target data storage architecture may also include the cleaning identification information of the storage node, so as to realize the cleaning of the data corresponding to the target data in other nodes. The cleaning identification information can be set by the server developer or operation and maintenance personnel as needed. When the node name of the target storage node is recorded in the cleaning identification information in the node configuration information of the current node, it means that the current node is set with a cleaning identification. After the current node successfully writes the target data, it is also necessary to control the target storage node to clean up the original data corresponding to the target data, such as calling the data deletion function in the data access object of the target storage node, so as to control the target storage node to delete the original data stored by it and corresponding to the target data. That is, when the current node is set with a cleaning identification, the server can create a new thread to execute after determining that the target data is successfully written to the current node, and execute the data deletion function of the target storage node through the new thread.

[0083] In one implementation, the data writing method provided in this embodiment may further include: if the current node is set with a side effect flag, executing the side effect function of the current node.

[0084] In the above implementation, the node configuration information of the storage node in the target data storage architecture may also include the side effect identification information of the storage node, so as to realize the execution of the side effect. The side effect identification information may be set by the server developer or operation and maintenance personnel as needed. When the side effect function that needs to be executed is recorded in the side effect identification information in the node configuration information of the current node, it means that the current node is set with a side effect identification, and the side effect function needs to be executed after the current node successfully writes the target data. That is, when the current node has a side effect identification, the server can create a new thread to execute the side effect function of the current node after determining that the target data is successfully written to the current node.

[0085] S209, determine whether there is a next node, if yes, execute S210; if not, end the operation.

[0086] The next node may be understood as the next node that controls writing target data.

[0087] In this embodiment, it is possible to ignore whether an exception occurs when the current node writes the target data and directly use the next write node of the current node as the next node; it is also possible to consider whether an exception occurs when the current node writes the target data, and when the current node is a virtual node, or when the current node is not a virtual node and no exception occurs when writing the target data, use the next write node of the current node as the next node; when the current node is not a virtual node and an exception occurs when writing the target data, use the backup node of the current node as the next node, so as to improve the convenience of subsequent querying of the target data. The following takes this case as an example for explanation.

[0088] Among them, the next node can be understood as the next node that controls the writing of target data. Whether an exception occurs in the process of the current node writing the target data can be determined based on the return information of the current node. When the current node is set with an asynchronous write flag, that is, when the asynchronous execution information in the node configuration information of the current node is not empty, the process of controlling the current node to write the target data can be executed asynchronously. At this time, it can be directly determined that no exception occurs in the process of the current node data writing the target data.

[0089] S210: Determine the next node as the current node, and return to execute S205.

[0090] Specifically, if the current node is a virtual node, or the current node is not a virtual node and no exception occurs when writing the target data, the next write node of the current node recorded in the target architecture configuration information is determined as the current node; if the current node is not a virtual node and an exception occurs when writing the target data, the backup node of the current node is determined as the current node.

[0091] In one embodiment, when the current node is not a virtual node, determining the next node as the current node includes: if no exception occurs when the current node writes the target data, then determining the next write node of the current node recorded in the target architecture configuration information as the current node; if an exception occurs when the current node writes the target data and the current node is not in a stop writing state, then determining the backup node of the current node recorded in the target architecture configuration information as the current node.

[0092] In the above implementation scheme, when the server determines that the current node has an exception during the process of writing data, it determines whether the current node is in a stop-write state, such as determining whether the fast failure information in the node configuration information of the current node is set to "yes". If so, it is determined that the current node is in a stop-write state, and stops controlling the storage nodes in the target storage architecture to write the target data; if not, it is determined that the current node is not in a stop-write state, and the backup node of the current node recorded in the target architecture configuration information is determined as the current node, and returns to execute S205. Among them, the fast failure information of the storage node can be recorded in the node configuration information of the storage node.

[0093] Therefore, by setting the node type and the fallback node for the storage nodes in the data storage structure, the architecture configuration information of the data storage architecture is recorded through the configuration file, and the architecture configuration information includes the node name of each storage node and the node name of the fallback node in the data storage architecture; when it is determined that the target architecture configuration information of the target data storage architecture has changed, the target data storage architecture is loaded according to the target architecture configuration information, and the storage nodes in the loaded target data storage architecture are controlled to write data, which can not only streamline the program code of the server providing write services and reduce the difficulty of maintaining the program code; it can also realize the hot update of the data storage architecture and the disaster recovery and degradation of the data storage architecture, and can converge the data storage architecture, the disaster recovery and degradation of the data storage architecture and other solutions in one place for management, thereby reducing the difficulty of managing the data storage architecture.

[0094] Figure 6 This is a structural block diagram of a data writing device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware, can be configured in an electronic device, typically, can be configured in a server, and can write data by executing a data writing method. Figure 6 As shown, the data writing device provided by the embodiment of the present disclosure may include an information acquisition module 301, an architecture loading module 302 and a data writing module 303, wherein:

[0095] The information acquisition module 301 is used to acquire the scenario information of the data writing request and the target architecture configuration information corresponding to the scenario information when receiving the data writing request, wherein the target architecture configuration information is recorded in the configuration file;

[0096] An architecture loading module 302 is used to load a target data storage architecture according to the target architecture configuration information;

[0097] The data writing module 303 is used to control the storage nodes in the target data storage architecture to write target data, where the target data is the data requested to be written by the data writing request.

[0098] The data writing device provided by this embodiment, when receiving a data writing request, the information acquisition module obtains the scenario information of the data writing request and the target architecture configuration information corresponding to the scenario information recorded in the configuration file, and loads the target data storage architecture according to the target architecture configuration information through the architecture loading module, and then controls the storage nodes in the target data storage architecture to write the target data requested to be written by the data writing request through the data writing module. This embodiment adopts the above-mentioned technical solution to record the architecture configuration information of the data storage architecture used by the server when writing data in different application scenarios in the configuration file of the server instead of the program code of the server providing data writing service, which can streamline the program code of the server providing data writing service and reduce the difficulty of maintaining the program code. In addition, by configuring the storage architecture in a scenario-based manner in the configuration file and setting different data storage architectures for different application scenarios, the scalability of the program code can also be enhanced.

[0099] In the above scheme, the data writing module 303 may include: a node determination unit, used to determine the root node of the target data storage architecture as the current node; a virtual node judgment unit, used to determine whether the current node is a non-virtual node; a function determination unit, used to determine the target data writing function of the current node according to the target architecture configuration information when the current node is a non-virtual node, and the target data writing function corresponds to the data writing request; a data writing unit, used to call the target data writing function to control the current node to write the target data; a return unit, used to determine the next node as the current node and return to the virtual node judgment unit.

[0100] In the above scheme, the next node is the next write node or the fallback node of the current node; the return unit can be used to: when no exception occurs when the current node writes the target data, determine the next write node of the current node recorded in the target architecture configuration information as the current node; when an exception occurs when the current node writes the target data and the current node is not in a stop writing state, determine the fallback node of the current node recorded in the target architecture configuration information as the current node.

[0101] In the above scheme, the data writing module 303 may also include: a fallback identifier determination unit, which is used to determine that the current node has no fallback identifier set before determining the target data writing function of the current node according to the target architecture configuration information, and the fallback identifier is used to indicate that this end directly controls the fallback node of the current node to write the target data; accordingly, the fallback identifier determination unit is also used to: when the current node is set with a fallback identifier, determine the fallback node of the current node recorded in the target architecture configuration information as the current node, and return it to the virtual node judgment unit.

[0102] In the above scheme, the data writing module 303 may also include: a writing node determination unit, which is used to determine the next writing node of the current node recorded in the target architecture configuration information as the current node when the current node is a virtual node, and return it to the virtual node judgment unit.

[0103] In the above scheme, the data writing module 303 may also include: a cleaning unit, which is used to determine the target node corresponding to the cleaning identifier when the current node is set with a cleaning identifier, and control the target node to delete the stored original data, and the original data corresponds to the target data.

[0104] In the above solution, the data writing module 303 may further include: a side effect unit, configured to execute a side effect function of the current node when a side effect flag is set on the current node.

[0105] Optionally, the data writing device provided by this embodiment may further include: an architecture determination module, which, before loading the target data storage architecture according to the target architecture configuration information, determines that the original data storage architecture is not loaded in the memory or the original architecture configuration information of the original data storage architecture loaded in the memory is different from the target architecture configuration information, wherein the original data storage architecture corresponds to the scene information.

[0106] Optionally, the data writing device provided in this embodiment may further include: an information updating module, configured to update the target architecture configuration information according to the configuration updating instruction when receiving the configuration updating instruction.

[0107] The data writing device provided in the embodiment of the present disclosure can execute the data writing method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of executing the data writing method. For technical details not described in detail in this embodiment, please refer to the data writing method provided in any embodiment of the present disclosure.

[0108] Reference below Figure 7 , which shows a structural diagram of an electronic device (eg, a server) 700 suitable for implementing an embodiment of the present disclosure. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0109] like Figure 7 As shown, the electronic device 700 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the electronic device 700 are also stored. The processing device 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0110] Typically, the following devices may be connected to the I / O interface 705: an input device 706 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, etc.; an output device 707 including, for example, a liquid crystal display (LCD), a speaker, etc.; a storage device 708 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 709. The communication device 709 may allow the electronic device 700 to communicate with other devices wirelessly or by wire to exchange data. Figure 7 The electronic device 700 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0111] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 709, or installed from a storage device 708, or installed from a ROM 702. When the computer program is executed by the processing device 701, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.

[0112] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0113] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0114] The computer-readable medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0115] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: when receiving a data write request, obtains the scenario information of the data write request and the target architecture configuration information corresponding to the scenario information, wherein the target architecture configuration information is recorded in a configuration file;

[0116] Loading a target data storage architecture according to the target architecture configuration information;

[0117] The storage nodes in the target data storage architecture are controlled to write target data, where the target data is the data requested to be written by the data write request.

[0118] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).

[0119] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0120] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a module does not, in some cases, constitute a limitation on the unit itself.

[0121] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0122] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0123] According to one or more embodiments of the present disclosure, Example 1 provides a data writing method, including:

[0124] When a data write request is received, scene information of the data write request and target architecture configuration information corresponding to the scene information are obtained, wherein the target architecture configuration information is recorded in a configuration file;

[0125] Loading a target data storage architecture according to the target architecture configuration information;

[0126] The storage nodes in the target data storage architecture are controlled to write target data, where the target data is the data requested to be written by the data write request.

[0127] According to one or more embodiments of the present disclosure, Example 2 is based on the method described in Example 1,

[0128] The controlling the storage nodes in the target data storage architecture to write the target data comprises:

[0129] Determine the root node of the target data storage architecture as the current node;

[0130] Determine whether the current node is a non-virtual node;

[0131] If the current node is a non-virtual node, determining a target data write function of the current node according to the target architecture configuration information, the target data write function corresponding to the data write request;

[0132] Calling the target data writing function to control the current node to write the target data;

[0133] The next node is determined as the current node, and the operation of determining whether the current node is a non-virtual node is returned to be executed until there is no next node.

[0134] According to one or more embodiments of the present disclosure, Example 3 is the method according to Example 2, wherein the next node is the next write node or the bottom node of the current node; and determining the next node as the current node includes:

[0135] If no exception occurs when the current node writes the target data, determining the next write node of the current node recorded in the target architecture configuration information as the current node;

[0136] If an exception occurs when the current node writes the target data and the current node is not in a stop-write state, the backup node of the current node recorded in the target architecture configuration information is determined as the current node.

[0137] According to one or more embodiments of the present disclosure, Example 4 is the method according to Example 2, and before determining the target data write function of the current node according to the target architecture configuration information, further includes:

[0138] Determine that the current node is not set with a fallback flag, and the fallback flag is used to indicate that the local end directly controls the fallback node of the current node to write target data;

[0139] Accordingly, the method further includes:

[0140] If the current node is set with a fallback flag, the fallback node of the current node recorded in the target architecture configuration information is determined as the current node, and the operation of determining whether the current node is a non-virtual node is returned to be executed.

[0141] According to one or more embodiments of the present disclosure, Example 5 is the method according to Example 2, further comprising:

[0142] If the current node is a virtual node, the next write node of the current node recorded in the target architecture configuration information is determined as the current node, and the operation of determining whether the current node is a non-virtual node is returned to be executed.

[0143] According to one or more embodiments of the present disclosure, Example 6 is a method according to any one of Examples 2-5, further comprising:

[0144] If the current node is set with a cleaning identifier, a target node corresponding to the cleaning identifier is determined, and the target node is controlled to delete stored original data, where the original data corresponds to the target data.

[0145] According to one or more embodiments of the present disclosure, Example 7 is a method according to any one of Examples 2-5, further comprising:

[0146] If the current node is set with a side effect flag, the side effect function of the current node is executed.

[0147] According to one or more embodiments of the present disclosure, Example 8 is a method according to any one of Examples 1-5, and, before loading the target data storage architecture according to the target architecture configuration information, further includes:

[0148] Determine that the original data storage architecture is not loaded in the memory or the original architecture configuration information of the original data storage architecture loaded in the memory is different from the target architecture configuration information, wherein the original data storage architecture corresponds to the scene information.

[0149] According to one or more embodiments of the present disclosure, Example 9 is the method according to Example 8, further comprising:

[0150] When a configuration update instruction is received, the target architecture configuration information is updated according to the configuration update instruction.

[0151] According to one or more embodiments of the present disclosure, Example 10 provides a data writing device, including:

[0152] An information acquisition module, used for acquiring, upon receiving a data write request, scenario information of the data write request and target architecture configuration information corresponding to the scenario information, wherein the target architecture configuration information is recorded in a configuration file;

[0153] An architecture loading module, used to load a target data storage architecture according to the target architecture configuration information;

[0154] The data writing module is used to control the storage nodes in the target data storage architecture to write target data, where the target data is the data requested to be written by the data writing request.

[0155] According to one or more embodiments of the present disclosure, Example 11 provides an electronic device, including:

[0156] one or more processors;

[0157] a memory for storing one or more programs,

[0158] When the one or more programs are executed by the one or more processors, the one or more processors implement the data writing method as described in any one of Examples 1-9.

[0159] According to one or more embodiments of the present disclosure, Example 12 provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data writing method as described in any one of Examples 1-9.

[0160] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.

[0161] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.

[0162] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A data writing method, It is characterized in that include: When a data write request is received, the scenario information of the data write request and the target architecture configuration information corresponding to the scenario information are obtained, wherein the target architecture configuration information is recorded in a configuration file, wherein the configuration file is a file for recording the architecture configuration information of each data storage architecture, and each data storage architecture is a data storage architecture configured by the server to implement data writing; Loading a target data storage architecture according to the target architecture configuration information, wherein the target data architecture includes a plurality of storage nodes capable of providing data storage services; Determine the root node of the target data storage architecture as the current node; Determine whether the current node is a non-virtual node; If the current node is a non-virtual node, determining a target data write function of the current node according to the target architecture configuration information, the target data write function corresponding to the data write request; Calling the target data writing function to control the current node to write target data, the target data being the data requested to be written by the data writing request; The next node is determined as the current node, and the operation of determining whether the current node is a non-virtual node is returned to be executed until there is no next node.

2. The method according to claim 1, It is characterized in that The next node is the next write node or the backup node of the current node; Determining the next node as the current node includes: If no exception occurs when the current node writes the target data, determining the next write node of the current node recorded in the target architecture configuration information as the current node; If an exception occurs when the current node writes the target data and the current node is not in a stop-write state, the backup node of the current node recorded in the target architecture configuration information is determined as the current node.

3. The method according to claim 1, It is characterized in that Before determining the target data writing function of the current node according to the target architecture configuration information, the method further includes: Determine that the current node is not set with a fallback flag, and the fallback flag is used to indicate that the local end directly controls the fallback node of the current node to write target data; Accordingly, the method further includes: If the current node is set with a fallback flag, the fallback node of the current node recorded in the target architecture configuration information is determined as the current node, and the operation of determining whether the current node is a non-virtual node is returned to be executed.

4. The method according to claim 1, It is characterized in that Also includes: If the current node is a virtual node, the next write node of the current node recorded in the target architecture configuration information is determined as the current node, and the operation of determining whether the current node is a non-virtual node is returned to be executed.

5. The method according to any one of claims 1 to 4, It is characterized in that Also includes: If the current node is set with a cleaning identifier, a target node corresponding to the cleaning identifier is determined, and the target node is controlled to delete stored original data, where the original data corresponds to the target data.

6. The method according to any one of claims 1 to 4, It is characterized in that Also includes: If the current node is set with a side effect flag, the side effect function of the current node is executed.

7. The method according to any one of claims 1 to 4, It is characterized in that Before the target data storage architecture is loaded according to the target architecture configuration information, the method further includes: Determine that the original data storage architecture is not loaded in the memory or the original architecture configuration information of the original data storage architecture loaded in the memory is different from the target architecture configuration information, wherein the original data storage architecture corresponds to the scene information.

8. The method according to claim 7, It is characterized in that Also includes: When a configuration update instruction is received, the target architecture configuration information is updated according to the configuration update instruction.

9. A data writing device, It is characterized in that include: An information acquisition module, used for acquiring, upon receiving a data write request, scenario information of the data write request and target architecture configuration information corresponding to the scenario information, wherein the target architecture configuration information is recorded in a configuration file, and the configuration file is a file for recording architecture configuration information of each data storage architecture, and each data storage architecture is a data storage architecture configured by the server for implementing data writing; An architecture loading module, used to load a target data storage architecture according to the target architecture configuration information, wherein the target data storage architecture includes a plurality of storage nodes capable of providing data storage services; A data writing module, used for controlling the storage nodes in the target data storage architecture to write target data, wherein the target data is the data requested to be written by the data writing request; The data writing module includes: a node determination unit, used to determine the root node of the target data storage architecture as the current node; a virtual node judgment unit, used to judge whether the current node is a non-virtual node; a function determination unit, used to determine the target data writing function of the current node according to the target architecture configuration information when the current node is a non-virtual node, and the target data writing function corresponds to the data writing request; a data writing unit, used to call the target data writing function to control the current node to write the target data; a return unit, used to determine the next node as the current node and return to the virtual node judgment unit.

10. An electronic device, It is characterized in that include: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the data writing method as described in any one of claims 1 to 8.

11. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the data writing method as described in any one of claims 1 to 8 is implemented.