CN109344140A - Data access method, device, electronic device and computer storage medium - Google Patents
Data access method, device, electronic device and computer storage medium Download PDFInfo
- Publication number
- CN109344140A CN109344140A CN201810924374.0A CN201810924374A CN109344140A CN 109344140 A CN109344140 A CN 109344140A CN 201810924374 A CN201810924374 A CN 201810924374A CN 109344140 A CN109344140 A CN 109344140A
- Authority
- CN
- China
- Prior art keywords
- file system
- working mode
- preset
- access
- version
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本申请涉及数据处理技术领域,公开了一种数据访问方法、装置、电子设备及计算机可读存储介质,其中,数据访问方法包括:基于访问路径与工作模式间的第一预设对应关系,确定当前获取到的访问路径所对应的工作模式;接着如果工作模式不是预设工作模式,则通过预设文件系统插件,根据工作模式访问相应版本的文件系统中的数据信息。本申请实施例的方法,能够基于同一客户端,通过预设文件系统插件,来访问任一版本的文件系统,即在对上层应用透明的情况下,实现了通过同一客户端对各个版本的文件系统的访问兼容。
The present application relates to the technical field of data processing, and discloses a data access method, an apparatus, an electronic device and a computer-readable storage medium, wherein the data access method includes: based on a first preset correspondence between an access path and a working mode, determining The working mode corresponding to the currently obtained access path; then, if the working mode is not the preset working mode, the preset file system plug-in is used to access the data information in the file system of the corresponding version according to the working mode. The method of the embodiment of the present application can access any version of the file system based on the same client through the preset file system plug-in, that is, in the case of being transparent to the upper-layer application, the same client can be used to access files of various versions. Access to the system is compatible.
Description
技术领域technical field
本申请涉及数据处理技术领域,具体而言,本申请涉及一种数据访问方法、装置、电子设备及计算机存储介质。The present application relates to the technical field of data processing, and in particular, to a data access method, apparatus, electronic device, and computer storage medium.
背景技术Background technique
Hadoop实现了一个分布式文件系统HDFS(Hadoop Distributed File System),其中,HDFS具有高容错性的特点,并且可以被设计成部署在低廉的通用硬件上,同时HDFS能够提供高传输率来访问应用程序的数据,适合那些有着超大数据集的应用程序。Hadoop implements a distributed file system, HDFS (Hadoop Distributed File System). HDFS has the characteristics of high fault tolerance and can be designed to be deployed on inexpensive general-purpose hardware. At the same time, HDFS can provide high transfer rates to access applications. data, suitable for applications with very large data sets.
随着技术的不断发展和更新,在HDFS1.0系统的基础上,已发布了新的HDFS2.0系统,HDFS2.0系统的存储访问方式与HDFS1.0系统有很大区别,HDFS1.0系统采用的是Hadoop自带的RPC(Remote Procedure Call Protocol,远程过程调用协议)来通信,而HDFS2.0系统则采用PB(Protocol Buffer,协议缓冲)协议来通信。With the continuous development and update of technology, a new HDFS2.0 system has been released on the basis of HDFS1.0 system. The storage access method of HDFS2.0 system is very different from that of HDFS1.0 system. HDFS1.0 system The RPC (Remote Procedure Call Protocol) that comes with Hadoop is used for communication, while the HDFS2.0 system uses the PB (Protocol Buffer) protocol for communication.
目前,针对不同版本的HDFS系统(例如HDFS1.0与HDFS2.0),可以通过分别部署不同版本的客户端(例如客户端1.0与客户端2.0)的方式,来使用相应的客户端分别访问不同版本的HDFS,例如,使用客户端1.0访问HDFS1.0中的数据,使用客户端2.0访问HDFS2.0中的数据。然而,若要使用客户端2.0访问HDFS1.0中的数据,则必须将数据从HDFS1.0拷贝到HDFS2.0,这一过程,不仅操作繁杂,而且将会消耗很长的时间,导致效率较低。At present, for different versions of HDFS systems (such as HDFS 1.0 and HDFS 2.0), you can use the corresponding clients to access different Versions of HDFS, for example, use client 1.0 to access data in HDFS 1.0, and use client 2.0 to access data in HDFS 2.0. However, if you want to use the client 2.0 to access the data in HDFS1.0, you must copy the data from HDFS1.0 to HDFS2.0. This process is not only complicated, but also consumes a long time, resulting in low efficiency. Low.
发明内容SUMMARY OF THE INVENTION
为克服上述技术问题或者至少部分地解决上述技术问题,特提出以下技术方案:In order to overcome the above-mentioned technical problems or at least partially solve the above-mentioned technical problems, the following technical solutions are specially proposed:
第一方面,提供了一种数据访问方法,包括:In a first aspect, a data access method is provided, including:
基于访问路径与工作模式间的第一预设对应关系,确定当前获取到的访问路径所对应的工作模式;Based on the first preset correspondence between the access path and the working mode, determining the working mode corresponding to the currently obtained access path;
如果工作模式不是预设工作模式,则通过预设文件系统插件,根据工作模式访问相应版本的文件系统中的数据信息。If the working mode is not the preset working mode, the data information in the file system of the corresponding version is accessed according to the working mode through the preset file system plug-in.
具体地,在通过预设文件系统插件,根据工作模式访问相应版本的文件系统中的数据信息之前,还包括:Specifically, before accessing the data information in the file system of the corresponding version according to the working mode through the preset file system plug-in, the method further includes:
配置工作模式与文件系统的版本信息之间的第二预设对应关系。A second preset correspondence between the working mode and the version information of the file system is configured.
进一步地,通过预设文件系统插件,根据工作模式访问相应版本的文件系统中的数据信息,包括:Further, through the preset file system plug-in, the data information in the file system of the corresponding version is accessed according to the working mode, including:
根据第二预设对应关系,确定工作模式对应的文件系统的版本信息;determining the version information of the file system corresponding to the working mode according to the second preset correspondence;
通过预设文件系统插件,根据确定得到的版本信息,访问相应的文件系统中的数据信息。Through the preset file system plug-in, the data information in the corresponding file system is accessed according to the determined version information.
进一步地,在通过预设文件系统插件,根据确定得到的版本信息,获取相应的文件系统中的数据信息之前,还包括:Further, before acquiring the data information in the corresponding file system according to the determined version information through the preset file system plug-in, the method further includes:
配置工作模式与类加载器之间的第三预设对应关系。A third preset correspondence between the working mode and the class loader is configured.
进一步地,通过预设文件系统插件,根据确定得到的版本信息,获取相应的文件系统中的数据信息,包括:Further, through the preset file system plug-in, according to the determined version information, the data information in the corresponding file system is obtained, including:
根据第三预设对应关系,确定与工作模式相对应的类加载器;determining the class loader corresponding to the working mode according to the third preset correspondence;
通过预设文件系统插件,根据确定得到的类加载器加载版本信息对应的文件系统的Java档案文件包;Through the preset file system plug-in, load the Java archive file package of the file system corresponding to the version information according to the determined class loader;
根据Java档案文件包,访问文件系统中的数据信息。Access data information in the file system according to the Java archive file package.
进一步地,类加载器通过反射的方式,来加载版本信息对应的文件系统的Java档案文件包。Further, the class loader loads the Java archive file package of the file system corresponding to the version information by means of reflection.
进一步地,还包括:Further, it also includes:
如果工作模式是预设工作模式,则根据第二预设对应关系,直接加载相应版本信息的文件系统的Java档案文件包,以访问该文件系统中的数据信息。If the working mode is the preset working mode, the Java archive file package of the file system of the corresponding version information is directly loaded according to the second preset corresponding relationship, so as to access the data information in the file system.
进一步地,文件系统为分布式文件系统HDFS。Further, the file system is a distributed file system HDFS.
第二方面,提供了一种数据访问装置,包括:In a second aspect, a data access device is provided, including:
确定模块,用于基于访问路径与工作模式间的第一预设对应关系,确定当前获取到的访问路径所对应的工作模式;a determining module, configured to determine the working mode corresponding to the currently obtained access path based on the first preset correspondence between the access path and the working mode;
第一处理模块,用于当工作模式不是预设工作模式时,通过预设文件系统插件,根据工作模式访问相应版本的文件系统中的数据信息。The first processing module is configured to access the data information in the file system of the corresponding version according to the working mode through the preset file system plug-in when the working mode is not the preset working mode.
具体地,还包括第一配置模块;Specifically, it also includes a first configuration module;
所述第一配置模块,用于配置工作模式与文件系统的版本信息之间的第二预设对应关系。The first configuration module is configured to configure the second preset correspondence between the working mode and the version information of the file system.
进一步地,第一处理模块包括版本确定子模块与数据访问子模块;Further, the first processing module includes a version determination submodule and a data access submodule;
版本确定子模块,用于根据第二预设对应关系,确定工作模式对应的文件系统的版本信息;a version determination submodule, configured to determine the version information of the file system corresponding to the working mode according to the second preset correspondence;
数据访问子模块,用于通过预设文件系统插件,根据确定得到的版本信息,访问相应的文件系统中的数据信息。The data access sub-module is used to access the data information in the corresponding file system according to the determined version information through the preset file system plug-in.
进一步地,还包括第二配置模块;Further, it also includes a second configuration module;
第二配置模块,用于配置工作模式与类加载器之间的第三预设对应关系。The second configuration module is used to configure the third preset correspondence between the working mode and the class loader.
进一步地,数据访问子模块包括类加载器确定子单元、加载子单元与数据访问子单元;Further, the data access submodule includes a class loader determination subunit, a loading subunit and a data access subunit;
类加载器确定子单元,用于根据第三预设对应关系,确定与工作模式相对应的类加载器;The class loader determines a subunit for determining the class loader corresponding to the working mode according to the third preset correspondence;
加载子单元,用于通过预设文件系统插件,根据确定得到的类加载器加载版本信息对应的文件系统的Java档案文件包;The loading subunit is used to load the Java archive file package of the file system corresponding to the version information according to the determined class loader through the preset file system plug-in;
数据访问子单元,用于根据Java档案文件包,访问文件系统中的数据信息。The data access subunit is used to access data information in the file system according to the Java archive file package.
进一步地,加载子单元具体用于类加载器通过反射的方式,来加载版本信息对应的文件系统的Java档案文件包。Further, the loading subunit is specifically used for the class loader to load the Java archive file package of the file system corresponding to the version information by means of reflection.
进一步地,还包括第二处理模块;Further, it also includes a second processing module;
第二获取模块,用于当工作模式是预设工作模式时,根据第二预设对应关系,直接加载相应版本信息的文件系统的Java档案文件包,以获取该文件系统中的数据信息。The second obtaining module is configured to directly load the Java archive file package of the file system of the corresponding version information according to the second preset correspondence when the working mode is the preset working mode, so as to obtain the data information in the file system.
进一步地,文件系统为分布式文件系统HDFS。Further, the file system is a distributed file system HDFS.
第三方面,提供了一种电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行所述程序时实现上述的数据访问方法。In a third aspect, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the above data access method when the program is executed.
第四方面,提供了一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,该程序被处理器执行时实现上述的数据访问方法。In a fourth aspect, a computer-readable storage medium is provided, where a computer program is stored on the computer-readable storage medium, and when the program is executed by a processor, the above-mentioned data access method is implemented.
本申请实施提供的数据访问方法,基于访问路径与工作模式间的第一预设对应关系,确定当前获取到的访问路径所对应的工作模式,为后续根据工作模式获取相应版本的文件系统中的数据信息提供前提保障;当工作模式不是预设工作模式时,通过预设文件系统插件,根据工作模式对相应版本的文件系统中的数据信息进行处理,从而能够基于同一客户端,通过预设文件系统插件,来访问任一版本的文件系统,即在对上层应用透明的情况下,实现了通过同一客户端对各个版本的文件系统的访问兼容,不仅有效避免了通过相应版本的客户端访问与其对应的文件系统的繁琐操作,而且在实现兼容访问的过程,无需将其它版本的文件系统中的数据拷贝到当前版本的文件系统中,降低操作复杂度,提高数据访问效率。In the data access method provided by the implementation of the present application, based on the first preset correspondence between the access path and the working mode, the working mode corresponding to the currently obtained access path is determined, which is used for the subsequent acquisition of the corresponding version of the file system according to the working mode. The data information provides premise guarantee; when the working mode is not the preset working mode, the data information in the corresponding version of the file system can be processed according to the working mode through the preset file system plug-in, so that the preset file system can be processed based on the same client. The system plug-in can access any version of the file system, that is, in the case of being transparent to the upper-layer application, it realizes the access compatibility of the file system of various versions through the same client, which not only effectively avoids the access through the corresponding version of the client. The tedious operation of the corresponding file system, and in the process of realizing compatible access, there is no need to copy the data in the file system of other versions to the file system of the current version, which reduces the operation complexity and improves the data access efficiency.
本申请附加的方面和优点将在下面的描述中部分给出,这些将从下面的描述中变得明显,或通过本申请的实践了解到。Additional aspects and advantages of the present application will be set forth in part in the following description, which will become apparent from the following description, or may be learned by practice of the present application.
附图说明Description of drawings
本申请上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present application will become apparent and readily understood from the following description of embodiments taken in conjunction with the accompanying drawings, wherein:
图1为本申请实施例的数据访问方法的流程示意图;1 is a schematic flowchart of a data access method according to an embodiment of the present application;
图2为本申请实施例的数据访问方法的过程示意图;2 is a schematic process diagram of a data access method according to an embodiment of the present application;
图3为本申请实施例的数据访问装置的基本结构示意图;3 is a schematic diagram of a basic structure of a data access device according to an embodiment of the present application;
图4为本申请实施例的数据访问装置的详细结构示意图;FIG. 4 is a detailed structural schematic diagram of a data access device according to an embodiment of the present application;
图5为本申请实施例的电子设备的结构示意图。FIG. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
下面详细描述本申请的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。下面通过参考附图描述的实施例是示例性的,仅用于解释本申请,而不能解释为对本申请的限制。The following describes in detail the embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein the same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, but not to be construed as a limitation on the present application.
本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本申请的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。应该理解,当我们称元件被“连接”或“耦接”到另一元件时,它可以直接连接或耦接到其他元件,或者也可以存在中间元件。此外,这里使用的“连接”或“耦接”可以包括无线连接或无线耦接。这里使用的措辞“和/或”包括一个或更多个相关联的列出项的全部或任一单元和全部组合。It will be understood by those skilled in the art that the singular forms "a", "an", "the" and "the" as used herein can include the plural forms as well, unless expressly stated otherwise. It should be further understood that the word "comprising" used in the specification of this application refers to the presence of stated features, integers, steps, operations, elements and/or components, but does not preclude the presence or addition of one or more other features, Integers, steps, operations, elements, components and/or groups thereof. It will be understood that when we refer to an element as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Furthermore, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combination of one or more of the associated listed items.
为使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请实施方式作进一步地详细描述。In order to make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
目前,针对不同版本的文件系统(例如文件系统1.0与H文件系统.0),可以通过在同一台机器上分别部署不同版本的客户端(例如客户端1.0与客户端2.0)的方式,来使用相应的客户端分别访问不同版本的文件系统,例如,使用客户端1.0访问文件系统1.0中的数据,使用客户端2.0访问文件系统2.0中的数据,即访问不同版本的文件系统时,需指定相应的不同版本的客户端,这对于上层应用来说,操作过程十分繁琐,而且无法在对上层应用透明的情况下,实现不同版本的文件系统的数据共享。另外,若要使用客户端2.0访问文件系统1.0中的数据,则必须将数据从文件系统1.0拷贝到文件系统2.0,这一过程,不仅操作繁杂,而且将会消耗很长的时间,导致效率较低。Currently, for different versions of file systems (such as file system 1.0 and H file system.0), you can deploy different versions of clients (such as client 1.0 and client 2.0) on the same machine to use Corresponding clients access different versions of the file system, for example, use client 1.0 to access data in file system 1.0, and use client 2.0 to access data in file system 2.0, that is, when accessing different versions of the file system, you need to specify the corresponding For the upper-layer application, the operation process is very cumbersome, and it is impossible to realize the data sharing of different versions of the file system in the case of being transparent to the upper-layer application. In addition, if you want to use the client 2.0 to access the data in the file system 1.0, you must copy the data from the file system 1.0 to the file system 2.0. This process is not only complicated, but also consumes a long time, resulting in low efficiency. Low.
本申请提供的数据访问方法、装置、电子设备和计算机可读存储介质,旨在解决现有技术的如上技术问题。The data access method, device, electronic device, and computer-readable storage medium provided by the present application are intended to solve the above technical problems in the prior art.
下面以具体地实施例对本申请的技术方案以及本申请的技术方案如何解决上述技术问题进行详细说明。下面这几个具体的实施例可以相互结合,对于相同或相似的概念或过程可能在某些实施例中不再赘述。下面将结合附图,对本申请的实施例进行描述。The technical solutions of the present application and how the technical solutions of the present application solve the above-mentioned technical problems will be described in detail below with specific examples. The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.
实施例一Example 1
本申请实施例提供了一种数据访问方法,如图1所示,包括:The embodiment of the present application provides a data access method, as shown in FIG. 1 , including:
步骤S110,基于访问路径与工作模式间的第一预设对应关系,确定当前获取到的访问路径所对应的工作模式。Step S110 , based on the first preset correspondence between the access path and the working mode, determine the working mode corresponding to the currently obtained access path.
具体地,客户端在访问后台服务器的文件系统中的数据信息时,通常是根据预先存储的工作模式来确定相应的文件系统,从而访问该确定出的文件系统中的数据信息,而用户在通过客户端访问数据时,通常是在客户端中输入访问路径,使得客户端根据访问路径访问相应的数据信息,因此,客户端需要根据访问路径与工作模式间的第一预设对应关系,例如访问路径1对应工作模式1,访问路径2对应工作模式2,访问路径3对应工作模式3,确定用户输入的访问路径所对应的工作模式,即确定客户端当前获取到的访问路径所对应的工作模式,进而根据工作模式确定相应的文件系统,并访问该确定出的文件系统中的数据信息。Specifically, when the client accesses the data information in the file system of the background server, it usually determines the corresponding file system according to the pre-stored working mode, so as to access the data information in the determined file system. When the client accesses data, it usually enters the access path in the client, so that the client can access the corresponding data information according to the access path. Therefore, the client needs to access the first preset correspondence between the access path and the working mode, such as access Path 1 corresponds to work mode 1, access path 2 corresponds to work mode 2, and access path 3 corresponds to work mode 3. Determine the work mode corresponding to the access path input by the user, that is, determine the work mode corresponding to the access path currently obtained by the client , and then determine the corresponding file system according to the working mode, and access the data information in the determined file system.
步骤S120,如果工作模式不是预设工作模式,则通过预设文件系统插件,根据工作模式访问相应版本的文件系统中的数据信息。Step S120, if the working mode is not the preset working mode, access the data information in the file system of the corresponding version according to the working mode through the preset file system plug-in.
具体地,客户端开发过程中,可以预设一个默认的工作模式,例如,客户端默认对应的工作模式为工作模式2,该工作模式2即为客户端的预设工作模式,即客户端是默认基于工作模式2来访问相应的版本的文件系统中的数据信息,例如客户端默认基于工作模式2,访问文件系统2.0中的数据信息。其中,访问文件系统2.0中的数据信息不仅包括读取或获取文件系统2.0中的数据信息的情况,还包括对文件系统2.0中的数据信息进行写入的情况,即向文件系统2.0中写入数据信息的情况。Specifically, during the client development process, a default working mode can be preset. For example, the default working mode corresponding to the client is working mode 2, and the working mode 2 is the default working mode of the client, that is, the client is the default working mode. The data information in the file system of the corresponding version is accessed based on the working mode 2. For example, the client accesses the data information in the file system 2.0 based on the working mode 2 by default. Among them, accessing the data information in the file system 2.0 includes not only reading or obtaining the data information in the file system 2.0, but also writing the data information in the file system 2.0, that is, writing to the file system 2.0. data information.
进一步地,为了实现客户端对不同版本的文件系统中的数据信息的访问兼容,在客户端开发过程中,也允许客户端以其它工作模式来访问相应版本的文件系统中的数据信息,例如客户端以工作模式1来访问文件系统1.0中数据信息,又例如客户端以工作模式3来访问文件系统3.0中的数据信息。Further, in order to realize the compatibility of the client's access to the data information in the file systems of different versions, in the client development process, the client is also allowed to access the data information in the corresponding version of the file system in other working modes, such as the client. The client accesses the data information in the file system 1.0 in the working mode 1, and, for example, the client uses the working mode 3 to access the data information in the file system 3.0.
进一步地,客户端可以根据文件系统(例如FileSystem)这一接口来判断当前获取到的访问路径所对应的工作模式是否为预设工作模式,如果当前获取到的访问路径所对应的工作模式不是预设工作模式,则说明客户端是对除文件系统2.0外的其它版本的文件系统(例如文件系统1.0、文件系统3.0)中的数据信息的兼容访问。此时,客户端通过预设文件系统插件,来根据当前获取到的访问路径所对应的工作模式,访问相应版本的文件系统中的数据信息,即客户端无法直接访问除预设工作模式对应版本的文件系统(例如文件系统2.0)外的其它版本的文件系统(例如文件系统1.0、文件系统3.0),而是通过预设文件系统插件,例如SpinnerFileSystem,来间接访问文件系统1.0或文件系统3.0中的数据信息。Further, the client can judge whether the working mode corresponding to the currently obtained access path is the preset working mode according to the interface of the file system (eg FileSystem), if the working mode corresponding to the currently obtained access path is not the preset working mode. If the working mode is set, it means that the client has compatible access to data information in file systems of other versions (eg, file system 1.0 and file system 3.0) except file system 2.0. At this time, the client accesses the data information in the file system of the corresponding version through the preset file system plug-in according to the working mode corresponding to the currently obtained access path, that is, the client cannot directly access the version corresponding to the preset working mode. other versions of the file system (such as file system 1.0, file system 3.0) other than the file system (such as file system 2.0), but indirectly access file system 1.0 or file system 3.0 through preset file system plug-ins, such as SpinnerFileSystem data information.
本申请实施例提供的数据访问方法,与现有技术相比,基于访问路径与工作模式间的第一预设对应关系,确定当前获取到的访问路径所对应的工作模式,为后续根据工作模式获取相应版本的文件系统中的数据信息提供前提保障;当工作模式不是预设工作模式时,通过预设文件系统插件,根据工作模式对相应版本的文件系统中的数据信息进行处理,从而能够基于同一客户端,通过预设文件系统插件,来访问任一版本的文件系统,即在对上层应用透明的情况下,实现了通过同一客户端对各个版本的文件系统的访问兼容,不仅有效避免了只能通过相应版本的客户端来访问与其对应的文件系统的繁琐操作,而且在实现兼容访问的过程,无需将其它版本的文件系统中的数据拷贝到当前版本的文件系统中,降低操作复杂度,提高数据访问效率。Compared with the prior art, the data access method provided by the embodiment of the present application determines the working mode corresponding to the currently obtained access path based on the first preset correspondence between the access path and the working mode, which is used for the follow-up according to the working mode. Obtaining the data information in the file system of the corresponding version provides a premise guarantee; when the working mode is not the preset working mode, the data information in the file system of the corresponding version is processed according to the working mode through the preset file system plug-in, so that the data information in the file system of the corresponding version can be processed based on the working mode The same client can access any version of the file system through the preset file system plug-in, that is, in the case of being transparent to the upper-layer application, it realizes the access compatibility of the file system of various versions through the same client, which not only effectively avoids the The cumbersome operation of the corresponding file system can only be accessed through the corresponding version of the client, and in the process of achieving compatible access, there is no need to copy the data in other versions of the file system to the current version of the file system, reducing the complexity of the operation , to improve data access efficiency.
实施例二Embodiment 2
本申请实施例提供了另一种可能的实现方式,在实施例一的基础上,还包括实施例二所示的方法,其中,The embodiment of the present application provides another possible implementation manner. On the basis of the first embodiment, the method shown in the second embodiment is also included, wherein,
文件系统为分布式文件系统HDFS。The file system is the distributed file system HDFS.
在步骤S120之前还包括步骤S111(图中未标注):配置工作模式与文件系统的版本信息之间的第二预设对应关系。Before step S120, step S111 (not marked in the figure) is further included: configuring a second preset correspondence between the working mode and the version information of the file system.
步骤S120包括步骤S1201(图中未标注)与步骤S1202(图中未标注),其中,Step S120 includes step S1201 (not marked in the figure) and step S1202 (not marked in the figure), wherein,
步骤S1201:根据第二预设对应关系,确定工作模式对应的文件系统的版本信息。Step S1201: Determine the version information of the file system corresponding to the working mode according to the second preset correspondence.
步骤S1203:通过预设文件系统插件,根据确定得到的版本信息,访问相应的文件系统中的数据信息。Step S1203: Access the data information in the corresponding file system through the preset file system plug-in and according to the determined version information.
具体地,可以预先配置工作模式与分布式文件系统HDFS的版本信息之间的第二预设对应关系,其中,工作模式与HDFS的版本信息之间是一一对应的,例如工作模式1对应的HDFS的版本信息为1.0版本,即工作模式1与HDFS1.0一一对应,又例如工作模式2对应的HDFS的版本信息为2.0版本,即工作模式2与HDFS2.0一一对应,再例如工作模式3对应的HDFS的版本信息为3.0版本,即工作模式3与HDFS3.0一一对应。预先配置工作模式与HDFS的版本信息之间的对应关系后,便于根据工作模式直接确定相应版本的HDFS,并访问根据工作模式访问相应版本的HDFS中的数据信息。Specifically, a second preset correspondence between the working mode and the version information of the distributed file system HDFS may be pre-configured, wherein there is a one-to-one correspondence between the working mode and the version information of HDFS, for example, the corresponding working mode 1 The version information of HDFS is version 1.0, that is, working mode 1 corresponds to HDFS1.0 one-to-one, and for example, the version information of HDFS corresponding to working mode 2 is version 2.0, that is, working mode 2 corresponds to HDFS2.0 one-to-one, and for example, work mode 2 corresponds to HDFS 2.0. The version information of HDFS corresponding to mode 3 is version 3.0, that is, the working mode 3 corresponds to HDFS 3.0 one-to-one. After pre-configuring the corresponding relationship between the working mode and the version information of HDFS, it is convenient to directly determine the corresponding version of HDFS according to the working mode, and access the data information in the corresponding version of HDFS according to the working mode.
进一步地,客户端根据访问路径与工作模式间的第一预设对应关系,确定出当前获取到的访问路径所对应的工作模式后,例如确定出当前获取到的访问路径所对应的工作模式为工作模式1,接着客户端可以根据工作模式与HDFS的版本信息之间的第二预设对应关系,确定出当前工作模式(例如工作模式1)所对应的HDFS的版本信息(例如1.0版本),即工作模式1对应于HDFS1.0,在确定出当前工作模式所对应的HDFS的版本信息后,可以通过预设文件系统插件,根据确定得到的版本信息(例如1.0版本),访问相应的HDFS1.0中的数据信息。Further, after the client determines the working mode corresponding to the currently obtained access path according to the first preset correspondence between the access path and the working mode, for example, it is determined that the working mode corresponding to the currently obtained access path is: Working mode 1, then the client can determine the version information of HDFS (eg version 1.0) corresponding to the current working mode (eg working mode 1) according to the second preset correspondence between the working mode and the version information of HDFS, That is, working mode 1 corresponds to HDFS 1.0. After determining the version information of HDFS corresponding to the current working mode, you can access the corresponding HDFS 1 according to the determined version information (such as version 1.0) through the preset file system plug-in. 0 data information.
对于本申请实施例,通过工作模式与HDFS的版本信息之间的第二预设对应关系,便于快速准确地确定出当前工作模式所对应的HDFS的版本信息,进而使得客户端通过预设文件系统插件,根据确定得到的版本信息,实现对相应版本的HDFS中的数据信息的快速、高效访问,实现了通过同一客户端对应不同版本的HDFS中的数据信息的兼容访问。For the embodiment of the present application, through the second preset correspondence between the working mode and the version information of HDFS, it is convenient to quickly and accurately determine the version information of HDFS corresponding to the current working mode, so that the client can pass the preset file system. The plug-in, according to the determined version information, realizes fast and efficient access to the data information in the corresponding version of HDFS, and realizes the compatible access to the data information in different versions of HDFS through the same client.
实施例三Embodiment 3
本申请实施例提供了另一种可能的实现方式,在实施例二的基础上,还包括实施例三所示的方法,其中,The embodiment of the present application provides another possible implementation manner. On the basis of the second embodiment, the method shown in the third embodiment is also included, wherein,
在步骤S1203之前还包括步骤S1202(图中未标注):配置工作模式与类加载器之间的第三预设对应关系。Before step S1203, step S1202 (not marked in the figure) is further included: configuring the third preset correspondence between the working mode and the class loader.
步骤S1203包括步骤S12031(图中未标注)、步骤S12032(图中未标注)与步骤S12033(图中未标注),其中,Step S1203 includes step S12031 (not marked in the figure), step S12032 (not marked in the figure) and step S12033 (not marked in the figure), wherein,
步骤S12031:根据第三预设对应关系,确定与工作模式相对应的类加载器。Step S12031: Determine the class loader corresponding to the working mode according to the third preset correspondence.
步骤S12032:通过预设文件系统插件,根据确定得到的类加载器加载版本信息对应的文件系统的Java档案文件包。Step S12032: Load the Java archive file package of the file system corresponding to the version information according to the determined class loader by using the preset file system plug-in.
步骤S12033:根据Java档案文件包,访问文件系统中的数据信息。Step S12033: Access the data information in the file system according to the Java archive file package.
其中,类加载器通过反射的方式,来加载版本信息对应的文件系统的Java档案文件包。The class loader loads the Java archive file package of the file system corresponding to the version information by means of reflection.
具体地,预设文件系统插件是通过相应的类加载器以反射的方式,来实现对兼容版本的HDFS(例如HDFS1.0、HDFS3.0)中的数据信息的访问的,于是,在通过预设文件系统插件,根据确定得到的版本信息,访问相应的HDFS中的数据信息之前,可以预先配置工作模式与类加载器之间的第三预设对应关系,其中,工作模式与类加载器之间是一一对应的,例如工作模式1对应类加载器1,即工作模式1与类加载器1一一对应,又例如工作模式3对应类加载器3,即工作模式3与类加载器3一一对应。Specifically, the preset file system plug-in realizes the access to the data information in the compatible version of HDFS (such as HDFS1.0, HDFS3.0) by means of reflection through the corresponding class loader. Assuming that the file system plug-in, according to the determined version information, before accessing the corresponding data information in HDFS, the third preset correspondence between the working mode and the class loader can be pre-configured, wherein the working mode and the class loader are related. There is a one-to-one correspondence, for example, working mode 1 corresponds to class loader 1, that is, working mode 1 corresponds to class loader 1 one-to-one, and for example, working mode 3 corresponds to class loader 3, that is, working mode 3 and class loader 3 One-to-one correspondence.
进一步地,客户端根据访问路径与工作模式间的第一预设对应关系,确定出当前获取到的访问路径所对应的工作模式后,例如确定出当前获取到的访问路径所对应的工作模式为工作模式1,接着客户端可以根据工作模式与HDFS的版本信息之间的第二预设对应关系,确定出当前工作模式(例如工作模式1)所对应的HDFS的版本信息(例如1.0版本),即工作模式1对应于HDFS1.0,再接着客户端可以根据工作模式与类加载器之间的第三预设对应关系,确定出当前工作模式(例如工作模式1)所对应的类加载器(例如类加载器1),即工作模式1对应于HDFS1.0,且工作模式1对应类加载器1。Further, after the client determines the working mode corresponding to the currently obtained access path according to the first preset correspondence between the access path and the working mode, for example, it is determined that the working mode corresponding to the currently obtained access path is: Working mode 1, then the client can determine the version information of HDFS (eg version 1.0) corresponding to the current working mode (eg working mode 1) according to the second preset correspondence between the working mode and the version information of HDFS, That is, the working mode 1 corresponds to HDFS 1.0, and then the client can determine the class loader ( For example, class loader 1), that is, working mode 1 corresponds to HDFS 1.0, and working mode 1 corresponds to class loader 1.
进一步地,类加载器是以反射的方式,通过加载待兼容版本的HDFS(例如HDFS1.0)的Java档案文件包,来实现对兼容版本的HDFS(例如HDFS1.0)中的数据信息的访问的,于是,可以根据上述确定出的对应关系(即工作模式1对应于HDFS1.0,且工作模式1对应类加载器1),通过类加载器1以反射的方式,加载待兼容版本的HDFS(例如HDFS1.0)的Java档案文件包,再根据Java档案文件包,访问相应版本的HDFS(例如HDFS1.0)中的数据信息。Further, the class loader implements the access to the data information in the compatible version of HDFS (for example, HDFS 1.0) by loading the Java archive file package of the compatible version of HDFS (for example, HDFS 1.0) in a reflection manner. Therefore, according to the corresponding relationship determined above (that is, the working mode 1 corresponds to HDFS1.0, and the working mode 1 corresponds to the class loader 1), the HDFS of the to-be-compatible version can be loaded through the class loader 1 by reflection (for example, HDFS1.0) Java archive file package, and then access data information in the corresponding version of HDFS (for example, HDFS1.0) according to the Java archive file package.
对于本申请实施例,通过引入相关Java档案文件包及更改配置的方式,实现上层应用使用统一客户端,无感知情况下读/写不同版本的HDFS中的数据信息,并能够在HDFS迁移时实现数据连通。For the embodiments of the present application, by introducing the relevant Java archive file package and changing the configuration, the upper-layer application can use the unified client to read/write data information in different versions of HDFS without perception, and can be implemented during HDFS migration. data connectivity.
实施例四Embodiment 4
本申请实施例提供了另一种可能的实现方式,在实施例一至实施例三的基础上,还包括实施例四所示的方法,其中,The embodiment of the present application provides another possible implementation manner, and on the basis of the first embodiment to the third embodiment, the method shown in the fourth embodiment is also included, wherein,
还包括步骤S130(图中未标注):如果工作模式是预设工作模式,则根据第二预设对应关系,直接加载相应版本信息的文件系统的Java档案文件包,以访问该文件系统中的数据信息。Also includes step S130 (not marked in the figure): if the working mode is a preset working mode, then according to the second preset corresponding relationship, directly load the Java archive file package of the file system of the corresponding version information to access the file system in the file system. Data information.
具体地,客户端开发过程中,可以预设一个默认的工作模式,例如,客户端默认对应的工作模式为工作模式2,该工作模式2即为客户端的预设工作模式,即客户端是默认基于工作模式2来访问对应版本的HDFS中的数据信息,例如客户端默认基于工作模式2,访问HDFS2.0中的数据信息。Specifically, during the client development process, a default working mode can be preset. For example, the default working mode corresponding to the client is working mode 2, and the working mode 2 is the default working mode of the client, that is, the client is the default working mode. Access data information in the corresponding version of HDFS based on work mode 2. For example, the client accesses data information in HDFS 2.0 based on work mode 2 by default.
进一步地,客户端可以根据文件系统(例如FileSystem)这一接口来判断当前获取到的访问路径所对应的工作模式是否为预设工作模式,如果当前获取到的访问路径所对应的工作模式是预设工作模式,例如,当前获取到的访问路径所对应的工作模式是工作模式2(预设工作模式),则根据上述的第二预设对应关系,可以确定客户端默认访问的是HDFS2.0中的数据信息。此时,客户端无法借助于任何插件或类加载器,即可直接加载相应版本信息的HDFS的Java档案文件包,直接访问该HDFS2.0中的数据信息。Further, the client can judge whether the working mode corresponding to the currently obtained access path is the preset working mode according to the interface of the file system (eg FileSystem), if the working mode corresponding to the currently obtained access path is the preset working mode. Assume the working mode, for example, the working mode corresponding to the currently obtained access path is working mode 2 (preset working mode), then according to the above-mentioned second preset correspondence, it can be determined that the default access of the client is HDFS2.0 data information in . At this time, the client cannot directly load the Java archive file package of HDFS with the corresponding version information by means of any plug-in or class loader, and directly access the data information in the HDFS 2.0.
进一步地,图2给出了上述实施例一至实施例四的客户端访问相应版本的HDFS中的数据信息的过程示意图,在图2中,整个大框代表客户端访问HDFS中的数据信息时的内部执行过程,其中,该客户端默认的工作模式为工作模式2,即默认直接访问HDFS2.0中的数据信息,并且可以向前兼容访问HDFS1.0中的数据信息,以及向后兼容访问HDFS3.0中的数据信息,从而实现了通过同一个客户端对HDFS的向前版本(例如HDFS1.0)的兼容访问以及向后版本(例如HDFS3.0)的兼容访问,因而无需在同一台机器中为每一个版本的HDFS部署对应版本的客户端,例如为HDFS1.0部署对应的客户端1.0,又例如为HDFS2.0部署对应的客户端2.0。Further, FIG. 2 shows a schematic diagram of the process of the client accessing the data information in the corresponding version of HDFS according to the above-mentioned Embodiments 1 to 4. In FIG. 2, the entire large frame represents the process when the client accesses the data information in HDFS. The internal execution process, in which the default working mode of the client is working mode 2, that is, it directly accesses the data information in HDFS2.0 by default, and can access data information in HDFS1.0 forward-compatible and backward-compatible to access HDFS3 .0, so as to achieve compatible access to the forward version of HDFS (such as HDFS1.0) and backward version (such as HDFS3.0) through the same client, so there is no need to use the same machine. For each version of HDFS, deploy the corresponding version of the client, for example, deploy the corresponding client 1.0 for HDFS1.0, or deploy the corresponding client 2.0 for HDFS2.0.
进一步地,上述实施例一至实施例四中的技术方案可以概括为:通过引入FileSystem(即上述的文件系统)的新的实现类SpinnerFileSystem(即上述的预设文件系统插件),实现了对应不同版本HDFS访问的兼容,其中,具体策略如下:Further, the technical solutions in the above-mentioned Embodiments 1 to 4 can be summarized as: by introducing a new implementation class SpinnerFileSystem (that is, the above-mentioned preset file system plug-in) of FileSystem (that is, the above-mentioned file system), corresponding different versions are realized. Compatible with HDFS access, the specific policies are as follows:
(1)通过ViewFs(视图文件系统)配置不同版本的HDFS,其中,不同版本的HDFS采用不同的Schema(即上述的工作模式)。(1) Configure different versions of HDFS through ViewFs (view file system), wherein different versions of HDFS use different Schemas (ie, the above working modes).
(2)为待兼容的HDFS的Schema配置SpinnerFileSystem的相应实现。(2) Configure the corresponding implementation of SpinnerFileSystem for the schema of HDFS to be compatible.
(3)在SpinnerFileSystem中,通过不同的ClassLoader(即上述的类加载器),以反射的方式根据Schema加载不同版本的HDFS所对应的实现JAR包(即上述的Java档案文件包),从而将现有版本的方法接口实现,通过反射的方式传递至相应版本的JAR中,实现客户端对HDFS1.0、HDFS3.0等的访问逻辑、序列化及RPC(Remote Procedure Call Protocol,远程过程调用协议)框架的兼容。(3) In SpinnerFileSystem, through different ClassLoaders (that is, the above-mentioned class loader), the implementation JAR package (that is, the above-mentioned Java archive file package) corresponding to different versions of HDFS is loaded according to the Schema through reflection, so as to There is a version of the method interface implementation, which is passed to the corresponding version of the JAR through reflection to realize the client's access logic, serialization and RPC (Remote Procedure Call Protocol) to HDFS1.0, HDFS3.0, etc. Compatible with the framework.
实施例五Embodiment 5
图3为本申请实施例提供的一种数据访问装置的结构示意图,如图3所示,该装置30可以包括确定模块31与第一处理模块32;其中,FIG. 3 is a schematic structural diagram of a data access apparatus provided by an embodiment of the present application. As shown in FIG. 3 , the apparatus 30 may include a determination module 31 and a first processing module 32; wherein,
确定模块31用于基于访问路径与工作模式间的第一预设对应关系,确定当前获取到的访问路径所对应的工作模式;The determining module 31 is configured to determine the working mode corresponding to the currently obtained access path based on the first preset correspondence between the access path and the working mode;
第一处理模块32用于当工作模式不是预设工作模式时,通过预设文件系统插件,根据工作模式访问相应版本的文件系统中的数据信息。The first processing module 32 is configured to access the data information in the file system of the corresponding version according to the working mode through the preset file system plug-in when the working mode is not the preset working mode.
具体地,还包括第一配置模块33,如图4所示,其中,第一配置模块33用于配置工作模式与文件系统的版本信息之间的第二预设对应关系。Specifically, a first configuration module 33 is further included, as shown in FIG. 4 , wherein the first configuration module 33 is configured to configure the second preset correspondence between the working mode and the version information of the file system.
进一步地,第一处理模块32包括版本确定子模块321与数据访问子模块322,如图4所示,其中,Further, the first processing module 32 includes a version determination sub-module 321 and a data access sub-module 322, as shown in FIG. 4 , wherein,
版本确定子模块321用于根据第二预设对应关系,确定工作模式对应的文件系统的版本信息;The version determination submodule 321 is configured to determine the version information of the file system corresponding to the working mode according to the second preset correspondence;
数据访问子模块322用于通过预设文件系统插件,根据确定得到的版本信息,访问相应的文件系统中的数据信息。The data access sub-module 322 is configured to access the data information in the corresponding file system through the preset file system plug-in and according to the determined version information.
进一步地,还包括第二配置模块34,如图4所示,其中,第二配置模块34用于配置工作模式与类加载器之间的第三预设对应关系。Further, a second configuration module 34 is also included, as shown in FIG. 4 , wherein the second configuration module 34 is configured to configure the third preset correspondence between the working mode and the class loader.
进一步地,数据访问子模块322包括类加载器确定子单元3221、加载子单元3222与数据访问子单元3223,如图4所示,其中,Further, the data access submodule 322 includes a class loader determination subunit 3221, a loading subunit 3222 and a data access subunit 3223, as shown in FIG. 4, wherein,
类加载器确定子单元3221用于根据第三预设对应关系,确定与工作模式相对应的类加载器;The class loader determination subunit 3221 is configured to determine the class loader corresponding to the working mode according to the third preset correspondence;
加载子单元3222用于通过预设文件系统插件,根据确定得到的类加载器加载版本信息对应的文件系统的Java档案文件包;The loading subunit 3222 is used to load the Java archive file package of the file system corresponding to the version information according to the determined class loader through the preset file system plug-in;
数据访问子单元3223用于根据Java档案文件包,访问文件系统中的数据信息。The data access subunit 3223 is used to access data information in the file system according to the Java archive file package.
进一步地,加载子单元3221具体用于类加载器通过反射的方式,来加载版本信息对应的文件系统的Java档案文件包。Further, the loading subunit 3221 is specifically used for the class loader to load the Java archive file package of the file system corresponding to the version information by means of reflection.
进一步地,还包括第二处理模块35,如图4所示,其中,第二获取模块35用于当工作模式是预设工作模式时,根据第二预设对应关系,直接加载相应版本信息的文件系统的Java档案文件包,以访问该文件系统中的数据信息。Further, it also includes a second processing module 35, as shown in FIG. 4, wherein the second acquisition module 35 is used to directly load the corresponding version information according to the second preset corresponding relationship when the working mode is the preset working mode. A Java archive file package for a file system to access data information in that file system.
进一步地,文件系统为分布式文件系统HDFS。Further, the file system is a distributed file system HDFS.
本申请实施例提供的装置,与现有技术相比,基于访问路径与工作模式间的第一预设对应关系,确定当前获取到的访问路径所对应的工作模式,为后续根据工作模式获取相应版本的文件系统中的数据信息提供前提保障;当工作模式不是预设工作模式时,通过预设文件系统插件,根据工作模式对相应版本的文件系统中的数据信息进行处理,从而能够基于同一客户端,通过预设文件系统插件,来访问任一版本的文件系统,即在对上层应用透明的情况下,实现了通过同一客户端对各个版本的文件系统的访问兼容,不仅有效避免了通过相应版本的客户端访问与其对应的文件系统的繁琐操作,而且在实现兼容访问的过程,无需将其它版本的文件系统中的数据拷贝到当前版本的文件系统中,降低操作复杂度,提高数据访问效率。Compared with the prior art, the apparatus provided by the embodiment of the present application determines the working mode corresponding to the currently obtained access path based on the first preset correspondence between the access path and the working mode, and obtains the corresponding working mode according to the working mode in the future. The data information in the file system of the version provides the premise guarantee; when the working mode is not the preset working mode, the data information in the file system of the corresponding version is processed according to the working mode through the preset file system plug-in, so that it can be based on the same client The client can access any version of the file system through the preset file system plug-in, that is, in the case of being transparent to the upper-layer application, the access compatibility of the file systems of various versions through the same client is realized, which not only effectively avoids the need to pass the corresponding The tedious operation of the version of the client to access its corresponding file system, and in the process of achieving compatible access, there is no need to copy the data in other versions of the file system to the current version of the file system, reducing operational complexity and improving data access efficiency. .
实施例六Embodiment 6
本申请实施例提供了一种电子设备,如图5所示,图5所示的电子设备500包括:处理器501和存储器503。其中,处理器501和存储器503相连,如通过总线502相连。进一步地,电子设备500还可以包括收发器504。需要说明的是,实际应用中收发器504不限于一个,该电子设备500的结构并不构成对本申请实施例的限定。An embodiment of the present application provides an electronic device. As shown in FIG. 5 , the electronic device 500 shown in FIG. 5 includes: a processor 501 and a memory 503 . The processor 501 is connected to the memory 503 , for example, through a bus 502 . Further, the electronic device 500 may also include a transceiver 504 . It should be noted that in practical applications, the transceiver 504 is not limited to one, and the structure of the electronic device 500 does not constitute a limitation to the embodiments of the present application.
其中,处理器501应用于本申请实施例中,用于实现图3或图4所示的确定模块与第一处理模块的功能,以及图4所示的第一配置模块、第二配置模块及第二处理模块的功能。The processor 501 is used in the embodiment of the present application to implement the functions of the determination module and the first processing module shown in FIG. 3 or FIG. 4 , and the first configuration module, the second configuration module and the The function of the second processing module.
处理器501可以是CPU,通用处理器,DSP,ASIC,FPGA或者其他可编程逻辑器件、晶体管逻辑器件、硬件部件或者其任意组合。其可以实现或执行结合本申请公开内容所描述的各种示例性的逻辑方框,模块和电路。处理器501也可以是实现计算功能的组合,例如包含一个或多个微处理器组合,DSP和微处理器的组合等。The processor 501 may be a CPU, a general purpose processor, a DSP, an ASIC, an FPGA or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various exemplary logical blocks, modules and circuits described in connection with this disclosure. The processor 501 can also be a combination that realizes computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
总线502可包括一通路,在上述组件之间传送信息。总线502可以是PCI总线或EISA总线等。总线502可以分为地址总线、数据总线、控制总线等。为便于表示,图5中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 502 may include a path to communicate information between the components described above. The bus 502 may be a PCI bus, an EISA bus, or the like. The bus 502 can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 5, but it does not mean that there is only one bus or one type of bus.
存储器503可以是ROM或可存储静态信息和指令的其他类型的静态存储设备,RAM或者可存储信息和指令的其他类型的动态存储设备,也可以是EEPROM、CD-ROM或其他光盘存储、光碟存储(包括压缩光碟、激光碟、光碟、数字通用光碟、蓝光光碟等)、磁盘存储介质或者其他磁存储设备、或者能够用于携带或存储具有指令或数据结构形式的期望的程序代码并能够由计算机存取的任何其他介质,但不限于此。The memory 503 can be ROM or other types of static storage devices that can store static information and instructions, RAM or other types of dynamic storage devices that can store information and instructions, or EEPROM, CD-ROM or other optical disk storage, optical disk storage. (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or capable of carrying or storing desired program code in the form of instructions or data structures and capable of being executed by a computer Access any other medium without limitation.
存储器503用于存储执行本申请方案的应用程序代码,并由处理器501来控制执行。处理器501用于执行存储器503中存储的应用程序代码,以实现图3或图4所示实施例提供的数据访问装置的动作。The memory 503 is used for storing application program codes for executing the solution of the present application, and the execution is controlled by the processor 501 . The processor 501 is configured to execute the application program code stored in the memory 503, so as to realize the action of the data access apparatus provided by the embodiment shown in FIG. 3 or FIG. 4 .
本申请实施例提供的电子设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行程序时,与现有技术相比,可实现:基于访问路径与工作模式间的第一预设对应关系,确定当前获取到的访问路径所对应的工作模式,为后续根据工作模式获取相应版本的HDFS中的数据信息提供前提保障;当工作模式不是预设工作模式时,通过预设文件系统插件,根据工作模式对相应版本的文件系统中的数据信息进行处理,从而能够基于同一客户端,通过预设文件系统插件,来访问任一版本的文件系统,即在对上层应用透明的情况下,实现了通过同一客户端对各个版本的文件系统的访问兼容,不仅有效避免了通过相应版本的客户端访问与其对应的文件系统的繁琐操作,而且在实现兼容访问的过程,无需将其它版本的文件系统中的数据拷贝到当前版本的文件系统中,降低操作复杂度,提高数据访问效率。The electronic device provided by the embodiments of the present application includes a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the program, compared with the prior art, it can realize: based on the access path and the The first preset correspondence between the working modes determines the working mode corresponding to the currently obtained access path, and provides a prerequisite for the subsequent acquisition of data information in the corresponding version of HDFS according to the working mode; when the working mode is not the preset working mode When the file system is preset, the data information in the corresponding version of the file system can be processed according to the working mode, so that any version of the file system can be accessed based on the same client through the preset file system plug-in. In the case of being transparent to the upper-layer application, the access compatibility of the file systems of various versions through the same client is realized, which not only effectively avoids the tedious operation of accessing the corresponding file system through the client of the corresponding version, but also realizes the compatible access. In the process, there is no need to copy the data in the file system of other versions to the file system of the current version, which reduces the operation complexity and improves the data access efficiency.
本申请实施例提供了一种计算机可读存储介质,该计算机可读存储介质上存储有计算机程序,该程序被处理器执行时实现实施例一所示的方法。与现有技术相比,基于访问路径与工作模式间的第一预设对应关系,确定当前获取到的访问路径所对应的工作模式,为后续根据工作模式获取相应版本的文件系统中的数据信息提供前提保障;当工作模式不是预设工作模式时,通过预设文件系统插件,根据工作模式对相应版本的文件系统中的数据信息进行处理,从而能够基于同一客户端,通过预设文件系统插件,来访问任一版本的文件系统,即在对上层应用透明的情况下,实现了通过同一客户端对各个版本的文件系统的访问兼容,不仅有效避免了通过相应版本的客户端访问与其对应的文件系统的繁琐操作,而且在实现兼容访问的过程,无需将其它版本的文件系统中的数据拷贝到当前版本的文件系统中,降低操作复杂度,提高数据访问效率。An embodiment of the present application provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the program is executed by a processor, the method shown in the first embodiment is implemented. Compared with the prior art, based on the first preset correspondence between the access path and the working mode, the working mode corresponding to the currently obtained access path is determined, and the data information in the file system of the corresponding version is subsequently obtained according to the working mode. Provide prerequisite guarantee; when the working mode is not the preset working mode, the data information in the file system of the corresponding version can be processed according to the working mode through the preset file system plug-in, so that it can be based on the same client, through the preset file system plug-in , to access any version of the file system, that is, in the case of being transparent to the upper-layer application, it realizes the access compatibility of each version of the file system through the same client, which not only effectively avoids the corresponding version of the client to access the corresponding file system. The tedious operation of the file system, and in the process of realizing compatible access, there is no need to copy the data in the file system of other versions to the file system of the current version, which reduces the operation complexity and improves the data access efficiency.
本申请实施例提供的计算机可读存储介质适用于上述方法的任一实施例。在此不再赘述。The computer-readable storage medium provided by the embodiment of the present application is applicable to any embodiment of the foregoing method. It is not repeated here.
应该理解的是,虽然附图的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,附图的流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowchart of the accompanying drawings are sequentially shown in the order indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order and may be performed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times, and the execution sequence is also It does not have to be performed sequentially, but may be performed alternately or alternately with other steps or at least a portion of sub-steps or stages of other steps.
以上所述仅是本申请的部分实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above are only part of the embodiments of the present application. It should be pointed out that for those skilled in the art, without departing from the principles of the present application, several improvements and modifications can also be made. It should be regarded as the protection scope of this application.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810924374.0A CN109344140A (en) | 2018-08-14 | 2018-08-14 | Data access method, device, electronic device and computer storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810924374.0A CN109344140A (en) | 2018-08-14 | 2018-08-14 | Data access method, device, electronic device and computer storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109344140A true CN109344140A (en) | 2019-02-15 |
Family
ID=65296850
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810924374.0A Pending CN109344140A (en) | 2018-08-14 | 2018-08-14 | Data access method, device, electronic device and computer storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109344140A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110688674A (en) * | 2019-09-23 | 2020-01-14 | 中国银联股份有限公司 | An access docking device, a system, and a method and device for applying the access docking device |
CN114500485A (en) * | 2022-01-28 | 2022-05-13 | 北京沃东天骏信息技术有限公司 | Data processing method and device |
CN119025477A (en) * | 2024-10-23 | 2024-11-26 | 宁波银行股份有限公司 | NAS file system management method, device, container cloud platform and medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101459669A (en) * | 2008-12-29 | 2009-06-17 | 成都市华为赛门铁克科技有限公司 | Access method and apparatus for network file system |
US8533231B2 (en) * | 2011-08-12 | 2013-09-10 | Nexenta Systems, Inc. | Cloud storage system with distributed metadata |
CN104699723A (en) * | 2013-12-10 | 2015-06-10 | 北京神州泰岳软件股份有限公司 | Data exchange adapter and system and method for synchronizing data among heterogeneous systems |
CN104750937A (en) * | 2015-04-08 | 2015-07-01 | 西安电子科技大学 | Integrated circuit layout conversion method based on Hadoop |
-
2018
- 2018-08-14 CN CN201810924374.0A patent/CN109344140A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101459669A (en) * | 2008-12-29 | 2009-06-17 | 成都市华为赛门铁克科技有限公司 | Access method and apparatus for network file system |
US8533231B2 (en) * | 2011-08-12 | 2013-09-10 | Nexenta Systems, Inc. | Cloud storage system with distributed metadata |
CN104699723A (en) * | 2013-12-10 | 2015-06-10 | 北京神州泰岳软件股份有限公司 | Data exchange adapter and system and method for synchronizing data among heterogeneous systems |
CN104750937A (en) * | 2015-04-08 | 2015-07-01 | 西安电子科技大学 | Integrated circuit layout conversion method based on Hadoop |
Non-Patent Citations (1)
Title |
---|
ITEYE_9550: "HDFS:解决HDFS跨版本兼容问题", 《HTTPS://BLOG.CSDN.NET/ITEYE_9550/ARTICLE/DETAILS/82140892》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110688674A (en) * | 2019-09-23 | 2020-01-14 | 中国银联股份有限公司 | An access docking device, a system, and a method and device for applying the access docking device |
CN110688674B (en) * | 2019-09-23 | 2024-04-26 | 中国银联股份有限公司 | Access dockee, system and method and device for applying access dockee |
CN114500485A (en) * | 2022-01-28 | 2022-05-13 | 北京沃东天骏信息技术有限公司 | Data processing method and device |
CN119025477A (en) * | 2024-10-23 | 2024-11-26 | 宁波银行股份有限公司 | NAS file system management method, device, container cloud platform and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9558216B2 (en) | Moving tables across nodes in an in-memory database instance | |
CN112148678B (en) | A file access method, system, device and medium | |
CN104866778A (en) | A method and device for document security access control based on Linux kernel | |
WO2019085780A1 (en) | Cloud storage system and method for achieving user-defined data processing in cloud storage system | |
CN117075930B (en) | A computing framework management system | |
CN109344140A (en) | Data access method, device, electronic device and computer storage medium | |
CN110928935A (en) | Data access command processing method, device and system | |
US11748110B2 (en) | Server with setup menu for the bios settings | |
CN114691309A (en) | Batch business processing system, method and device | |
CN111294377B (en) | Dependency network request sending method, terminal device and storage medium | |
CN112698962A (en) | Data processing method and device, electronic equipment and storage medium | |
CN111580948A (en) | Task scheduling method, device and computer equipment | |
CN117687703A (en) | Server startup methods, devices, systems, storage media and electronic equipment | |
CN114328453A (en) | KV database data management method, device, computing device and storage medium | |
US8626917B2 (en) | File access using counter locking mechanism | |
CN114625402A (en) | Application update method, apparatus, electronic device, and computer-readable storage medium | |
US12073263B1 (en) | Dynamic processing of API requests | |
WO2015165057A1 (en) | Method and device for hard disk drive to execute application code | |
CN107480210B (en) | Memory data operation method and device | |
CN110209347A (en) | A kind of retrospective date storage method | |
US20060206453A1 (en) | Dynamically Sizing Buffers to Optimal Size in Network Layers When Supporting Data Transfers Related to Database Applications | |
CN115756549A (en) | Method and device for downloading data of big data middlebox and storage medium | |
CN117667437A (en) | A file copying method, device and electronic equipment | |
CN116931817A (en) | Processing method, device and processor for vehicle configuration data | |
CN114416782A (en) | A data query method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190215 |
|
RJ01 | Rejection of invention patent application after publication |