CN110618976B - Method and device for accessing file, electronic equipment and storage medium - Google Patents

Method and device for accessing file, electronic equipment and storage medium Download PDF

Info

Publication number
CN110618976B
CN110618976B CN201910857637.5A CN201910857637A CN110618976B CN 110618976 B CN110618976 B CN 110618976B CN 201910857637 A CN201910857637 A CN 201910857637A CN 110618976 B CN110618976 B CN 110618976B
Authority
CN
China
Prior art keywords
client
mds
capability information
reconnection
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910857637.5A
Other languages
Chinese (zh)
Other versions
CN110618976A (en
Inventor
陈二奇
申航
高宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN201910857637.5A priority Critical patent/CN110618976B/en
Publication of CN110618976A publication Critical patent/CN110618976A/en
Application granted granted Critical
Publication of CN110618976B publication Critical patent/CN110618976B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems

Landscapes

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

Abstract

The disclosure relates to a method and a device for accessing files, electronic equipment and a storage medium, relating to the technical field of distributed storage and aiming at solving the problem that the time consumed in the MDS starting process results in longer waiting time when a client needs to access the files, wherein the method comprises the following steps: after a reconnect stage in the starting process of a first MDS in the MDS set receives a first reconnect request of the client, replying a reconnect rejection message to the client; after the first MDS is successfully started, if a second reconnection request sent when a client needs to access a target file is received, connection is established with the client, and first capacity information for the client to access the target file is determined; and returning the first capability information to the client so that the client accesses the target file according to the first capability information. Because the method and the system refuse to reconnect with the client in the starting process, the starting of the MDS is accelerated, and the waiting time of the client is reduced.

Description

Method and device for accessing file, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of distributed storage technologies, and in particular, to a method and an apparatus for accessing a file, an electronic device, and a storage medium.
Background
Today, with more and more importance being placed on team cooperation and resource sharing, the convenience of team cooperation brought by the network shared file storage system due to its file sharing function has become a strong demand that is not negligible. However, the shared file system needs to consider the consistency of the cache data among multiple clients, and additionally, multiple clients have multiple varieties, which causes more problems. The Ceph fs (Ceph File System, distributed network File System) is a popular open-source distributed File System scheme in the industry at present, and has some problems in addition to solving most of the application and business requirements.
An MDS (Metadata Server) is used to provide CephFS Metadata services, such as file query, creation, deletion, etc., but the MDS startup process takes time, so that a client needs to wait for a long time to access a file.
In summary, the MDS startup process takes time, resulting in a long waiting time when the client needs to access the file.
Disclosure of Invention
The present disclosure provides a method, an apparatus, an electronic device, and a storage medium for accessing a file, so as to at least solve the problem in the related art that a MDS start-up process consumes time, which results in a long waiting time when a client needs to access a file. The technical scheme of the disclosure is as follows:
According to a first aspect of the embodiments of the present disclosure, there is provided a method for accessing a file, which is applied to an MDS, and includes:
after a reconnect stage in a starting process of a first MDS in an MDS set receives a first reconnect request of a client, replying a reconnect rejection message to the client, wherein the first reconnect request is sent by the client after the client is disconnected with a second MDS in the MDS set;
after the first MDS is successfully started, if a second reconnection request of the client is received, establishing connection with the client, and determining first capability information of the client for accessing a target file, wherein the second reconnection request is sent to the first MDS when the client needs to access the target file, and the first capability information is used for representing the capability of the client for accessing the target file;
and returning the first capability information to the client so that the client accesses the target file according to the first capability information.
In an optional embodiment, the step of determining the first capability information of the client for accessing the target file includes:
Determining a target file to be accessed by the client according to the file identifier in the second reconnection request;
reading metadata information of the target file;
and combining the metadata information and the access operation information in the second reconnection request to generate the first capability information.
In an optional implementation manner, after the receiving of the second reconnection request step by the client, the method further includes:
extracting second capability information of the client from the second reconnection request;
recording the second capability information into a capability information set of a file corresponding to the second capability information;
after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients;
if the access operation information is write operation and second capability information corresponding to the access operation information is searched for in the capability information set, determining a client having the searched second capability information, and recovering the determined second capability information of the client.
In an optional implementation manner, after the step of determining the first capability information that the client accesses to the target file, the method further includes:
Recording the first capability information into a capability information set of the target file;
after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients;
if the access operation information is write operation and the first capability information corresponding to the access operation information is found in the capability information set, determining a client having the found first capability information, and recovering the determined first capability information of the client.
In an optional implementation manner, before the step of receiving, by the client, the first reconnection request in the connection phase during the startup of the first MDS in the MDS set, the method further includes:
receiving a start command, wherein the start command is triggered by the CephFS after detecting that the second MDS serving the client fails.
According to a second aspect of the embodiments of the present disclosure, there is provided a method for accessing a file, which is applied to a client, and includes:
after the connection with a second MDS in the MDS set is interrupted, sending a first reconnection request to the MDS in the MDS set, and after receiving a reconnection rejection message returned by a first MDS in the MDS set, closing the session connection which is being started, wherein the reconnection rejection message is sent by the first MDS after receiving the first reconnection request at a recannect stage in the starting process of the first MDS in the MDS set;
Sending a second reconnect request to the first MDS when the target file needs to be accessed, wherein the second reconnect request is sent by the client to the first MDS when the target file needs to be accessed;
and accessing the target file according to the received first capability information of the target file sent by the first MDS, wherein the first capability information is used for representing the capability of the client to access the target file.
In an optional implementation manner, after the step of closing the initiated session connection and before the step of sending a second reconnection request to the first MDS when the target file needs to be accessed, the method further includes:
and deleting the second capability information of the client.
In an optional implementation manner, before the step of sending the second reconnection request to the first MDS when the target file needs to be accessed, the method further includes:
and placing the second capability information of the client in the second reconnection request and sending the second capability information to the first MDS, so that the first MDS records the second capability information in the received second reconnection request to a capability information set of a file corresponding to the second capability information.
According to a third aspect of the embodiments of the present disclosure, there is provided an apparatus for accessing a file, which is applied to an MDS, including:
the client side comprises a first processing unit and a second processing unit, wherein the first processing unit is configured to reply a reconnection rejection message to the client side after a reconnection request of the client side is received at a connection stage in a starting process of a first MDS in an MDS set, and the first reconnection request is sent by the client side after connection with a second MDS in the MDS set is interrupted;
a determining unit, configured to execute, after the first MDS is successfully started, if a second reconnection request of the client is received, establishing connection with the client, and determining first capability information for the client to access to a target file, where the second reconnection request is sent to the first MDS when the client needs to access the target file, and the first capability information is used to indicate a capability of the client to access to the target file;
and the second processing unit is configured to return the first capability information to the client so that the client accesses the target file according to the first capability information.
In an optional implementation, the determining unit is specifically configured to perform:
Determining a target file to be accessed by the client according to the file identifier in the second reconnection request;
reading metadata information of the target file;
and combining the metadata information and the access operation information in the second reconnection request to generate the first capability information.
In an optional embodiment, the determining unit is further configured to perform:
after receiving a second reconnection request of the client, extracting second capability information of the client from the second reconnection request;
recording the second capability information into a capability information set of a file corresponding to the second capability information;
after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients;
if the access operation information is write operation and second capability information corresponding to the access operation information is searched for in the capability information set, determining a client having the searched second capability information, and recovering the determined second capability information of the client.
In an optional embodiment, the determining unit is further configured to perform:
After determining first capability information for the client to access a target file, recording the first capability information into a capability information set of the target file;
after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients;
if the access operation information is write operation and the first capability information corresponding to the access operation information is found in the capability information set, determining a client having the found first capability information, and recovering the determined first capability information of the client.
In an optional embodiment, the first processing unit is further configured to perform:
before a reconnect stage in a first MDS starting process in an MDS set receives a first reconnection request of a client, a starting command is received, wherein the starting command is triggered after a CephFS detects that a second MDS serving the client fails.
According to a fourth aspect of the embodiments of the present disclosure, there is provided an apparatus for accessing a file, which is applied to a client, and includes:
the third processing unit is configured to execute sending a first reconnection request to the MDSs in the MDS set after the second MDS in the MDS set is disconnected, and closing the started session connection after receiving a reconnection rejection message returned by the first MDS in the MDS set, wherein the reconnection rejection message is sent by the first MDS after receiving the first reconnection request at a recannect stage in a starting process;
A fourth processing unit, configured to perform sending a second reconnect request to the first MDS when the target file needs to be accessed, where the second reconnect request is sent by the client to the first MDS when the target file needs to be accessed;
and the accessing unit is configured to execute accessing the target file according to the received first capability information of the target file sent by the first MDS, where the first capability information is used for indicating the capability of the client to access the target file.
In an optional embodiment, the third processing unit is further configured to perform:
and after closing the session connection being started, deleting the second capability information of the client before sending a second reconnection request to the first MDS when the target file needs to be accessed.
In an optional embodiment, the third processing unit is further configured to perform:
and before sending a second reconnection request to the first MDS when a target file needs to be accessed, placing second capability information of the client in the second reconnection request and sending the second capability information to the first MDS, so that the first MDS records the second capability information in the received second reconnection request to a capability information set of a file corresponding to the second capability information.
According to a fifth aspect of an embodiment of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method for accessing a file according to any one of the first aspect of the embodiments of the present disclosure.
According to a sixth aspect of embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method for accessing files according to any one of the second aspect of the embodiments of the present disclosure.
According to a seventh aspect of the embodiments of the present disclosure, there is provided a non-volatile readable storage medium, where instructions, when executed by a processor of an electronic device, enable the electronic device to perform the method for accessing a file according to any one of the first aspect of the embodiments of the present disclosure.
According to an eighth aspect of the embodiments of the present disclosure, there is provided a non-volatile readable storage medium, wherein when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method for accessing a file according to any one of the second aspect of the embodiments of the present disclosure.
According to a ninth aspect of the embodiments of the present disclosure, there is provided a computer program product, which, when run on an electronic device, causes the electronic device to perform a method that implements any one of the above first aspect and the first aspect of the embodiments of the present disclosure.
According to a tenth aspect of embodiments of the present disclosure, there is provided a computer program product, which, when run on an electronic device, causes the electronic device to perform a method that implements any of the above-mentioned second aspect and second aspect of embodiments of the present disclosure.
According to an eleventh aspect of embodiments of the present disclosure, there is provided a system for accessing a file, including: the first MDS and the client:
the first MDS is used for replying a reconnection rejection message to the client after a reconnection stage in a starting process of the first MDS in the MDS set receives a first reconnection request of the client; after the first MDS is successfully started, if a second reconnection request of the client is received, connection is established with the client, and first capacity information for the client to access a target file is determined; and returning the first capability information to the client.
The client is used for sending a first reconnection request to the MDS in the MDS set after the connection with the second MDS in the MDS set is interrupted, and closing the started session connection after receiving a reconnection rejection message returned by the first MDS in the MDS set; sending a second reconnection request to the first MDS when a target file needs to be accessed; and accessing the target file according to the received first capability information of the target file sent by the first MDS.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
because the embodiment of the disclosure improves the starting process of the MDS, after the connection between the second MDS in the MDS set and the client is interrupted, the client sends the first reconnection request to the MDS in the MDS set, the first reconnection request sent by the client can be received at the reconnection stage in the starting process of the first MDS, and the client sending the first reconnection request replies a rejection to the client, and the reconnection process with the client is not executed in the starting process, so that the first MDS does not need to spend a large amount of time to construct client capability information cap(s), capability, or load metadata information inode (index node) corresponding to the cap(s) into the memory, and the first MDS can be quickly started. When the client needs to read and write the file, the session is reestablished with the first MDS, the first MDS determines corresponding first capacity information and sends the first capacity information to the client, and the client accesses the target file according to the first capacity information, so that loading on demand is realized, and the starting time of the MDS is reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
Figure 1 is a schematic diagram of a MDS startup flow, according to an exemplary embodiment;
FIG. 2 is a block diagram illustrating a system for accessing files in accordance with an exemplary embodiment;
figure 3 is a schematic diagram illustrating a master slave MDS switch in accordance with an exemplary embodiment;
FIG. 4 is a flowchart illustrating a method of accessing a file in accordance with an exemplary embodiment;
FIG. 5 is a flowchart illustrating another method of accessing a file in accordance with an exemplary embodiment;
FIG. 6 is a timing diagram illustrating a complete method of accessing a file in accordance with an exemplary embodiment;
FIG. 7 is a block diagram illustrating a first apparatus for accessing files in accordance with an illustrative embodiment;
FIG. 8 is a block diagram illustrating a first type of electronic device in accordance with an exemplary embodiment;
FIG. 9 is a block diagram illustrating a second apparatus for accessing files in accordance with an exemplary embodiment;
FIG. 10 is a block diagram illustrating a second type of electronic device in accordance with an exemplary embodiment;
fig. 11 is a block diagram illustrating a terminal according to an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the following exemplary embodiments do not represent implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Some of the words that appear in the text are explained below:
1. the term "and/or" in the embodiments of the present disclosure describes an association relationship of associated objects, and indicates that three relationships may exist, for example, a and/or B, and may indicate: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
2. The term "electronic equipment" in the embodiments of the present disclosure refers to equipment that is composed of electronic components such as integrated circuits, transistors, and electronic tubes, and functions by applying electronic technology (including) software, and includes electronic computers, robots controlled by the electronic computers, numerical control or program control systems, and the like.
3. The term "Metadata" (also called intermediary data, relay data) in the embodiments of the present disclosure is data describing data (data about data), which is mainly information describing data property (property), and is used to support functions such as indicating storage location, history data, resource lookup, file record, and the like. Metadata is an electronic catalog, and in order to achieve the purpose of creating a catalog, the contents or features of data must be described and collected, so as to achieve the purpose of assisting data retrieval. In the disclosed embodiment, the CephFS consists of two parts, data and metadata. Metadata, i.e., directories and files. Data is the data and content in a file. Whether data or metadata, is finally stored as an object file at the bottom level.
4. The term "terminal" in the embodiments of the present disclosure refers to a mobile communication device, such as a mobile phone, a tablet, a computer, a personal digital assistant, and the like.
The application scenario described in the embodiment of the present disclosure is for more clearly illustrating the technical solution of the embodiment of the present disclosure, and does not form a limitation on the technical solution provided in the embodiment of the present disclosure, and as a person having ordinary skill in the art knows, with the occurrence of a new application scenario, the technical solution provided in the embodiment of the present disclosure is also applicable to similar technical problems. Wherein, in the description of the present disclosure, the meaning of "a plurality" is unless otherwise indicated.
With the rise of emerging services such as cloud computing, internet of things and social networks, the data types and data scales are increasing at an unprecedented speed, and the big data era comes formally. The scale effect of large data presents a significant challenge to data storage.
The POSIX (Portable Operating System Interface of UNIX) defines a set of standards, such as open, close, read and other functions provided by the linux Operating System itself. The CephFS is a distributed network file system compatible with the POSIX standard, different clients can share access files, and most application and service requirements are met.
The MDS is used for providing CephFS metadata services, such as file query, creation, deletion and the like. The MDS of the conventional CephFS is redundant, a plurality of MDSs exist at the same time, one MDS is a main MDS and is in an active state, the main MDS provides metadata service for a client, and the other MDS or MDSs are slave MDSs and are in a standby state.
At each boot of the MDS, several stages are needed as shown in FIG. 1, from the replay stage in FIG. 1, back until active starts providing work. Interaction is needed to be carried out with the client terminal in the reconnection stage, cap(s) information needed by the client terminal is obtained, rejoining of the client terminal is waited in the rejoining stage, and cap(s) listed in the reconnection stage and related inode and dent (directory entry) information are loaded into the memory.
The client side cap is a capability, for example, the client side A reads a file a.txt of the CephFS, the client side A can read metadata information of the file into a memory and records that the client side A has the capability of accessing the metadata of the a.txt, the client side A can directly acquire the metadata information from the memory without accessing the MDS through a network next time when operating the a.txt, if the other client side B needs to update the a.txt, the MDS sends a request to the client side A to recycle the capability of the client side A to the a.txt and distributes the capability to the client side B, the capability of writing the file can be granted to only one client side, and the capability of reading the shared file can be granted to both the client sides A and B.
And after the master MDS fails, one slave MDS needs to be switched to an active state to provide service for the client, and in this case, the slave MDS switched to the active state becomes a new master MDS.
During the slave MDS startup, it is necessary to synchronize the cap(s) owned by all clients before the MDS starts. However, since CephFS needs to receive the client's recannect information in the recannect phase, record the cap(s) and inode information contained therein, and reconstruct the information in the memory in the rejoin phase. Since acquiring client caps(s) requires interaction with each client, and then processing data related to the caps(s), if there are one thousand clients, each client has one thousand caps, the processing is long. So with billions of files, the process would be quite lengthy, perhaps taking about 20 minutes.
Therefore, the embodiment of the disclosure provides a method, a device, an electronic device and a storage medium for accessing a file, which improve the starting process of an MDS, wherein a reconnect message sent to a client is rejected in reply at a reconnect stage in the starting process of the MDS, and cap(s) and corresponding metadata information of the client are not loaded any more in the starting process of the MDS, so that the starting of the MDS is accelerated.
FIG. 2 is a block diagram illustrating a system for accessing files, according to an example embodiment, including: first MDS 10 and client 20:
the first MDS 10 is configured to reply a reconnection rejection message to the client 20 after receiving the first reconnection request of the client 20 at a reconnection stage in a starting process of the first MDS in the MDS set; after the first MDS is successfully started, if a second reconnection request of the client 20 is received, establishing connection with the client 20, and determining first capability information for the client 20 to access a target file; and returning the first capability information to the client 20.
The client 20 is configured to send a first reconnection request to a second MDS in the MDS set after the connection with the second MDS in the MDS set is interrupted, and close the session connection being started after receiving a reconnection rejection message returned by the first MDS 10 in the MDS set; sending a second reconnect request to the first MDS 10 when a target file needs to be accessed; and accessing the target file according to the received first capability information of the target file sent by the first MDS 10.
Through the scheme, the starting process of the MDS is improved, after the connection between the second MDS in the MDS set and the client is interrupted, the client sends the first reconnection request to the MDS in the MDS set, the first reconnection request sent by the client can be received at the reconnection stage in the starting process of the first MDS, the client sending the first reconnection request replies rejection to the client sending the first reconnection request, and the reconnection process with the client is not executed in the starting process, so that the first MDS does not need to spend a large amount of time to construct client capability information cap(s), capability and loading metadata information inode (index node) corresponding to the cap(s) into a memory, and the first MDS can be quickly started. When the client needs to read and write the file, the session is reestablished with the first MDS, the first MDS determines corresponding first capacity information and sends the first capacity information to the client, and the client accesses the target file according to the first capacity information, so that loading on demand is realized, and the starting time of the MDS is reduced.
In this embodiment of the present disclosure, assuming that a second MDS in the MDS set is in an active state and is providing metadata service for the client, and the other MDSs are in a standby state, after the second MDS fails, the connection between the client and the second MDS is disconnected, and the second MDS is detected by the CephFS after the second MDS fails, so that the CephFS sends a start command to any one of the MDSs in the MDS set other than the second MDS, and assuming that a start command is sent to the first MDS in the MDS set, the first MDS starts to start after receiving the start command.
After the client disconnects from the second MDS, the client continuously attempts to reconnect by polling the available MDSs, for example, every 5 seconds.
When the second MDS is switched with the first MDS, the two MDSs are unavailable, when the first MDS is started to a reconnection state, the first MDS which is newly started can receive a reconnection request sent by the client through polling only in the reconnection state, and at the moment, the first MDS refuses reconnection with the client by replying a reconnection refusing message to the client.
For example, there are 4 MDSs in the MDS set, which are MDS1, MDS2, MDS3, MDS4, the previous MDS serving metadata for the client is MDS1, that is, the previous master MDS is MDS1, the slave MDS has MDS2, MDS3, MDS4, wherein MDS1 is in an active stage, and the remaining 3 MDSs are in a standby stage.
When the MDS1 fails, the MDS is detected by the CephFS, then the CephFS sends a start command to the MDS of the standby, and the MDS of the standby switches to an active state after receiving the start command. For example, the CephFS sends a start command to the MDS2, and the MDS2 starts starting upon receiving the start command.
Assuming that the client 1 polls 4 MDSs in the set of MDSs, and sends a first reconnect request for requesting reconnection every 5 seconds, when the MDS2 starts to the disconnect phase, the first reconnect request sent by the client 1 can be received, and thus the MDS2 replies a reconnection rejection message to the client 1.
It should be noted that, in the foregoing embodiment, only the client 1 is taken as an example for detailed description, and actually, if there are multiple clients, the same reason is also true, as shown in fig. 3, there are 4 clients that have previously established a connection with the MDS1 in fig. 3, and when the MDS1 fails, the MDS2 immediately replaces the MDS1 to ensure high availability of the cluster, in which case all the 4 clients perform polling, and the MDS2 replies a reconnection rejection message to the 4 clients in a reconnect phase, which is the same as an execution process of the client 1, and the following mainly takes the client 1 as an example for detailed description.
In the embodiment of the present disclosure, after receiving the reconnection rejection message, the client closes the session connection being started, and does not poll the MDSs in the set any more. Wherein, the session connection being started refers to the session that the client sends the first reconnection request to attempt to connect with the first MDS.
In an optional implementation manner, after closing the session connection being started, the client deletes the second capability information in its memory. Wherein the second capability information refers to cap(s) that the client currently owns.
For example, client 1 currently has read capability for 1000 files, assuming that the 1000 files are: file 1 to file 1000), then client 1 has 1000 caps, and these 1000 caps can represent second capability information of client 1, including: cap1, cap2, cap3, cap4, …, cap1000, so client 1 deletes these 1000 caps from memory after session connection.
In addition, because the client cannot be reconnected, for example, the client reconnects with the MDS after the network is flashed, in this case, the client does not need to delete the second capability information, and the client needs to receive a reconnection rejection message of the MDS before deleting the second capability information.
According to the method, when the caps clients do not need any more, for example, the clients do not access some files any more, a mode of deleting the second capability information can be adopted, and meanwhile after the caps are deleted, the inode metadata in the memory of the clients can be released, so that when the files corresponding to the caps owned before are accessed again, connection with the first MDS needs to be established again.
In an optional implementation manner, the client may also send the second capability information to the first MDS without deleting the second capability information in its memory, and the first MDS loads the second capability information and the metadata information corresponding to the second capability information into the memory after receiving the second capability information sent by the client.
The method realizes that the client sends the cap(s) of the client to the MDS when needed, realizes loading according to needs, reduces the starting time of the MDS, and is mainly applied to the condition that the client can still continuously access the file corresponding to the second capability information which is owned currently.
Among them, there are many ways for the client to send the second capability information to the first MDS, including two ways:
in the first mode, after the client sends the second reconnection request to the first MDS and establishes reconnection, the client directly sends the second capability information to the first MDS.
And in the second mode, the client places the second capability information in the second reconnection request and sends the second capability information to the first MDS.
In the second embodiment, the first MDS needs to extract the second capability information of the client from the second reconnection request.
In an optional implementation manner, the first MDS records the received second capability information sent by the client into the capability information set of the file corresponding to the second capability information.
Specifically, the second capability information includes: taking cap1, cap2, cap3, cap4, …, and cap1000 as examples, recording cap1 in the capability information set corresponding to file 1, recording cap2 in the capability information combination corresponding to file 2, recording cap3 in the capability information set corresponding to file 3, and so on, and recording the 1000 caps in the capability information sets corresponding to files 1 to 1000, respectively, where, for a capability information set corresponding to any one file, it is used to count which clients have which access operation capabilities for the file.
For example, the capability information set of file 1 includes multiple caps, where cap1 indicates that client 1 has the capability of reading file 1, cap1001 indicates that client 2 has the capability of reading file 1, and cap2001 indicates that client 3 has the capability of writing file 1.
In an alternative embodiment, one capability information set may also correspond to multiple files, and second capability information of the multiple files is stored in 1 set, assuming that the capability information set a is used to record caps corresponding to files 1 to 5, and the capability information set B is used to record caps corresponding to files 6 to 10.
Assuming that there are 30 pieces of second capability information currently owned by the client 3, where the 30 caps correspond to the file 1, the file 2, and the file 3, and there are 40 pieces of second capability information currently owned by the client 4, where 10 caps among the 40 caps correspond to the file 5, and another 30 caps correspond to the file 6 and the file 7, then it is possible to record the 30 caps currently owned by the client 3 and the 10 caps currently owned by the client 4 corresponding to the file 5 into the capability information set a, and record the 30 caps currently owned by the client 4 corresponding to the file 6 and the file 7 into the capability information set B, and so on.
And the second reconnection request is sent to the first MDS by the client when the client needs to access the file and is used for reestablishing the session connection with the first MDS.
In the embodiment of the present disclosure, the client has cap(s), which means that metadata is cached in the memory of the client, and the client can complete the operation by directly using the metadata information in the local cache without sending a request to the MDS. When the client discards the cap(s) and then accesses the file or needs to access a new file, whether connection with the started first MDS exists is detected, if the connection does not exist, a second reconnection request needs to be sent to the first MDS, the first MDS reads metadata information of the file from the hard disk, the metadata information is loaded into the memory, the new cap(s) is generated and sent to the client, and then the client can use the metadata in the memory of the client when needing to operate the file next time. The metadata information is embodied in the memory as inode, dentry, and the like.
Specifically, the client sends a second reconnection request to the first MDS, and after receiving the second reconnection request sent by the client, the first MDS establishes a connection with the client. The second reconnection request carries a file identifier of a target file to be accessed and access operation information, wherein the access operation information is used for indicating what operation is executed on the file to be accessed by a client.
In the embodiment of the disclosure, after the connection between the first MDS and the client is established, the file identifier is extracted from the second reconnection request, the target file to be accessed by the client is determined according to the file identifier, the metadata information of the target file is read from the bottom layer, the first capability information of the client for accessing the target file is determined according to the read metadata information and the access operation information in the second reconnection request, the first capability information is sent to the client, and the target file is accessed according to the first capability information after the client receives the first capability information.
For example, client 1 needs to read file 1001: txt, the client 1 sends a second reconnection request to the MDS2, where the second reconnection request carries a file identifier of which file the client 1 is to operate, and access operation information of what operation the client 1 is to perform on the file, such as writing the file, and the second reconnection request carries the file identifier: txt, and access operation information: write _ op.
After receiving the second reconnection request, the MDS2 extracts the file identifier from the second reconnection request, and determines that the target file that the client 1 needs to access is the file 1001 according to the file identifier. Then, the MDS2 reads the metadata information of the file 1001 from the bottom layer, loads the read metadata information into the memory, and determines the first capability information according to the read metadata information and the access operation information in the second reconnection request.
In an optional embodiment, when the first capability information is determined according to the read metadata information and the access operation information in the second reconnection request, specifically:
and combining the metadata information and the access operation information in the second reconnection request to generate first capability information.
The metadata information and caps information are corresponding, and the caps information corresponding to one inode may be: the client can directly read and write the file by using the inode metadata in the memory of the client, the client can only use the inode metadata in the memory of the client under the condition of reading the file, the client can only use the inode metadata in the memory to acquire the file attribute and cannot read and write, and the like.
For example, if the first capability information constructed by the MDS2 is the cap1002, the MDS2 sends the cap1002 to the client 1, and the client 1 reads the file 1001 according to the cap 1002.
Specifically, when reading a file, a client knows a root directory locally mounted by the client, and obtains an operation file layer by layer through the root directory, for example, the client mounts the root directory/, and the client needs to operate/a/B/c.txt below the root directory, first reads the content of/, obtains the content of a, reads the content of a, obtains B, reads the content of B, obtains the position of c.txt, and then reads c.txt.
In an alternative embodiment, after the first MDS determines the first capability information for the client to access the target file, the first capability information needs to be recorded in the capability information set of the target file in addition to sending the first capability information to the client.
For example, MDS2 adds cap1002 to the capability information set of file 1001, where the capability information set of file 1001 is loaded with which clients all have the capability to read, write, etc. to file 1001, where writing may include modifying, deleting, etc. a file.
Alternatively, the first capability information is recorded in a capability information set corresponding to the client, for example, the cap1002 is recorded in a capability information set of the client 1, where the capability information set of the client 1 records which file pairs the client 1 has the capability of reading, writing, and the like.
It should be noted that, when another client needs to access a file, the cap(s) of the client that accessed the file may be recovered, for example, the client 2 needs to modify the file 1001, and the cap(s) of the file 1001 by the client 1 needs to be recovered before the client 2 updates the metadata of the file 1001, so that the cap(s) of the file 1001 by the client 1 is recovered before the client 2 needs to modify, and in this case, the client 1 needs to obtain the cap(s) again when accessing the file 1001 again.
Specifically, after the first MDS receives the second reconnection requests of other clients, in order to prevent the ability of granting write operations to multiple clients at the same time, the first MDS may obtain access operation information in the second reconnection requests of other clients; and when the acquired access operation information is write operation and the first capability information or the second capability information corresponding to the access operation information is found in the capability information set recorded by the first MDS, determining a client having the found first capability information or second capability information, and recovering the determined first capability information or second capability information of the client.
It should be noted that the second capability information and the first capability information are the same, and if the capability information conflicts (for example, two clients need to write the same file), one or some capabilities of one of the clients need to be recovered, and repeated parts are not described again.
Taking an example that one capability information set corresponds to one file, assuming that the MDS2 establishes reconnection with the client 1 and receives a second reconnection request of the client 5 after generating a cap for the client 1 to write the file 10, where access operation information included in the second reconnection request of the client 5 is a write operation and is a write operation for the file 10, and considering that the file 10 changes after the client 5 modifies the file 10, the cap owned by the client 1 to write the file 10 is outdated, so the cap for the client 1 to write the file 10 can be recovered first, specifically:
Searching a capability information set corresponding to the file 10, searching a cap which is owned by the client 1 and performs write operation on the file 10 in the set, recovering the cap, and generating the cap which performs write operation on the file 10 for the client 5 according to the metadata information of the file 10 and the access operation information contained in the second reconnection request of the client 5.
Taking an example that one capability information set corresponds to a plurality of files, assuming that the capability information set a corresponds to files 1 to 5 and the capability information set B corresponds to files 6 to 10, the capability information set B corresponding to the file 10 needs to be searched, if a cap for performing a write operation on the file 10 owned by the client 1 is found in the set, the cap is recovered, and a cap for performing a write operation on the file 10 is generated for the client 5 according to metadata information of the file 10 and access operation information included in a second reconnection request of the client 5.
It should be noted that, in the embodiment of the present disclosure, if a client owns certain caps, when accessing files corresponding to the caps again, the client may directly access the files by using the inode metadata in the memory of the client without requesting the first MDS again.
It should be noted that the methods recited in the embodiments of the present disclosure may be applied to MDS activation in other situations, for example, when the MDS is actively activated manually, in addition to the MDS activation after a failure.
FIG. 4 is a flowchart illustrating a method of accessing a file, as shown in FIG. 4, according to an example embodiment, including the following steps.
In step S400, after receiving a first reconnection request from a client at a reconnection stage in a starting process of a first MDS in an MDS set, replying a reconnection rejection message to the client, where the first reconnection request is sent by the client after a connection with a second MDS in the MDS set is interrupted;
in step S401, after the first MDS is successfully started, if a second reconnection request of the client is received, establishing a connection with the client, and determining first capability information of the client for accessing a target file, where the second reconnection request is sent to the first MDS when the client needs to access the target file, and the first capability information is used to indicate a capability of the client for accessing the target file;
In step S402, the first capability information is returned to the client, so that the client accesses the target file according to the first capability information.
In an optional implementation manner, the step of determining first capability information of the client for accessing the target file includes:
determining a target file to be accessed by the client according to the file identifier in the second reconnection request;
reading metadata information of the target file;
and combining the metadata information and the access operation information in the second reconnection request to generate the first capability information.
In an optional implementation manner, after the receiving of the second reconnection request step by the client, the method further includes:
extracting second capability information of the client from the second reconnection request;
recording the second capability information into a capability information set of a file corresponding to the second capability information;
after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients;
if the access operation information is write operation and second capability information corresponding to the access operation information is searched for in the capability information set, determining a client having the searched second capability information, and recovering the determined second capability information of the client.
In an optional implementation manner, after the step of determining the first capability information that the client accesses to the target file, the method further includes:
recording the first capability information into a capability information set of the target file;
after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients;
if the access operation information is write operation and the first capability information corresponding to the access operation information is found in the capability information set, determining a client having the found first capability information, and recovering the determined first capability information of the client.
In an optional implementation manner, before the step of receiving, by the client, the first reconnection request in the connection phase during the startup of the first MDS in the MDS set, the method further includes:
receiving a start command, wherein the start command is triggered by the CephFS after detecting that the second MDS serving the client fails.
FIG. 5 is a flowchart illustrating another method of accessing a file, according to an example embodiment, as shown in FIG. 5, including the following steps.
In step S500, after the connection with the second MDS in the MDS set is interrupted, sending a first reconnection request to the MDS in the MDS set, and after receiving a reconnection rejection message returned by the first MDS in the MDS set, closing the session connection being started, where the reconnection rejection message is sent by the first MDS after receiving the first reconnection request at a reconnection stage in the starting process;
in step S501, sending a second reconnect request to the first MDS when the target file needs to be accessed, where the second reconnect request is sent by the client to the first MDS when the target file needs to be accessed;
in step S502, the target file is accessed according to the received first capability information of the target file sent by the first MDS, where the first capability information is used to indicate a capability of the client to access the target file.
In an optional implementation manner, after the step of closing the initiated session connection and before the step of sending a second reconnection request to the first MDS when the target file needs to be accessed, the method further includes:
and deleting the second capability information of the client.
In an optional implementation manner, before the step of sending the second reconnection request to the first MDS when the target file needs to be accessed, the method further includes:
and placing the second capability information of the client in the second reconnection request and sending the second capability information to the first MDS, so that the first MDS records the second capability information in the received second reconnection request to a capability information set of a file corresponding to the second capability information.
Fig. 6 is a flowchart illustrating a complete method for accessing a file according to an exemplary embodiment, which specifically includes the following steps:
s600, the client is disconnected with a second MDS in the MDS set;
s601, the first MDS receives a starting command sent by the system and starts to start;
s602, the client sends a first reconnection request to the MDS in the MDS set;
s603, the first MDS receives a first reconnection request of the client at a recannect stage in the starting process;
s604, the first MDS replies a reconnection rejection message to the client;
s605, the client receives the reconnection rejection message of the MDS, closes the session connection which is started, and deletes the second capability information;
s606, successfully starting the first MDS;
s607, the client sends a second reconnection request to the first MDS;
S608, the first MDS receives a second reconnection request of the client, establishes connection with the client, and determines a target file to be accessed by the client according to a file identifier in the second reconnection request;
s609, the first MDS reads metadata information of the target file;
s610, the first MDS combines the metadata information and the access operation information in the second reconnection request to generate first capability information;
s611, the first MDS sends first capability information to the client;
and S612, the client receives the first capability information and accesses the target file according to the first capability information.
Figure 7 is a block diagram illustrating an apparatus for accessing files, as applied to an MDS, in accordance with an exemplary embodiment. Referring to fig. 7, the apparatus includes a first processing unit 700, a determination unit 701, and a second processing unit 702:
the first processing unit 700 is configured to reply a reconnection rejection message to a client after receiving a first reconnection request of the client at a reconnection nect stage in a starting process of a first MDS in an MDS set, where the first reconnection request is sent by the client after a disconnection with a second MDS in the MDS set;
the determining unit 701 is configured to, after the first MDS is successfully started, if a second reconnection request of the client is received, establish a connection with the client, and determine first capability information for the client to access to a target file, where the second reconnection request is sent to the first MDS when the client needs to access the target file, and the first capability information is used to indicate a capability of the client to access to the target file;
The second processing unit 702 is configured to perform returning the first capability information to the client, so that the client accesses the target file according to the first capability information.
In an optional implementation manner, the determining unit 701 is specifically configured to perform:
determining a target file to be accessed by the client according to the file identifier in the second reconnection request;
reading metadata information of the target file;
and combining the metadata information and the access operation information in the second reconnection request to generate the first capability information.
In an optional implementation, the determining unit 701 is further configured to perform:
after receiving a second reconnection request of the client, extracting second capability information of the client from the second reconnection request;
recording the second capability information into a capability information set of a file corresponding to the second capability information;
after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients;
if the access operation information is write operation and second capability information corresponding to the access operation information is searched for in the capability information set, determining a client having the searched second capability information, and recovering the determined second capability information of the client.
In an optional implementation, the determining unit 701 is further configured to perform:
after determining first capability information for the client to access a target file, recording the first capability information into a capability information set of the target file;
after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients;
if the access operation information is write operation and the first capability information corresponding to the access operation information is found in the capability information set, determining a client having the found first capability information, and recovering the determined first capability information of the client.
In an alternative embodiment, the first processing unit 700 is further configured to perform:
before a reconnect stage in a first MDS starting process in an MDS set receives a first reconnection request of a client, a starting command is received, wherein the starting command is triggered after a CephFS detects that a second MDS serving the client fails.
With regard to the apparatus in the above-described embodiment, the specific manner in which each unit executes the request has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 8 is a block diagram illustrating an electronic device 800 according to an example embodiment, the apparatus comprising:
a processor 810;
a memory 820 for storing instructions executable by the processor 810;
wherein the processor 810 is configured to execute the instructions to implement the method for accessing a file of any one of MDSs according to the embodiment of the present disclosure.
In an exemplary embodiment, a storage medium comprising instructions, such as the memory 820 comprising instructions, executable by the processor 810 of the electronic device 800 to perform the above-described method is also provided. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
The embodiments of the present disclosure also provide a computer program product, which, when running on an electronic device, causes the electronic device to execute a method for implementing any one of the methods applied to an MDS for accessing a file or any one of the methods for accessing a file in the embodiments of the present disclosure, where the method may be related to any one of the methods.
Fig. 9 is a block diagram illustrating an apparatus for accessing a file, applied to a client, according to an example embodiment. Referring to fig. 9, the apparatus comprises a third processing unit 900, a fourth processing unit 901 and an access unit 902:
a third processing unit 900, configured to execute sending a first reconnection request to a second MDS in the MDS set after the second MDS is disconnected from the MDS set, and closing a session connection being started after receiving a reconnection rejection message returned by the first MDS in the MDS set, where the reconnection rejection message is sent by the first MDS after receiving the first reconnection request at a recannect stage in a starting process;
a fourth processing unit 901, configured to execute sending a second reconnection request to the first MDS when the target file needs to be accessed, where the second reconnection request is sent by the client to the first MDS when the target file needs to be accessed;
an accessing unit 902, configured to perform accessing the target file according to the received first capability information of the target file sent by the first MDS, where the first capability information is used to indicate a capability of the client to access the target file.
In an alternative embodiment, the third processing unit 900 is further configured to perform:
and after closing the session connection being started, deleting the second capability information of the client before sending a second reconnection request to the first MDS when the target file needs to be accessed.
In an alternative embodiment, the third processing unit 900 is further configured to perform:
and before sending a second reconnection request to the first MDS when a target file needs to be accessed, placing second capability information of the client in the second reconnection request and sending the second capability information to the first MDS, so that the first MDS records the second capability information in the received second reconnection request to a capability information set of a file corresponding to the second capability information.
FIG. 10 is a block diagram illustrating an electronic device 1000 according to an example embodiment, the apparatus comprising:
a processor 1010;
a memory 1020 for storing instructions executable by the processor 1010;
wherein the processor 1010 is configured to execute the instructions to implement the method for accessing the file, which is applied to the client in the embodiment of the present disclosure.
In an exemplary embodiment, a storage medium comprising instructions, such as a memory 1020 comprising instructions, executable by a processor 1010 of an electronic device 1000 to perform the above-described method is also provided. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
The embodiment of the present disclosure further provides a computer program product, which, when running on an electronic device, causes the electronic device to execute a method for implementing any one of the methods for accessing a file applied to a client or any one of the methods for accessing a file according to the embodiment of the present disclosure.
In this disclosure, when the client is a terminal, as shown in fig. 11, a terminal 1100 for accessing a file in this disclosure includes: radio Frequency (RF) circuitry 1111, a power supply 1120, a processor 1130, memory 1140, an input unit 1150, a display unit 1160, a camera 1170, a communication interface 1180, and a wireless fidelity (Wi-Fi) module 1190. Those skilled in the art will appreciate that the configuration of the terminal shown in fig. 11 is not intended to be limiting, and that embodiments of the present disclosure provide terminals that include more or less components than those shown, or that combine certain components, or that are arranged in different components.
The following describes each component of the terminal 1100 in detail with reference to fig. 11:
the RF circuit 1111 may be used for receiving and transmitting data during communication or conversation. Specifically, the RF circuit 1111 sends the downlink data of the base station to the processor 1130 for processing; and in addition, sending the uplink data to be sent to the base station. Generally, the RF circuit 1111 includes, but is not limited to, an antenna, at least one Amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like.
In addition, the RF circuit 1111 can also communicate with a network and other terminals through wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to Global System for Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, Short Messaging Service (SMS), and the like.
The Wi-Fi technology belongs to a short-distance wireless transmission technology, and the terminal 1100 can be connected with an Access Point (AP) through a Wi-Fi module 1190, thereby realizing Access to a data network. The Wi-Fi module 1190 may be used for receiving and transmitting data during communication.
The terminal 1100 may be physically connected to other terminals through the communication interface 1180. Optionally, the communication interface 1180 is connected to the communication interfaces of the other terminals through a cable, so as to implement data transmission between the terminal 1100 and the other terminals.
In the embodiment of the present disclosure, the terminal 1100 is capable of implementing a communication service and sending information to other contacts, so that the terminal 1100 needs to have a data transmission function, that is, the terminal 1100 needs to include a communication module inside. Although fig. 11 illustrates communication modules such as the RF circuit 1111, the Wi-Fi module 1190, and the communication interface 1180, it is to be understood that at least one of the above-described components or other communication modules (e.g., a bluetooth module) for implementing communication may be present in the terminal 1100 for data transmission.
For example, when the terminal 1100 is a mobile phone, the terminal 1100 may include the RF circuit 1111 and may further include the Wi-Fi module 1190; when the terminal 1100 is a computer, the terminal 1100 may include the communication interface 1180 and may further include the Wi-Fi module 1190; when the terminal 1100 is a tablet computer, the terminal 1100 may include the Wi-Fi module.
The memory 1140 may be used to store software programs and modules. The processor 1130 executes software programs and modules stored in the memory 1140 so as to perform various functional applications and data processing of the terminal 1100, and when the processor 1130 executes the program codes in the memory 1140, part or all of the processes in fig. 5 of the embodiments of the present disclosure can be implemented.
Alternatively, the memory 1140 may mainly include a program storage area and a data storage area. The storage program area can store an operating system, various application programs (such as communication application), a face recognition module and the like; the storage data area may store data (such as various multimedia files like pictures, video files, etc., and face information templates) created according to the use of the terminal, etc.
Further, the memory 1140 may include high speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The input unit 1150 may be used to receive numeric or character information input by a user and generate key signal inputs related to user settings and function control of the terminal 1100.
Optionally, the input unit 1150 may include a touch panel 1151 and other input terminals 1152.
The touch panel 1151, also called a touch screen, can collect touch operations of a user on or near the touch panel 1151 (for example, operations of a user on or near the touch panel 1151 by using any suitable object or accessory such as a finger or a stylus pen), and drive a corresponding connection device according to a preset program. Alternatively, the touch panel 1151 may include two portions, i.e., a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 1130, and can receive and execute commands sent by the processor 1130. In addition, the touch panel 1151 may be implemented by various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave.
Optionally, the other input terminals 1152 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The display unit 1160 may be used to display information input by or provided to the user and various menus of the terminal 1100. The display unit 1160 is a display system of the terminal 1100, and is used for presenting an interface and implementing human-computer interaction.
The display unit 1160 may include a display panel 1161. Alternatively, the Display panel 1161 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
Further, the touch panel 1151 can cover the display panel 1161, and when the touch panel 1151 detects a touch operation on or near the touch panel 1151, the touch panel is transmitted to the processor 1130 to determine the type of the touch event, and then the processor 1130 provides a corresponding visual output on the display panel 1161 according to the type of the touch event.
Although in fig. 11 the touch panel 1151 and the display panel 1161 are shown as two separate components to implement the input and output functions of the terminal 1100, in some embodiments, the touch panel 1151 and the display panel 1161 can be integrated to implement the input and output functions of the terminal 1100.
The processor 1130 is a control center of the terminal 1100, connects various components using various interfaces and lines, performs various functions of the terminal 1100 and processes data by operating or executing software programs and/or modules stored in the memory 1140 and calling data stored in the memory 1140, thereby implementing various services based on the terminal.
Optionally, the processor 1130 may include one or more processing units. Optionally, the processor 1130 may integrate an application processor and a modem processor, wherein the application processor mainly handles operating systems, user interfaces, application programs, and the like, and the modem processor mainly handles wireless communications. It is to be appreciated that the modem processor described above may not be integrated into the processor 1130.
The camera 1170 is configured to implement a shooting function of the terminal 1100, and shoot a picture or a video. The camera 1170 may also be used to implement a scanning function of the terminal 1100, and scan a scanned object (two-dimensional code/barcode).
The terminal 1100 also includes a power supply 1120 (e.g., a battery) for powering the various components. Optionally, the power supply 1120 may be logically connected to the processor 1130 through a power management system, so as to implement functions of managing charging, discharging, power consumption, and the like through the power management system.
It is to be noted that the processor 1130 according to the embodiment of the present disclosure may execute the functions of the processor 1011 in fig. 10, and the memory 1140 stores the contents of the processor 1011.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (18)

1. A method for accessing a file, applied to a metadata server MDS, comprising:
after a reconnection recannect stage in a first MDS starting process in an MDS set receives a first reconnection request of a client, replying a reconnection rejection message to the client, wherein the first reconnection request is sent by the client after the client is disconnected with a second MDS in the MDS set;
After the first MDS is successfully started, if a second reconnection request of the client is received, establishing connection with the client, and determining first capability information of the client for accessing a target file, wherein the second reconnection request is sent to the first MDS when the client needs to access the target file, and the first capability information is used for representing the capability of the client for accessing the target file;
returning the first capability information to the client so that the client accesses the target file according to the first capability information;
after the step of determining the first capability information for the client to access the target file, the method further includes:
recording the first capability information into a capability information set of the target file; after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients; if the access operation information is write operation and the first capability information corresponding to the access operation information is found in the capability information set, determining a client having the found first capability information, and recovering the determined first capability information of the client.
2. The method for accessing files according to claim 1, wherein the step of determining the first capability information of the client for accessing the target file comprises:
determining a target file to be accessed by the client according to the file identifier in the second reconnection request;
reading metadata information of the target file;
and combining the metadata information and the access operation information in the second reconnection request to generate the first capability information.
3. The method for accessing files according to claim 1, further comprising, after said receiving a second reconnection request from said client:
extracting second capability information of the client from the second reconnection request;
recording the second capability information into a capability information set of a file corresponding to the second capability information;
after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients;
if the access operation information is write operation and second capability information corresponding to the access operation information is searched for in the capability information set, determining a client having the searched second capability information, and recovering the determined second capability information of the client.
4. The method for accessing the file according to any one of claims 1 to 3, wherein before the step of receiving the first reconnect request from the client at a reconnect stage in a boot process of a first MDS in the set of MDS, the method further comprises:
and receiving a starting command, wherein the starting command is triggered after the distributed network file system CephFS detects that the second MDS serving the client side fails.
5. A method for accessing files is applied to a client and comprises the following steps:
after the connection with a second MDS in an MDS set of a metadata server is interrupted, sending a first reconnection request to the MDS in the MDS set, and after receiving a reconnection rejection message returned by a first MDS in the MDS set, closing the session connection which is being started, wherein the reconnection rejection message is sent by the first MDS after receiving the first reconnection request at a connection stage in the starting process;
sending a second reconnect request to the first MDS when the target file needs to be accessed, wherein the second reconnect request is sent by the client to the first MDS when the target file needs to be accessed;
accessing the target file according to the received first capability information of the target file sent by the first MDS, wherein the first capability information is used for representing the capability of the client for accessing the target file; after determining first capability information for the client to access an object file, the first MDS records the first capability information into a capability information set of the object file; after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients; if the access operation information is write operation and the first capability information corresponding to the access operation information is found in the capability information set, determining a client having the found first capability information, and recovering the determined first capability information of the client.
6. The method of claim 5, wherein after the step of closing the initiated session connection, and before the step of sending a second reconnect request to the first MDS when access to the target file is required, further comprising:
and deleting the second capability information of the client.
7. The method of claim 5, wherein the step of sending a second request for reconnection to the first MDS when access to the target file is required further comprises:
and placing the second capability information of the client in the second reconnection request and sending the second capability information to the first MDS, so that the first MDS records the second capability information in the received second reconnection request to a capability information set of a file corresponding to the second capability information.
8. An apparatus for accessing a file, which is applied to a metadata server MDS, includes:
the client side comprises a first processing unit and a second processing unit, wherein the first processing unit is configured to reply a reconnection rejection message to the client side after a reconnection request of the client side is received at a connection stage in a starting process of a first MDS in an MDS set, and the first reconnection request is sent by the client side after connection with a second MDS in the MDS set is interrupted;
A determining unit, configured to execute, after the first MDS is successfully started, if a second reconnection request of the client is received, establishing connection with the client, and determining first capability information for the client to access to a target file, where the second reconnection request is sent to the first MDS when the client needs to access the target file, and the first capability information is used to indicate a capability of the client to access to the target file;
the second processing unit is configured to return the first capability information to the client so that the client can access the target file according to the first capability information;
wherein the determining unit is further configured to perform:
after first capability information for the client to access an object file is determined, recording the first capability information into a capability information set of the object file; after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients;
if the access operation information is write operation and the first capability information corresponding to the access operation information is found in the capability information set, determining a client having the found first capability information, and recovering the determined first capability information of the client.
9. The apparatus according to claim 8, wherein the determining unit is specifically configured to perform:
determining a target file to be accessed by the client according to the file identifier in the second reconnection request;
reading metadata information of the target file;
and combining the metadata information and the access operation information in the second reconnection request to generate the first capability information.
10. The apparatus for accessing files according to claim 8, wherein the determining unit is further configured to perform:
after receiving a second reconnection request of the client, extracting second capability information of the client from the second reconnection request;
recording the second capability information into a capability information set of a file corresponding to the second capability information; after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients;
if the access operation information is write operation and second capability information corresponding to the access operation information is searched for in the capability information set, determining a client having the searched second capability information, and recovering the determined second capability information of the client.
11. An apparatus for accessing files according to any of claims 8 to 10, wherein the first processing unit is further configured to perform:
before a reconnect stage in a first MDS starting process in an MDS set receives a first reconnection request of a client, a starting command is received, wherein the starting command is triggered after CephFS detects that MDS serving the client fails.
12. An apparatus for accessing a file, applied to a client, comprising:
the third processing unit is configured to send a first reconnection request to the MDSs in the MDS set after the connection with a second MDS in the MDS set of the metadata server is interrupted, and close the session connection being started after a reconnection rejection message returned by the first MDS in the MDS set is received, wherein the reconnection rejection message is sent by the first MDS after the first reconnection request is received at a reconnection stage in a starting process;
a fourth processing unit, configured to perform sending a second reconnect request to the first MDS when the target file needs to be accessed, where the second reconnect request is sent by the client to the first MDS when the target file needs to be accessed;
An accessing unit, configured to perform accessing the object file according to received first capability information of the object file sent by the first MDS, where the first capability information is used to indicate a capability of the client to access the object file; after determining first capability information for the client to access an object file, the first MDS records the first capability information into a capability information set of the object file; after receiving second reconnection requests of other clients, acquiring access operation information in the second reconnection requests of the other clients; if the access operation information is write operation and the first capability information corresponding to the access operation information is found in the capability information set, determining a client having the found first capability information, and recovering the determined first capability information of the client.
13. The apparatus of claim 12, wherein the third processing unit is further configured to perform:
and after closing the session connection being started, deleting the second capability information of the client before sending a second reconnection request to the first MDS when the target file needs to be accessed.
14. The apparatus according to claim 12, wherein the third processing unit is further configured to perform:
before a second reconnection request is sent to the first MDS when a target file needs to be accessed, second capability information of the client is placed in the second reconnection request and sent to the first MDS, so that the first MDS records the second capability information in the received second reconnection request to a capability information set of a file corresponding to the second capability information.
15. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of accessing files of any one of claims 1 to 4.
16. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of accessing files of any one of claims 5 to 7.
17. A storage medium, wherein instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform a method of accessing files as claimed in any one of claims 1 to 4.
18. A storage medium, wherein instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform a method of accessing files as claimed in any one of claims 5 to 7.
CN201910857637.5A 2019-09-09 2019-09-09 Method and device for accessing file, electronic equipment and storage medium Active CN110618976B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910857637.5A CN110618976B (en) 2019-09-09 2019-09-09 Method and device for accessing file, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910857637.5A CN110618976B (en) 2019-09-09 2019-09-09 Method and device for accessing file, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110618976A CN110618976A (en) 2019-12-27
CN110618976B true CN110618976B (en) 2022-06-03

Family

ID=68922814

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910857637.5A Active CN110618976B (en) 2019-09-09 2019-09-09 Method and device for accessing file, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110618976B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102024016A (en) * 2010-11-04 2011-04-20 天津曙光计算机产业有限公司 Rapid data restoration method for distributed file system (DFS)
US20150066855A1 (en) * 2013-09-04 2015-03-05 Red Hat, Inc. Outcast index in a distributed file system
CN107678859A (en) * 2017-10-13 2018-02-09 郑州云海信息技术有限公司 A kind of file access method based on CAP mechanism, device and equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102024016A (en) * 2010-11-04 2011-04-20 天津曙光计算机产业有限公司 Rapid data restoration method for distributed file system (DFS)
US20150066855A1 (en) * 2013-09-04 2015-03-05 Red Hat, Inc. Outcast index in a distributed file system
CN107678859A (en) * 2017-10-13 2018-02-09 郑州云海信息技术有限公司 A kind of file access method based on CAP mechanism, device and equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Ceph MDS问题分析;lihanglucien;《https://www.jianshu.com/p/80b202ef49ed》;20181107;第1-10页 *
cephfs cap介绍;shanke802;《https://zhuanlan.zhihu.com/p/55352560》;20190121;第1-2页 *

Also Published As

Publication number Publication date
CN110618976A (en) 2019-12-27

Similar Documents

Publication Publication Date Title
US11025963B2 (en) Data processing method, apparatus, and system for live streaming page
US10635449B2 (en) Method and apparatus for running game client
RU2660948C2 (en) Message revoking method and apparatus thereof
CN107741937B (en) Data query method and device
CN113568884B (en) File management method and device, electronic equipment and storage medium
WO2018006682A1 (en) Method and apparatus for processing object information, and storage medium
CN111629075B (en) Data downloading method and related device
US20190199795A1 (en) Method and device for synchronizing backup data, storage medium, electronic device, and server
CN104899083A (en) Application share method and device
CN110618976B (en) Method and device for accessing file, electronic equipment and storage medium
CN111274463B (en) Information display method, device and storage medium based on IM contact person grouping setting
CN107241446A (en) Document transmission method, device and the terminal device and storage medium of application program
CN111935255A (en) Information processing method, device and storage medium
CN106657281B (en) File sharing method and device
CN108804434B (en) Message query method, server and terminal equipment
WO2015085962A1 (en) Method, device and system for processing account information of web application in joint operation
CN113709406B (en) Software collaboration method, system and storage medium for Hongmon conference all-in-one machine
CN112988913B (en) Data processing method and related device
CN106209601B (en) State update message pushing method and device
CN111176708B (en) SDK file processing method and device, electronic equipment and storage medium
CN109002535B (en) Data updating method and device
CN113852450A (en) Message push feedback method and device, electronic equipment and storage medium
CN115048463B (en) Data migration method, system and storage medium
CN115883352B (en) Service node creation method, related equipment and storage medium
US20230274036A1 (en) Data reading method, storage medium, and mobile terminal

Legal Events

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