Method for automatically identifying access style supported by object storage
Technical Field
The invention relates to the field of object storage management, in particular to a method for automatically identifying an access style supported by object storage.
Background
In the prior art, accessing a file in an object storage generally includes two access modes, namely a path mode and a virtual managed mode. Path style (path style), which is a way for object storage to be used early, is not recommended at present, but newer object storage systems still support backward compatibility; a virtual-hosted style (virtual-hosted style) that stores a currently recommended manner of use for an object, which is supported by newer object stores but not by partially older object stores; therefore, the access mode of the object storage needs to be deployed.
In the prior art, the deployment of object stores can be divided into three categories: a first category, supporting both "path styles" and "virtual hosted styles"; the second type only supports 'virtual managed style', and the third type only supports 'path style'; because the modes supported by the object storage on the line in different time periods are different, when one object storage is accessed, the user usually needs to manually confirm which access mode the object storage supports, so that the software system is difficult to configure, and the automatic identification of the supported access pattern cannot be performed.
Accordingly, the prior art is deficient and needs improvement.
Disclosure of Invention
The invention aims to overcome the defects of the prior art, provides a method for automatically identifying access patterns supported by object storage, and solves the problem that the access patterns supported by the object storage cannot be automatically identified by manually confirming the access patterns supported by the object storage in the prior art.
The technical scheme of the invention is as follows: a method of automatically identifying an object store support access pattern, comprising the steps of:
s1: and accessing endpoint information, bucket information and object key information stored in the storage input object.
S2: the access storage forms an access domain name according to a < bucket > < endpoint > rule; and performing a first DNS resolution on the access domain name < bucket > < endpoint >.
S3: and if the first DNS analysis result is successful, accessing the object storage by adopting a virtual managed style.
S4: and if the first DNS analysis result is failure, inputting http (s)/< endpoint >/< bucket >/< object key > according to endpoint information, bucket information and object key information, and performing second DNS analysis on the http (s)/< endpoint >/< bucket >/< object key >.
S5: and if the second DNS analysis result is successful, accessing the object storage by adopting a path style.
The access object storage forms an access domain name according to an end point information, a bucket information and an object key information stored by an object according to a < bucket > < end point > rule, and carries out a first DNS analysis, if the first DNS analysis result is successful, the corresponding object storage supports virtual hosted style access, the access storage preferentially adopts the virtual hosted style access when the access object storage is accessed, if the first DNS analysis result is failed, the corresponding object storage does not support the virtual hosted access, further, the access object storage supports path style access according to the end point information, the bucket information and the object key information which are stored by the object and input http(s) and/or the bucket >/and/or the object key information, and carries out a second DNS analysis, if the second DNS analysis result is successful, the corresponding object storage supports path style access, and the access storage adopts a path style when the access object storage is accessed, the access storage can quickly and accurately select the access mode of the object storage, the access mode of the object storage does not need to be confirmed manually, the selection of the access mode of the object storage can be automatically performed through the method, and the selection speed of the access mode is effectively improved; on the other hand, the method and the device preferentially test whether the object storage to be accessed supports the virtual hosting style, preferentially select the virtual hosting style when the object storage to be accessed simultaneously supports the path style and the virtual hosting style, and improve the access efficiency.
Further, the object store in step S1 is configured to provide end information, bucket information, and object key information to the access store. The object storage in step S1 is the object storage to be accessed by the access storage, and the object storage provides the endpoint information, bucket information, and object key information before accessing the storage, and the provided endpoint information, bucket information, and object key information are determined by the object storage.
Further, the step S2 further includes the following steps:
s20: and the access storage forms an access domain name according to the input endpoint information, the bucket information and the object key information stored by the object and the < bucket > < endpoint > rule.
S21: the access store sends a request for a first DNS resolution for an access domain name < bucket > < endpoint > to a domain name resolution server.
S22: and the domain name resolution server carries out first DNS resolution on the access domain name < bucket > < endpoint >, and feeds back the first DNS resolution result to the access storage.
The access storage sends a request for performing first DNS analysis on the < bucket > < endpoint > to the domain name analysis server, completes the first DNS analysis through the domain name analysis server, sends a first DNS analysis result to the access storage, and confirms whether the corresponding object storage supports the virtual hosted style or not according to the first DNS analysis result.
Further, the step S4 further includes the following steps:
s40: and if the first DNS analysis result is failure, inputting http(s) and// < end >/< bucket >/< object key > by the access memory according to the end information, the bucket information and the object key information stored by the object.
S41: the access store sends a request to a domain name resolution server for a second DNS resolution for the http (s)/< endpoint >/< bucket >/< object key >.
S42: and the domain name resolution server performs second DNS resolution on http (s)/< end >/< bucket >/< object key >, and feeds back the resolution result to the access storage.
Preferably, in step S42, the domain name resolution server performs a second DNS resolution on < endpoint > in http (S)/< endpoint >/< bucket >/< object key >. If the first DNS analysis result is failure, the corresponding object storage does not support virtual hosted style access, whether the corresponding object storage supports path style access is further tested, corresponding http (s)/not/but/object key > is input according to end information, bucket information and object key information of the object storage, second DNS analysis is carried out on < end > in the http (s)/not/but/object key > through a domain name resolution server, and whether the corresponding object storage supports path style access is confirmed according to the second DNS analysis result.
Further, the step S5 is followed by the step S6:
s6: and if the second DNS analysis result is failure, the domain name analysis server feeds back the second DNS analysis result to the access storage as failure, and the access storage checks the reason that the second DNS analysis result is failure. There are generally two cases for the reason that the second DNS resolution result is failure, the first case: the corresponding object stores the provided endpoint information, bucket information and object key information, and errors exist, so that the second DNS analysis result is failure; in the second case: the network accessing the storage is not connected, resulting in a failure of the second DNS resolution.
By adopting the scheme, the method for automatically identifying the access mode supported by the object storage can quickly and accurately select the object storage access mode without manually confirming the access mode of the object storage, and can automatically select the object storage access mode so as to effectively improve the selection speed of the access mode; and preferentially testing whether the object storage to be accessed supports the virtual hosting style, and preferentially selecting the virtual hosting style when the object storage to be accessed simultaneously supports the path style and the virtual hosting style, so that the efficiency of accessing the object storage is improved.
Drawings
FIG. 1 is a block flow diagram of the present invention;
FIG. 2 is a block flow diagram of step S2 according to the present invention;
fig. 3 is a block diagram of the process of step S4 according to the present invention.
Detailed Description
The invention is described in detail below with reference to the figures and the specific embodiments.
Referring to fig. 1, the present invention provides a method for automatically identifying an access style supported by an object storage, comprising the following steps:
s1: and accessing endpoint information, bucket information and object key information stored in the storage input object.
Specifically, in this embodiment, the endpoint information stored by the object is: s3.amazonaws. com; the bucket information is example; the object key information is: txt.
S2: the access storage forms an access domain name according to a < bucket > < endpoint > rule; and performing a first DNS resolution on the access domain name < bucket > < endpoint >. Specifically, in this embodiment, the access domain name is example.s3. amazonaws.com.
S3: and if the first DNS analysis result is successful, accessing the object storage by adopting a virtual hosting style.
S4: and if the first DNS analysis result is failure, inputting http (s)/< endpoint >/< bucket >/< object key > according to endpoint information, bucket information and object key information, and performing second DNS analysis on the http (s)/< endpoint >/< bucket >/< object key >. Specifically, in the present embodiment, the http (s)/< end >/< bucket >/< object key > is https:// s3. amplitude.
S5: and if the second DNS analysis result is successful, accessing the object storage by adopting the path style.
The access object storage forms an access domain name according to an end information, a bucket information and an object key information stored in an object according to a < bucket > < end > rule, and carries out first DNS analysis on an example 3. example concerns.com, if the first DNS analysis result is successful, the corresponding object storage supports virtual hosted style access, the access storage preferentially adopts virtual hosted style access when the access object storage is accessed, if the first DNS analysis result is failed, the corresponding object storage does not support virtual hosted access, further, the access object storage supports path style access according to the point information, the bucket information and the object key information stored in the object storage, the https:// s3. example concerns.com/example/text, and carries out second DNS analysis, if the second DNS analysis result is successful, the access object storage adopts a path for access, and the access object storage can be selected in a rapid access mode, the access mode of the object storage does not need to be confirmed manually, and the selection of the access mode of the object storage can be automatically carried out through the method, so that the selection speed of the access mode is effectively improved; on the other hand, the method and the device preferentially test whether the object storage to be accessed supports the virtual hosting style, preferentially select the virtual hosting style when the object storage to be accessed simultaneously supports the path style and the virtual hosting style, and improve the access efficiency.
Specifically, in this embodiment, the object store in step S1 is configured to provide endpoint information, bucket information, and object key information to the access store. The object storage in step S1 is an object storage to be accessed for access storage, where the object storage provides end information, bucket information, and object key information in access storage before access, and the provided end information, bucket information, and object key information are determined by the object storage.
Referring to fig. 2, the step S2 further includes the following steps:
s20: and the access storage forms an access domain name according to the input endpoint information, the bucket information and the object key information stored by the object and the < bucket > < endpoint > rule. Specifically, in this embodiment, the access domain name is example.s3. amazonaws.com.
S21: the access store sends a request to a domain name resolution server for a first DNS resolution to access a domain name example.s3. amazonaws.com.
S22: and the domain name resolution server carries out first DNS resolution on the access domain name example.s3.amazonaws.com and feeds back the first DNS resolution result to the access storage.
The access storage sends a request for performing first DNS analysis on example.s3.amazonaws.com to a domain name analysis server, completes the first DNS analysis through the domain name analysis server, sends a first DNS analysis result to the access storage, and confirms whether the corresponding object storage supports a virtual hosting style or not according to the first DNS analysis result.
Referring to fig. 3, the step S4 further includes the following steps:
s40: if the first DNS analysis result is failure, the access storage inputs https:// s3. amplitude. com/example/test. txt according to the end information, bucket information and object key information stored by the object.
S41: the access store sends a request to a domain name resolution server for a second DNS resolution for https:// s3. amazonawcom/example/test.
S42: and the domain name resolution server performs second DNS resolution on https:// s3.amazonaws.com/example/test.txt, and feeds back a resolution result to the access storage.
In step S42, the domain name resolution server performs a second DNS resolution on < endpoint > in https:// S3. amazonaw.com/example/test.txt, where < endpoint > in this embodiment is S3. amazonaw.com. If the first DNS analysis result is failure, the corresponding object storage does not support virtual hosted style access, whether the corresponding object storage supports path style access is further tested, whether corresponding https:// s3. involved. com/example/test.txt is input according to end information, bucket information and object key information of the object storage, second DNS analysis is carried out on s3. involved. com in https:// s3. involved. com/example/test.txt through a domain name analysis server, and whether the corresponding object storage supports path style access is confirmed according to the second DNS analysis result.
Specifically, in this embodiment, the step S5 is followed by the step S6:
s6: and if the second DNS analysis result is failure, the domain name analysis server feeds back the second DNS analysis result to the access storage, and the access storage checks the reason that the second DNS analysis result is failure. The reason why the second DNS resolution result is failure generally has two cases, the first case: the corresponding object stores the provided endpoint information, bucket information and object key information, and errors exist, so that the second DNS analysis result is failure; in the second case: the network accessing the storage is not connected, resulting in a failure of the second DNS resolution.
In summary, the present invention provides a method for automatically identifying access patterns supported by object storage, which can quickly and accurately select an object storage access manner, without manually confirming the access manner of the object storage, and can automatically select an object storage access manner by the method of the present invention, thereby effectively increasing the speed of selecting the access manner; and preferentially testing whether the object storage to be accessed supports the virtual hosting style, and preferentially selecting the virtual hosting style when the object storage to be accessed simultaneously supports the path style and the virtual hosting style, so that the efficiency of accessing the object storage is improved.
The present invention is not limited to the above preferred embodiments, and any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention should be included in the protection scope of the present invention.