CN118101443A - Data read-write method, apparatus, device, storage medium, and program product - Google Patents

Data read-write method, apparatus, device, storage medium, and program product Download PDF

Info

Publication number
CN118101443A
CN118101443A CN202410224050.1A CN202410224050A CN118101443A CN 118101443 A CN118101443 A CN 118101443A CN 202410224050 A CN202410224050 A CN 202410224050A CN 118101443 A CN118101443 A CN 118101443A
Authority
CN
China
Prior art keywords
server
node server
access request
determining
request
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
CN202410224050.1A
Other languages
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202410224050.1A priority Critical patent/CN118101443A/en
Publication of CN118101443A publication Critical patent/CN118101443A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure provides a data read-write method, relates to the distributed technical field, and can be applied to the financial technical field. The method comprises the following steps: determining, by a proxy node server, a request type of an access request initiated by a client in response to the access request; determining a target server according to the request type of the access request; forwarding the access request to a target server; the health status of the shared file system server is monitored regularly; and if the failure of the main node server is determined, randomly selecting one auxiliary node server as a new main node server. The present disclosure also provides a data read-write apparatus, device, storage medium and program product.

Description

Data read-write method, apparatus, device, storage medium, and program product
Technical Field
The present disclosure relates to the field of distributed technology, and in particular, to the field of shared file transmission technology, and more particularly, to a data reading and writing method, apparatus, device, storage medium, and program product.
Background
Related shared file systems are generally simple in architecture, only provide basic file read-write functions, easily fail when access volume is suddenly high, and lack disaster recovery measures.
It should be noted that the information disclosed in the above background section is only for enhancing understanding of the background of the present disclosure and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
In view of the foregoing, the present disclosure provides a data reading and writing method, apparatus, device, storage medium, and program product.
According to a first aspect of the present disclosure, there is provided a data read-write method applied to a shared file system including a proxy node server, a main node server, and a plurality of subsidiary node servers, the method comprising:
Determining, by the proxy node server, a request type of an access request in response to the access request initiated by the client;
determining a target server according to the request type of the access request;
forwarding the access request to a target server;
The health status of the shared file system server is monitored regularly; and
And if the main node server is determined to be faulty, randomly selecting an auxiliary node server as a new main node server.
According to an embodiment of the present disclosure, the determining the target server according to the request type of the access request includes:
If the request type of the access request is determined to be a file reading request, determining that the target server is an affiliated node server;
And if the request type of the access request is determined to be a file writing request, determining that the target server is a master node server.
According to an embodiment of the disclosure, the proxy node server maintains a server information table, and forwarding the access request to a target server includes:
determining target server address information according to the server information table; and
And forwarding the access request according to the address information of the target server.
According to an embodiment of the present disclosure, the periodically monitoring the health status of the shared file system server includes:
Periodically calling interfaces provided by the main node server and the auxiliary node server;
and determining the health states of the main node server and the auxiliary node server according to the parameters returned by the interfaces.
According to an embodiment of the present disclosure, the method further comprises:
If the auxiliary node server is determined to be faulty, blocking the flow of the auxiliary node server and sending alarm information to operation and maintenance personnel.
According to an embodiment of the present disclosure, after randomly selecting one of the subordinate node servers as the new master node server, further comprising:
updating the synchronization target of the affiliated node server; and
Data is synchronized from the new master node server at regular time.
According to an embodiment of the present disclosure, the method further comprises:
after determining that any server of the shared file system fails, a server information table in the proxy node server is updated.
According to an embodiment of the disclosure, the master node server is configured to process a file write request, the auxiliary node server is configured to process a file read request, and the auxiliary node server performs data synchronization from the master node server at regular time.
A second aspect of the present disclosure provides a data read-write apparatus, the apparatus comprising:
The first determining module is used for responding to an access request initiated by a client, and determining the request type of the access request by the proxy node server;
The second determining module is used for determining a target server according to the request type of the access request;
The forwarding module is used for forwarding the access request to a target server;
The monitoring module is used for regularly monitoring the health state of the shared file system server; and
And the node switching module is used for randomly selecting an auxiliary node server as a new main node server if the main node server is determined to be faulty.
According to an embodiment of the disclosure, the second determining module includes: a first determination sub-module and a second determination sub-module.
The first determining submodule is used for determining that the target server is an affiliated node server if the request type of the access request is determined to be a file reading request;
And the second determining submodule is used for determining that the target server is a main node server if the request type of the access request is determined to be a file writing request.
According to an embodiment of the present disclosure, the forwarding module includes: a third determination sub-module and a forwarding sub-module.
A third determining sub-module, configured to determine target server address information according to the server information table; and
And the forwarding sub-module is used for forwarding the access request according to the address information of the target server.
According to an embodiment of the present disclosure, the monitoring module includes: the interface invokes the sub-module and the fourth determination sub-module.
An interface calling sub-module, configured to regularly call interfaces provided by the main node server and the auxiliary node server;
And the fourth determination submodule is used for determining the health states of the main node server and the auxiliary node server according to the parameters returned by the interface.
According to an embodiment of the present disclosure, the apparatus further comprises: an alarm module and a data synchronization module.
And the alarm module is used for blocking the flow of the auxiliary node server and sending alarm information to operation and maintenance personnel if the auxiliary node server is determined to be faulty.
The data synchronization module is used for updating the synchronization target of the auxiliary node server; data is synchronized from the new master node server at regular time.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the data read-write method described above.
A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-described data read-write method.
A fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the above-described data read-write method.
The data read-write method provided by the embodiment of the disclosure is applied to a shared file system, wherein the shared file system comprises a proxy node server, a main node server and a plurality of auxiliary node servers, shared file system software is deployed in the servers, shared file storage service is provided for the outside, the main node server provides file write service, the auxiliary node server provides file read service, and the proxy node server determines the request type of an access request in response to the access request initiated by a client; determining a target server according to the request type of the access request; forwarding the access request to a target server; the health status of the shared file system server is monitored regularly; if the main node server is determined to be faulty, one auxiliary node server is randomly selected as a new main node server, and the availability of the shared file system is improved.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be more apparent from the following description of embodiments of the disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an application scenario diagram of a data read-write method, apparatus, device, storage medium and program product according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a system configuration diagram of a data read-write apparatus provided according to an embodiment of the present disclosure;
FIG. 3 schematically illustrates a flow chart of a method for reading and writing data provided in accordance with an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow chart of a data read-write method provided in accordance with another embodiment of the present disclosure;
FIG. 5 schematically illustrates a flow chart of a data read-write method provided in accordance with yet another embodiment of the present disclosure;
FIG. 6 schematically illustrates a block diagram of a data read-write apparatus according to an embodiment of the present disclosure; and
Fig. 7 schematically illustrates a block diagram of an electronic device adapted to implement a data read-write method according to an embodiment of the disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a convention should be interpreted in accordance with the meaning of one of skill in the art having generally understood the convention (e.g., "a system having at least one of A, B and C" would include, but not be limited to, systems having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
Based on the technical problems described above, an embodiment of the present disclosure provides a data reading and writing method, including: determining, by the proxy node server, a request type of an access request in response to the access request initiated by the client; determining a target server according to the request type of the access request; forwarding the access request to a target server; the health status of the shared file system server is monitored regularly; and if the main node server is determined to be faulty, randomly selecting an auxiliary node server as a new main node server.
Fig. 1 schematically illustrates an application scenario diagram of a data read-write method, apparatus, device, storage medium and program product according to an embodiment of the present disclosure.
As shown in fig. 1, the application scenario 100 according to this embodiment may include a data read-write scenario. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 105 may be a back-end server, and may perform the data read-write method provided by the embodiments of the present disclosure, and in response to an access request initiated by a client, the proxy node server determines a request type of the access request; determining a target server according to the request type of the access request; forwarding the access request to a target server; the health status of the shared file system server is monitored regularly; and if the main node server is determined to be faulty, randomly selecting an auxiliary node server as a new main node server.
It should be noted that the data read-write method provided by the embodiments of the present disclosure may be generally performed by the server 105. Accordingly, the data read-write device provided in the embodiments of the present disclosure may be generally disposed in the server 105. The data read-write method provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the data read-write apparatus provided by the embodiments of the present disclosure may also be provided in a server or a server cluster that is different from the server 105 and is capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
It should be noted that, the data read-write method and device determined by the embodiments of the present disclosure may be used in the technical field of the internet, may also be used in the technical field of finance, and may also be used in any field other than the financial field, where the application field of the data read-write method and device determined by the embodiments of the present disclosure is not limited.
Fig. 2 schematically illustrates a system configuration diagram of a data read-write apparatus provided according to an embodiment of the present disclosure, and as shown in fig. 2, the data read-write apparatus includes a proxy node server, an auxiliary node server, and a primary node server. The agent node server, the auxiliary node server, the main node server and other servers are used for installing shared file system software and providing shared file storage service to the outside, the main node server is arranged as one server and provides file writing service, and the auxiliary node server is provided with a plurality of servers and provides file reading service. And distributing the request of the client through the proxy node server, distributing the read request to the auxiliary node, and distributing the write request to the main node. The secondary node will synchronize data from the primary node at regular intervals to ensure that the newly written data is correctly read. In addition, in order to improve the high availability of the system, the proxy node monitors the health states of the main node and the auxiliary node at the same time, and when the auxiliary node is unhealthy, the proxy node blocks the flow and informs operation and maintenance personnel of the intervention treatment. When the main node is unhealthy, a healthy auxiliary node is selected as a new main node, the traffic of the old main node is blocked, other nodes modify the synchronization target and synchronize from the new main node, and accordingly high availability is achieved.
The data read-write method according to the embodiments of the present disclosure will be described in detail below with reference to fig. 3 to 5 based on the application scenario described in fig. 1 and the system architecture shown in fig. 2.
Fig. 3 schematically illustrates a flowchart of a data read-write method according to an embodiment of the present disclosure. As shown in fig. 3, the data read-write method of this embodiment includes operations S210 to S250, which may be performed by a server or other computing device.
In response to an access request initiated by a client, a request type of the access request is determined by the proxy node server in operation S210.
In operation S220, a target server is determined according to the request type of the access request.
The access request is forwarded to the target server in operation S230.
In one example, the data read-write method provided by the embodiment of the disclosure, the shared file system includes a proxy node server, a main node server and a plurality of auxiliary node servers, the main node server is used for processing a file write request, and the auxiliary node server is used for processing a file read request. When an ftp request initiated by a client is received to request access to a file system, intercepting the request by a proxy node server, determining the request type of the access request, wherein the request type of the access request comprises a file reading request and a file writing request, determining a target server to be forwarded according to the request type of the access request, forwarding the request to the target server, and realizing reading and writing of shared file data.
In one example, since in actual production, the read flow is generally greater than the write flow, i.e. the file read request is far greater than the file write request, the number of auxiliary node servers is multiple, and the number of main node servers is fixed as one, so that array errors caused by concurrent writing are prevented. In order to ensure the consistency of the shared file system data, the auxiliary node server periodically initiates a data synchronization request to the main node server to synchronize the shared file data.
In operation S240, the health status of the shared file system server is monitored periodically.
In operation S250, if it is determined that the primary node server fails, one of the secondary node servers is randomly selected as a new primary node server.
In one example, in order to improve availability of the shared document system, a disaster recovery mechanism is set, a proxy node server monitors health status of the shared file system server periodically, and if it is determined that the primary node server is down, an auxiliary node server is randomly selected as a new primary node server, and file writing service is continuously provided to the outside.
The data read-write method provided by the embodiment of the disclosure is applied to a shared file system, wherein the shared file system comprises a proxy node server, a main node server and a plurality of auxiliary node servers, shared file system software is deployed in the servers, shared file storage service is provided for the outside, the main node server provides file write service, the auxiliary node server provides file read service, and the proxy node server determines the request type of an access request in response to the access request initiated by a client; determining a target server according to the request type of the access request; forwarding the access request to a target server; the health status of the shared file system server is monitored regularly; if the main node server is determined to be faulty, one auxiliary node server is randomly selected as a new main node server, and the availability of the shared file system is improved.
Fig. 4 schematically illustrates a flowchart of a data read-write method provided according to another embodiment of the present disclosure.
As shown in fig. 4, operations S310 to S340 are included.
In operation S310, if it is determined that the request type of the access request is a file read request, it is determined that the target server is an affiliated node server.
In operation S320, if it is determined that the request type of the access request is a file write request, it is determined that the target server is a master node server.
In operation S330, target server address information is determined from the server information table.
And in operation S340, forwarding the access request according to the address information of the target server.
According to an embodiment of the disclosure, the master node server is configured to process a file write request, the auxiliary node server is configured to process a file read request, and the auxiliary node server performs data synchronization from the master node server at regular time.
In one example, the proxy node server maintains a server information table including information such as server name, IP address, port, and server health status, and if it is determined that the request type of the access request is a file reading request and it is determined that the target server is an affiliated node server, a server with good health status is randomly selected in the server information table as the target server, and the access request is forwarded to the target server; if the request type of the access request is determined to be a file writing request, determining that a target server is a master node server, determining master node server address information according to the server information table, and forwarding the access request according to the target server address information.
Fig. 5 schematically illustrates a flowchart of a data read-write method provided according to a further embodiment of the present disclosure. Including operations S410-S470.
The interfaces provided by the primary node server and the secondary node server are periodically invoked in operation S410.
In operation S420, health states of the primary node server and the auxiliary node server are determined according to parameters returned from the interface.
In operation S430, if it is determined that the primary node server fails, one of the secondary node servers is randomly selected as a new primary node server.
In operation S440, the synchronization target of the affiliated node server is updated.
In operation S450, data synchronization from the new master node server is timed.
In operation S460, if it is determined that the auxiliary node server fails, the flow of the auxiliary node server is blocked and an alarm message is sent to the operation and maintenance personnel.
In operation S470, after determining that any server of the shared file system fails, a server information table in the proxy node server is updated.
In one example, to facilitate monitoring of the primary node and the secondary node, the primary node server and the secondary node server expose interfaces to the outside for querying the current health status of the server, and the health status of the primary node server or the secondary node server can be determined according to the interface return parameters. If the main node server is determined to be faulty, randomly selecting an auxiliary node server with good health state as a new main node server, and updating the synchronization targets of other auxiliary node servers to synchronize from the new main node.
In one example, if it is determined that the auxiliary node server fails, traffic to the auxiliary node server is blocked and alert information is sent to an operation and maintenance person.
In one example, after determining that any server of the shared file system fails, server correspondence state information in a server information table in the proxy node server is updated.
Based on the data reading and writing method, the disclosure also provides a data reading and writing device. The device will be described in detail below in connection with fig. 6.
Fig. 6 schematically shows a block diagram of a data read-write apparatus according to an embodiment of the present disclosure. As shown in fig. 6, the data read-write apparatus 700 of this embodiment includes a first determining module 710, a second determining module 720, a forwarding module 730, a monitoring module 740, and a node switching module 750.
The first determining module 710 is configured to determine, by the proxy node server, a request type of an access request initiated by a client, in response to the access request. In an embodiment, the first determining module 710 may be configured to perform the operation S210 described above, which is not described herein.
The second determining module 720 is configured to determine a target server according to a request type of the access request. In an embodiment, the second determining module 720 may be configured to perform the operation S220 described above, which is not described herein.
The forwarding module 730 is configured to forward the access request to a target server. In an embodiment, the forwarding module 730 may be configured to perform the operation S230 described above, which is not described herein.
The monitoring module 740 is configured to monitor the health status of the shared file system server periodically. In an embodiment, the monitoring module 740 may be configured to perform the operation S240 described above, which is not described herein.
The node switch module 750 is configured to randomly select an auxiliary node server as a new main node server if it is determined that the main node server fails. In an embodiment, the node switching module 750 may be configured to perform the operation S250 described above, which is not described herein.
According to an embodiment of the disclosure, the second determining module includes: a first determination sub-module and a second determination sub-module.
And the first determining submodule is used for determining that the target server is an affiliated node server if the request type of the access request is determined to be a file reading request. In an embodiment, the first determining sub-module may be used to perform the operation S310 described above, which is not described herein.
And the second determining submodule is used for determining that the target server is a main node server if the request type of the access request is determined to be a file writing request. In an embodiment, the second determining sub-module may be used to perform the operation S320 described above, which is not described herein.
According to an embodiment of the present disclosure, the forwarding module includes: a third determination sub-module and a forwarding sub-module.
And the third determining submodule is used for determining the address information of the target server according to the server information table. In an embodiment, the third determining sub-module may be used to perform the operation S330 described above, which is not described herein.
And the forwarding sub-module is used for forwarding the access request according to the address information of the target server. In an embodiment, the forwarding sub-module may be used to perform the operation S340 described above, which is not described herein.
According to an embodiment of the present disclosure, the monitoring module includes: the interface invokes the sub-module and the fourth determination sub-module.
And the interface calling sub-module is used for regularly calling interfaces provided by the main node server and the auxiliary node server. In an embodiment, the interface calling sub-module may be used to perform the operation S410 described above, which is not described herein.
And the fourth determination submodule is used for determining the health states of the main node server and the auxiliary node server according to the parameters returned by the interface. In an embodiment, the fourth determining sub-module may be used to perform the operation S420 described above, which is not described herein.
According to an embodiment of the present disclosure, the apparatus further comprises: an alarm module and a data synchronization module.
And the alarm module is used for blocking the flow of the auxiliary node server and sending alarm information to operation and maintenance personnel if the auxiliary node server is determined to be faulty. In an embodiment, the alarm module may be used to perform the operation S460 described above, which is not described herein.
The data synchronization module is used for updating the synchronization target of the auxiliary node server; data is synchronized from the new master node server at regular time. In an embodiment, the data synchronization module may be configured to perform the operations S440 and S450 described above, which are not described herein.
According to an embodiment of the present disclosure, any of the first determining module 710, the second determining module 720, the forwarding module 730, the monitoring module 740, and the node switching module 750 may be combined in one module to be implemented, or any of the modules may be split into a plurality of modules. Or at least some of the functionality of one or more of the modules may be combined with, and implemented in, at least some of the functionality of other modules. According to embodiments of the present disclosure, at least one of the first determination module 710, the second determination module 720, the forwarding module 730, the monitoring module 740, and the node switch module 750 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable way of integrating or packaging the circuitry, or in any one of or a suitable combination of any of the three implementations of software, hardware, and firmware. Or at least one of the first determination module 710, the second determination module 720, the forwarding module 730, the monitoring module 740 and the node switch module 750 may be at least partially implemented as computer program modules which, when run, may perform the respective functions.
Fig. 7 schematically illustrates a block diagram of an electronic device adapted to implement a data read-write method according to an embodiment of the disclosure.
As shown in fig. 7, an electronic device 900 according to an embodiment of the present disclosure includes a processor 901 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 902 or a program loaded from a storage portion 908 into a Random Access Memory (RAM) 903. The processor 901 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. Processor 901 may also include on-board memory for caching purposes. Processor 901 may include a single processing unit or multiple processing units for performing the different actions of the method flows according to embodiments of the present disclosure.
In the RAM 903, various programs and data necessary for the operation of the electronic device 900 are stored. The processor 901, the ROM 902, and the RAM 903 are connected to each other by a bus 904. The processor 901 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 902 and/or the RAM 903. Note that the program may be stored in one or more memories other than the ROM 902 and the RAM 903. The processor 901 may also perform various operations of the method flow according to embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the disclosure, the electronic device 900 may also include an input/output (I/O) interface 905, the input/output (I/O) interface 905 also being connected to the bus 904. The electronic device 900 may also include one or more of the following components connected to the I/O interface 905: an input section 906 including a keyboard, a mouse, and the like; an output portion 907 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage portion 908 including a hard disk or the like; and a communication section 909 including a network interface card such as a LAN card, a modem, or the like. The communication section 909 performs communication processing via a network such as the internet. The drive 909 is also connected to the I/O interface 905 as needed. A removable medium 911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on the drive 909, so that a computer program read therefrom is installed into the storage section 908 as needed.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs that, when executed, implement a data read-write method according to an embodiment of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 902 and/or RAM 903 and/or one or more memories other than ROM 902 and RAM 903 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowcharts. The program code, when executed in a computer system, causes the computer system to implement the data read-write method provided by embodiments of the present disclosure.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 901. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed, and downloaded and installed in the form of a signal on a network medium, via communication portion 909, and/or installed from removable medium 911. The computer program may include program code that may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from the network via the communication portion 909 and/or installed from the removable medium 911. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 901. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be provided in a variety of combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. These examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (12)

1. A data read-write method, characterized in that it is applied to a shared file system, the shared file system including a proxy node server, a master node server, and a plurality of auxiliary node servers, the method comprising:
Determining, by the proxy node server, a request type of an access request in response to the access request initiated by the client;
determining a target server according to the request type of the access request;
forwarding the access request to a target server;
The health status of the shared file system server is monitored regularly; and
And if the main node server is determined to be faulty, randomly selecting an auxiliary node server as a new main node server.
2. The method of claim 1, wherein the determining a target server based on the request type of the access request comprises:
if the request type of the access request is determined to be a file reading request, determining that the target server is an affiliated node server; and
And if the request type of the access request is determined to be a file writing request, determining that the target server is a master node server.
3. The method of claim 2, wherein the proxy node server maintains a server information table, and wherein forwarding the access request to a target server comprises:
determining target server address information according to the server information table; and
And forwarding the access request according to the address information of the target server.
4. The method of claim 1, wherein the periodically monitoring the health of the shared file system server comprises:
periodically calling interfaces provided by the main node server and the auxiliary node server; and
And determining the health states of the main node server and the auxiliary node server according to the parameters returned by the interfaces.
5. The method according to claim 4, wherein the method further comprises:
If the auxiliary node server is determined to be faulty, blocking the flow of the auxiliary node server and sending alarm information to operation and maintenance personnel.
6. The method of claim 5, further comprising, after randomly selecting one of the secondary node servers as the new primary node server:
updating the synchronization target of the affiliated node server; and
Data is synchronized from the new master node server at regular time.
7. The method according to any one of claims 4 to 6, further comprising:
after determining that any server of the shared file system fails, a server information table in the proxy node server is updated.
8. The method of claim 7, wherein the master node server is configured to process file write requests and the auxiliary node server is configured to process file read requests, the auxiliary node server timing data synchronization from the master node server.
9. A data read-write apparatus applied to a shared file system including a proxy node server, a master node server, and a plurality of subordinate node servers, the apparatus comprising:
The first determining module is used for responding to an questioning request initiated by a client, and determining the request type of the access request by the proxy node server;
The second determining module is used for determining a target server according to the request type of the access request;
The forwarding module is used for forwarding the access request to a target server;
The monitoring module is used for regularly monitoring the health state of the shared file system server; and
And the node switching module is used for randomly selecting an auxiliary node server as a new main node server if the main node server is determined to be faulty.
10. An electronic device, comprising:
one or more processors;
Storage means for storing one or more computer programs,
Characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1-8.
11. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, realizes the steps of the method according to any one of claims 1-8.
12. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1-8.
CN202410224050.1A 2024-02-28 2024-02-28 Data read-write method, apparatus, device, storage medium, and program product Pending CN118101443A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410224050.1A CN118101443A (en) 2024-02-28 2024-02-28 Data read-write method, apparatus, device, storage medium, and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410224050.1A CN118101443A (en) 2024-02-28 2024-02-28 Data read-write method, apparatus, device, storage medium, and program product

Publications (1)

Publication Number Publication Date
CN118101443A true CN118101443A (en) 2024-05-28

Family

ID=91154359

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410224050.1A Pending CN118101443A (en) 2024-02-28 2024-02-28 Data read-write method, apparatus, device, storage medium, and program product

Country Status (1)

Country Link
CN (1) CN118101443A (en)

Similar Documents

Publication Publication Date Title
US10078563B2 (en) Preventing split-brain scenario in a high-availability cluster
CN110750393B (en) Method, device, medium and equipment for avoiding network service double-machine hot standby brain cracking
US20100332532A1 (en) Distributed directory environment using clustered ldap servers
US11397632B2 (en) Safely recovering workloads within a finite timeframe from unhealthy cluster nodes
CN111510480A (en) Request sending method and device and first server
CN114760233A (en) Service processing method and device, electronic equipment and storage medium
CN117435569A (en) Dynamic capacity expansion method, device, equipment, medium and program product for cache system
US20230283695A1 (en) Communication Protocol for Knative Eventing's Kafka components
US11381665B2 (en) Tracking client sessions in publish and subscribe systems using a shared repository
CN115834668B (en) Cluster node control method, device, equipment, storage medium and program product
CN109445966B (en) Event processing method, device, medium and computing equipment
US11595471B1 (en) Method and system for electing a master in a cloud based distributed system using a serverless framework
CN116599855A (en) Data transmission method, system, electronic equipment and storage medium
CN118101443A (en) Data read-write method, apparatus, device, storage medium, and program product
CN113296911B (en) Cluster calling method, cluster calling device, electronic equipment and readable storage medium
US11537440B2 (en) Infrastructure adaptive consistency level mechanism
US20220342726A1 (en) Coordinating and processing events across multiple system managers
CN114968636A (en) Fault processing method and device
CN109831385B (en) Message processing method and device and electronic equipment
US10708343B2 (en) Data repository for a distributed processing environment
CN112463514A (en) Monitoring method and device for distributed cache cluster
CN113282391B (en) Cluster switching method, cluster switching device, electronic equipment and readable storage medium
CN111698454B (en) Inter-domain resource pushing method and device for dynamically selecting optimal path
CN114844957B (en) Link message conversion method, device, equipment, storage medium and program product
CN112749042B (en) Application running method and device

Legal Events

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