WO2019223601A1 - Database system, and establishment method and apparatus therefor - Google Patents

Database system, and establishment method and apparatus therefor Download PDF

Info

Publication number
WO2019223601A1
WO2019223601A1 PCT/CN2019/087242 CN2019087242W WO2019223601A1 WO 2019223601 A1 WO2019223601 A1 WO 2019223601A1 CN 2019087242 W CN2019087242 W CN 2019087242W WO 2019223601 A1 WO2019223601 A1 WO 2019223601A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
information
database table
storage system
database
Prior art date
Application number
PCT/CN2019/087242
Other languages
French (fr)
Chinese (zh)
Inventor
李金龙
Original Assignee
杭州海康威视数字技术股份有限公司
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 杭州海康威视数字技术股份有限公司 filed Critical 杭州海康威视数字技术股份有限公司
Publication of WO2019223601A1 publication Critical patent/WO2019223601A1/en

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/18File system types
    • G06F16/182Distributed file systems

Definitions

  • the present application relates to the field of communications, and in particular, to a database system and a method and device for establishing the database system.
  • the system includes a database layer and a fusion layer.
  • the database layer includes multiple databases and database agents.
  • a read request can be sent to the fusion layer, and the fusion layer forwards the read request to the database agent.
  • the database agent reads data from the multiple databases and sends the data read from each database to the fusion layer.
  • the fusion layer integrates the data from each database before sending it out.
  • Each database in the database has its own corresponding service.
  • the fusion layer accesses each database through a database agent, it may affect the services corresponding to the database to access the database.
  • the embodiments of the present application provide a database system and a method and device for establishing the database system, so as to avoid affecting the original service corresponding to the database from accessing the database.
  • the technical solution is as follows:
  • an embodiment of the present application provides a database system, including:
  • a storage layer and a source data layer including a first storage system and a second storage system, the source data layer including a plurality of databases, each of the plurality of databases including at least one database table, the Each database table included in each database is used to store data;
  • the first storage system is configured to store data stored in each database table included in each database
  • the second storage system is configured to store structure information corresponding to a target database table and store a correspondence between an identifier of the structure information and location information, where the location information includes data included in the target database table in the first A storage location in a storage system, the structure information includes each data item in the target database table, and the target database table is a database table in any one of the plurality of databases.
  • the first storage system is HDFS
  • the second storage system is RDMS.
  • the database type included in the source data layer is one or more of Oracle, MySQL, and HDFS.
  • the embodiment of the present application provides a method for establishing a database system, where the database system is one of the optional systems described above on the one hand or on the other hand;
  • the method includes:
  • the identifier of the structural information and the location information of the data in the target database table in the first storage system are correspondingly stored in a correspondence between the identifier and the location information in the second storage system.
  • the method further includes:
  • Periodically or irregularly read data in the target database table and obtain position information corresponding to the target database table from the correspondence between the identifier and location information according to the identifier of the structure information of the target database table, according to The location information determines data included in the target database table stored in the first storage system, and replaces data included in the target database table stored in the first storage system with the read target Data in a database table.
  • the method further includes:
  • query data corresponding to the search information in the storage layer According to the search information to be queried, query data corresponding to the search information in the storage layer.
  • the querying data corresponding to the search information in the storage layer according to the search information to be queried includes:
  • the embodiment of the present application provides a device for establishing a database system, where the database system is an optional system on the one hand or any one of the aspects;
  • the device includes:
  • a reading module configured to read the structure information of the target database table and the data in the target database table
  • a storage module configured to store the structure information in the second storage system, store data in the target database table in the first storage system, and store the identifier of the structure information and the target database table
  • the position information of the data in the first storage system is correspondingly stored in the correspondence between the identifier and the position information in the second storage system.
  • the device further includes:
  • the query module is configured to query data corresponding to the search information in the storage layer according to the search information to be queried.
  • the query module includes: a determination unit, an acquisition unit, and a query unit;
  • the determining unit is configured to determine a target data item to which the search information to be queried belongs;
  • the obtaining unit is configured to obtain structure information including the target data item from the second storage system; and obtain corresponding position information from the second storage system according to an identifier of the structure information;
  • the determining unit is further configured to determine a corresponding database table according to the location information
  • the query unit is configured to query data corresponding to the search information in the database table according to the search information.
  • each database is queried
  • the first storage system can be queried according to the structural information in the second storage system, so that it is not necessary to query the databases in the source data layer, and it will not affect the original business access database corresponding to each database.
  • FIG. 1-1 is a schematic structural diagram of a database system according to an embodiment of the present application.
  • FIG. 1-2 is a schematic structural diagram of another database system according to an embodiment of the present application.
  • FIG. 2-1 is a flowchart of a method for establishing a database system according to an embodiment of the present application
  • FIG. 3 is a schematic structural diagram of an apparatus for establishing a database system according to an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a terminal according to an embodiment of the present application.
  • an embodiment of the present application provides a database system, including:
  • Storage tier 1 and source data tier 2 includes a first storage system 11 and a second storage system 12.
  • Source data tier 2 includes multiple databases. Each of the multiple databases includes at least one database table. Each database table included in each database is used to store data;
  • the first storage system 11 is configured to store data stored in each database table included in each database;
  • the second storage system 12 is configured to store structure information corresponding to the target database table and store a correspondence between an identifier of the structure information and location information, where the location information includes data included in the target database table in the first storage system 11. Storage location, the structure information includes each data item in the target database table, and the target database table is a database table in any one of the multiple databases.
  • the storage location may include a start storage location and an end storage location of the data of the target database table in the first storage system 11.
  • the storage location may be a starting storage location of data of the target database table in the first storage system 11, but the location information may further include an amount of data in the target database.
  • the database table For each database table included in each database in the source data layer 2, the database table includes multiple data items, each data item in the database table corresponds to a column, and the column corresponding to the data item is used to store the data item The data. For example, see the database table shown in Table 1 below.
  • the database table is a household registration information table for storing household registration information of a user.
  • the household registration information table includes four data items, which are "identity card number”, “name”, “hukou address” and “nation”, and the corresponding column of the data item "identity card number” in the household registration information table is used to store each
  • the user's ID number the column corresponding to the data item "name” is used to store the name of each user, the column corresponding to the data item “account address” is used to store the account address of each user, and the column corresponding to the data item "nation” For storing the nationalities of each user.
  • Table 1 is the household registration information form
  • the database table is an education information table for storing the user's education information.
  • the education information table includes four data items, which are "ID number”, “Name”, “Education” and “School”.
  • the corresponding column of the data item "ID number” in the education information table is used to store each user.
  • ID number, the column corresponding to the data item "name” is used to store the name of each user, the column corresponding to the data item "education” is used to store the user's education, and the column corresponding to the data item "school” is used to store each user The user's school.
  • Table 2 is the academic information table
  • the first storage system 11 is configured to store data in the household registration information table shown in Table 1 and to store data in the academic information table shown in Table 2.
  • the first storage system 11 may not save each data item stored in the first row of the household registration information table, and may not save each data item stored in the first row of the academic information table.
  • the second storage system 12 is used to store the structural information corresponding to the household registration information table.
  • the structural information includes data items "ID card number”, “name”, and “hukou” in the household registration information table.
  • the second storage system 12 is further configured to store the correspondence between the identifier and the location information, where the correspondence includes the first record corresponding to the household registration information table and the second record corresponding to the academic information table.
  • the first record includes the identification ID1 of the structural information corresponding to the household registration information table and the position information Position1 of the data included in the household registration information table in the first storage system 11; and the second record includes the identification ID2 of the structural information corresponding to the academic information table and the academic qualifications Position information Position2 of the data included in the information table in the first storage system 11.
  • the embodiment of the present application further provides: an acquisition conversion layer 3, and the acquisition conversion layer 3 includes at least one establishment device;
  • the establishment device is configured to read the structure information of the target database table and the data in the target database table, store the structure information in the second storage system 12, and store the data in the target database table in the first storage system 11. ,
  • the identifier of the structural information and the position information of the data in the target database table in the first storage system 11 are correspondingly stored in the correspondence between the identifier and the position information in the second storage system 12.
  • the establishment device is further configured to read the data in the target database table from the source data layer 2 periodically or irregularly, and according to the identification of the structure information of the target database table, the correspondence between the identification in the second storage system 12 and the location information
  • the position information corresponding to the target database table is obtained in the relationship, and the data included in the target database table stored in the first storage system 11 is determined according to the position information, and the data included in the target database table stored in the first storage system 11 is replaced by reading Take the data from the target database table.
  • the establishment device may also obtain the data in the target data table again.
  • the location information in the first storage system 11 is replaced with the newly acquired location information in the correspondence between the identifier and the location information stored in the second storage system 11.
  • the databases in the source data layer 2 may belong to different database types.
  • the source database layer 2 may have at least one database whose database type is Oracle, there may be at least one database whose database type is MySQL, and / or, there may be at least one database whose database type is Hadoop Distributed File System (Hadoop Distributed File System) File System, HDFS).
  • Oracle database whose database type is Oracle
  • MySQL database whose database type is MySQL
  • HDFS Hadoop Distributed File System
  • the collection and conversion layer 3 may include a building device corresponding to each database type in at least one database type; for the building device corresponding to each database type, the building device is configured to determine a database belonging to the database type from the source data layer 2, For any database table in the database (referred to as the target database table), obtain the structure information of the target database table, and store the structure information in the second storage system 12, obtain the data in the target database table, and save the target database.
  • the data in the table is stored in the first storage system 11 and the position information of the data in the first storage system 11 is obtained, and the identifier of the structural information and the position information are correspondingly stored in the identifier and the position information of the second storage system 12 Corresponding relationship.
  • Each establishment in the acquisition and conversion layer 3 presets a scheme for reading the structure of the analysis database and a scheme for reading the data.
  • the establishment apparatus may use the scheme to analyze the structure of the database belonging to its corresponding database type and from the database. Read data from the database.
  • Each establishment device in the acquisition conversion layer 3 may be set in advance by a technician.
  • a technician can design a building device corresponding to the database type, and add the building device to the acquisition conversion layer 3.
  • the first storage system 11 may be HDFS
  • the second storage system 12 may be a relational database management system (Relational Data (base) Management System (RDMS)).
  • RDMS Relational Data Management System
  • the database type included in the source data layer 2 may be one or more of Oracle, MySQL, and HDFS.
  • data in each data table in each database table in the active data layer is stored in the first storage system, and storage corresponding to each database table is stored in the second storage system. Items, so that when querying data in each database, you can query the first storage system according to each storage item in the second storage system, so there is no need to query each database in the source data layer, so that each database in the source data layer The corresponding original business access to each database in the source data layer will not affect the original business access database corresponding to each database.
  • An embodiment of the present application provides a method for establishing a database system.
  • the system includes a storage layer and a source data layer.
  • the storage layer includes a first storage system and a second storage system.
  • the source data layer includes multiple databases and multiple databases.
  • Each database in the database includes at least one database table, and each database table included in each database is used to store data.
  • the execution body of the method may be an establishment device for any one of the acquisition conversion layers shown in FIG. 1-2, including:
  • Step 201 Obtain structural information corresponding to the target database table, where the structural information includes each data item in the target database table, and the target database table is a database table in a database in the source data layer.
  • the establishment device corresponds to at least one database type, determines a database belonging to its corresponding database type from the databases included in the source data layer, and selects any database table in the database as the target data Table, and then proceed from this step.
  • each database table included in each database in the source data layer includes multiple data items.
  • Each data item in the database table corresponds to a column, and the corresponding column of the data item is used to store data belonging to the data item.
  • the database table is a household registration information table for storing household registration information of a user.
  • the household registration information table includes four data items, which are "identity card number”, “name”, “hukou address” and “nation”, and the corresponding column of the data item "identity card number” in the household registration information table is used to store each
  • the user's ID number the column corresponding to the data item "name” is used to store the name of each user, the column corresponding to the data item “account address” is used to store the account address of each user, and the column corresponding to the data item "nation” For storing the nationalities of each user.
  • the database table is a degree information table for storing the user's degree information.
  • the household registration information table includes four data items, which are "ID number”, “Name”, “Education” and “School”.
  • the corresponding column of the data item "ID number” in the education information table is used to store each user.
  • ID number, the column corresponding to the data item "name” is used to store the name of each user, the column corresponding to the data item "education” is used to store the user's education, and the column corresponding to the data item "school” is used to store each user The user's school.
  • the first structure information corresponding to the household registration information table can be obtained from the household registration information table shown in Table 1, and the first structure information includes the household registration information table.
  • the data items are "identity card number”, "name”, “hukou address” and "nation".
  • the second structure information includes data items in the academic information table, which are “identity card numbers”. , "Name”, "Education” and "School”.
  • Step 202 Store the structure information in a second storage system, and obtain an identifier of the structure information.
  • an identifier for uniquely identifying the structure information may be allocated.
  • the identifier of the structure information may be sequentially assigned, or the name of the target database table and the name of the target database where the target database table is located may be obtained. According to the structure information, the name of the target database table, and the At least one, generating the identification of the structure letter.
  • a hash value may be obtained by hashing at least one of the structure information, the name of the target database table, and the name of the target database, or at least one of the structure information, the name of the target database table, and the name of the target database.
  • MD5 Message-Digest Algorithm
  • the "identity number”, “name”, “hukou address”, and “nation” included in the first structure information are stored in the second storage system, and the identification ID1 of the first structure information is assigned.
  • the “identification number”, “name”, “education”, and “school” included in the second structure information are stored in the second storage system, and the identification ID2 of the second structure information is assigned.
  • Step 203 Obtain data in the target database table, store the data in the target database table in the first storage system, and obtain position information of the data in the first storage system.
  • the data in the household registration information table shown in Table 1 is acquired, the data in the household registration information table shown in Table 1 is stored in the first storage system, and the data in the household registration information table in the first storage system is obtained.
  • the first position information includes a storage position Position1.
  • the data in the academic information table shown in Table 2 is acquired, the data in the academic information table shown in Table 2 is stored in the first storage system 11, and the data in the secondary school information table in the first storage system 11 is obtained.
  • the second position information of the data, and the second position information includes a storage position Position2.
  • Step 204 The identifier of the structural information of the target database table and the location information are correspondingly stored in a correspondence between the identifier and the location information in the second storage system.
  • the identifier ID1 of the first structure information and Position1 included in the first location information may be stored in the correspondence between the identifier and the location information in the second storage system, and the second structure information may be The position ID included in the identification ID2 and the second position information corresponds to the correspondence between the identification and the position information stored in the second storage system.
  • the data in the target database table can be read from the source data layer periodically or irregularly, and the target can be obtained from the correspondence between the identifier in the second storage system and the location information according to the identifier of the structure information of the target database table
  • the location information corresponding to the database table and based on the location information, determine the data included in the target database table stored in the first storage system, and replace the data included in the target database table stored in the first storage system with the read target database table The data.
  • the establishment device may also obtain the data in the target data table again.
  • the location information corresponding to the identifier of the structure information of the target database table is replaced with the newly acquired location information in the correspondence between the identifier and the location information stored in the second storage system.
  • a query request can be sent to the system. See Figure 2-2.
  • the system can perform the query by the following operations.
  • Step 205 Receive a query request message, where the query request message carries search information.
  • the search information belongs to at least one data item.
  • the search information is No1
  • the data item to which the search information belongs is an ID number.
  • Step 206 Query data in the storage layer according to the retrieval information.
  • This step can be implemented by the following operations from 2061 to 2064:
  • the target data item to which the search information belongs is an ID number.
  • the column corresponding to the target data item may also be determined according to the position of the target data item in the structural information.
  • the second storage system shown in Table 3 is used to query the structural information including the ID number, including the first structural information and the second structural information.
  • the structure information included in the first structure information is “ID card number”, “Name”, “Account address” and “nation”, and the position of “ID card number” in the first structure information is the first position, and it is determined accordingly.
  • the column corresponding to "ID Card Number” is the first column;
  • the structure information included in the second structure information is "ID Card Number", "Name”, “Education” and “School”, and "ID Card Number” is in the first structure
  • the position of the information is the first position, and accordingly, the column corresponding to the "ID card number” is determined as the first column.
  • the database table includes at least the retrieval information and the retrieval information. Corresponding data.
  • the corresponding column of the target data item in the database table may also be determined according to the position of the target data item in the structural information.
  • the corresponding position information Position1 is obtained from the correspondence between the identifier and the position information shown in Table 4, and the household registration information table corresponding to the position information Position1 is determined in the first storage system.
  • the household registration information table includes the ID number No1 and data corresponding to No1, and the data includes the name "Name1", the household address "Address1", and the ethnic group "Han”.
  • the target data item "ID card number” is ranked at the first position in the first structure information, and the column corresponding to the target data item "ID card number" in the household registration information table is determined as the first column according to the first position.
  • the corresponding position information Position2 is obtained from the correspondence between the identifier and the position information shown in Table 4, and the academic information table corresponding to the position information Position2 is determined in the first storage system.
  • the table includes ID number No2 and data corresponding to No2, which includes the name "Name1", education “undergraduate”, and the school "Beijing ### ⁇ ".
  • the target data item "ID card number” is ranked at the first position in the second structure information, and the column corresponding to the target data item "ID card number" in the academic information table is determined as the first column according to the first position.
  • the ID number "No1” look up the ID number "No1” in the first column in the household registration information table, and obtain other data in the row where the ID number "No1” is located, including the name "Name1", household registration Address “Address1” and ethnic “Han”; according to the ID number "No1”, look up the ID number "No1” in the first column of the academic information table, and get other data in the row where the ID number "No1” is located , Including name "Name1", education “undergraduate”, and school “ ⁇ ### ⁇ ”. Then, the data obtained from each database table can be fused and the fused data can be sent.
  • each database in the source data layer has its own corresponding service.
  • data belonging to the service can be queried from the database corresponding to the service; when multiple databases need to be queried, Since the data in each database table in each database table in the active data layer is stored in the first storage system, and the structural information corresponding to each database table is stored in the second storage system, each database is queried in this way.
  • the first storage system can be queried according to the structural information in the second storage system, so that it is not necessary to query the databases in the source data layer, and it will not affect the original business access database corresponding to each database.
  • an embodiment of the present application provides a device 300 for establishing a database system, where the system includes a storage layer and a source data layer, the storage layer includes a first storage system and a second storage system, and the source data layer includes a plurality of A database, each of the plurality of databases includes at least one database table, and each database table included in each database is used to store data.
  • the device 300 includes:
  • the reading module 301 is used for structural information of a target database table and data in the target database table;
  • a storage module 302 configured to store the structure information in the second storage system, store data in the target database table in the first storage system, and store the identifier of the structure information and the target database
  • the position information of the data in the table in the first storage system is correspondingly stored in the correspondence between the identifier and the position information in the second storage system.
  • the apparatus 300 further includes:
  • the query module is configured to query data corresponding to the search information in the storage layer according to the search information to be queried.
  • the query module includes: a determination unit, an acquisition unit, and a query unit;
  • the determining unit is configured to determine a target data item to which the search information to be queried belongs;
  • the obtaining unit is configured to obtain structure information including the target data item from the second storage system; and obtain corresponding position information from the second storage system according to an identifier of the structure information;
  • the determining unit is further configured to determine a corresponding database table according to the location information
  • the query unit is configured to query data corresponding to the search information in the database table according to the search information.
  • FIG. 4 shows a structural block diagram of a terminal 400 provided by an exemplary embodiment of the present invention.
  • the terminal 400 may be used to run the establishment device in the acquisition conversion layer 3 or the terminal 400 may be the establishment device in the acquisition conversion layer 3, and the terminal 400 may be a laptop computer or a desktop computer.
  • the terminal 400 may also be called other names such as user equipment, portable terminal, laptop terminal, desktop terminal, and the like.
  • the terminal 400 includes a processor 401 and a memory 402.
  • the processor 401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like.
  • the processor 401 may use at least one hardware form among DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). achieve.
  • the processor 401 may also include a main processor and a co-processor.
  • the main processor is a processor for processing data in the wake-up state, also called a CPU (Central Processing Unit).
  • the co-processor is Low-power processor for processing data in standby.
  • the processor 401 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing content required to be displayed on the display screen.
  • the processor 401 may further include an AI (Artificial Intelligence) processor, and the AI processor is configured to process computing operations related to machine learning.
  • AI Artificial Intelligence
  • the memory 402 may include one or more computer-readable storage media, which may be non-transitory.
  • the memory 402 may also include high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash storage devices.
  • the non-transitory computer-readable storage medium in the memory 402 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 401 to implement the multiple sources provided by the method embodiments in this application. Method for establishing structured database system.
  • the terminal 400 may optionally include a peripheral device interface 403 and at least one peripheral device.
  • the processor 401, the memory 402, and the peripheral device interface 403 may be connected through a bus or a signal line.
  • Each peripheral device can be connected to the peripheral device interface 403 through a bus, a signal line, or a circuit board.
  • the peripheral device includes at least one of a radio frequency circuit 404, a touch display screen 405, a camera 406, an audio circuit 407, a positioning component 408, and a power source 409.
  • the peripheral device interface 403 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 401 and the memory 402.
  • the processor 401, the memory 402, and the peripheral device interface 403 are integrated on the same chip or circuit board; in some other embodiments, any one of the processor 401, the memory 402, and the peripheral device interface 403 or Both can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
  • the radio frequency circuit 404 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals.
  • the radio frequency circuit 404 communicates with a communication network and other communication devices through electromagnetic signals.
  • the radio frequency circuit 404 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals.
  • the radio frequency circuit 404 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like.
  • the radio frequency circuit 404 can communicate with other terminals through at least one wireless communication protocol.
  • the wireless communication protocols include, but are not limited to, the World Wide Web, metropolitan area networks, intranets, mobile communication networks (2G, 3G, 4G, and 5G) of various generations, wireless local area networks, and / or WiFi (Wireless Fidelity) networks.
  • the radio frequency circuit 404 may further include circuits related to Near Field Communication (NFC), which is not limited in this application.
  • NFC Near Field Communication
  • the display screen 405 is used to display a UI (User Interface).
  • the UI may include graphics, text, icons, videos, and any combination thereof.
  • the display screen 405 also has the ability to collect touch signals on or above the surface of the display screen 405.
  • the touch signal can be input as a control signal to the processor 401 for processing.
  • the display screen 405 may also be used to provide a virtual button and / or a virtual keyboard, which is also called a soft button and / or a soft keyboard.
  • the display screen 405 may be one, and the front panel of the terminal 400 is provided; in other embodiments, the display screen 405 may be at least two, which are respectively disposed on different surfaces of the terminal 400 or have a folded design; In still other embodiments, the display screen 405 may be a flexible display screen disposed on a curved surface or a folded surface of the terminal 400. Moreover, the display screen 405 can also be set as a non-rectangular irregular figure, that is, a special-shaped screen.
  • the display screen 405 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
  • the camera component 406 is used for capturing images or videos.
  • the camera component 406 includes a front camera and a rear camera.
  • the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal.
  • the camera assembly 406 may further include a flash.
  • the flash can be a monochrome temperature flash or a dual color temperature flash.
  • a dual color temperature flash is a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
  • the audio circuit 407 may include a microphone and a speaker.
  • the microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals and input them to the processor 401 for processing, or input them to the radio frequency circuit 404 to implement voice communication.
  • the microphone can also be an array microphone or an omnidirectional acquisition microphone.
  • the speaker is used to convert electrical signals from the processor 401 or the radio frequency circuit 404 into sound waves.
  • the speaker can be a traditional film speaker or a piezoelectric ceramic speaker.
  • the speaker When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for ranging purposes.
  • the audio circuit 407 may further include a headphone jack.
  • the positioning component 408 is used to locate the current geographic position of the terminal 400 to implement navigation or LBS (Location Based Service).
  • the positioning component 408 may be a positioning component based on a US-based GPS (Global Positioning System), a Beidou system in China, or a Galileo system in Russia.
  • the power supply 409 is used to power various components in the terminal 400.
  • the power source 409 may be an alternating current, a direct current, a disposable battery, or a rechargeable battery.
  • the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery.
  • the wired rechargeable battery is a battery charged through a wired line
  • the wireless rechargeable battery is a battery charged through a wireless coil.
  • the rechargeable battery can also be used to support fast charging technology.
  • the terminal 400 further includes one or more sensors 410.
  • the one or more sensors 410 include, but are not limited to, an acceleration sensor 411, a gyroscope sensor 412, a pressure sensor 413, a fingerprint sensor 414, an optical sensor 415, and a proximity sensor 416.
  • the acceleration sensor 411 can detect the magnitude of acceleration on three coordinate axes of the coordinate system established by the terminal 400.
  • the acceleration sensor 411 may be used to detect components of the acceleration of gravity on three coordinate axes.
  • the processor 401 may control the touch display screen 405 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 411.
  • the acceleration sensor 411 may also be used for collecting motion data of a game or a user.
  • the gyro sensor 412 can detect the body direction and rotation angle of the terminal 400, and the gyro sensor 412 can cooperate with the acceleration sensor 411 to collect a 3D motion of the user on the terminal 400. Based on the data collected by the gyro sensor 412, the processor 401 can implement the following functions: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
  • the pressure sensor 413 may be disposed on a side frame of the terminal 400 and / or a lower layer of the touch display screen 405.
  • a user's holding signal to the terminal 400 can be detected, and the processor 401 can perform left-right hand recognition or quick operation according to the holding signal collected by the pressure sensor 413.
  • the processor 401 operates according to the user's pressure operation on the touch display screen 405 to control the operable controls on the UI interface.
  • the operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
  • the fingerprint sensor 414 is used to collect a user's fingerprint, and the processor 401 recognizes the identity of the user based on the fingerprint collected by the fingerprint sensor 414, or the fingerprint sensor 414 identifies the identity of the user based on the collected fingerprint. When the user's identity is identified as trusted, the processor 401 authorizes the user to perform related sensitive operations, such as unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings.
  • the fingerprint sensor 414 may be provided on the front, back, or side of the terminal 400. When a physical button or a manufacturer's logo is set on the terminal 400, the fingerprint sensor 414 can be integrated with the physical button or the manufacturer's logo.
  • the optical sensor 415 is used to collect ambient light intensity.
  • the processor 401 may control the display brightness of the touch display screen 405 according to the ambient light intensity collected by the optical sensor 415. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 405 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 405 is decreased.
  • the processor 401 may also dynamically adjust the shooting parameters of the camera component 406 according to the ambient light intensity collected by the optical sensor 415.
  • the proximity sensor 416 also called a distance sensor, is usually disposed on the front panel of the terminal 400.
  • the proximity sensor 416 is used to collect the distance between the user and the front side of the terminal 400.
  • the processor 401 controls the touch display screen 405 to switch from the bright screen state to the closed screen state; when the proximity sensor 416 detects When the distance between the user and the front side of the terminal 400 gradually becomes larger, the processor 401 controls the touch display screen 405 to switch from the on-screen state to the on-screen state.
  • FIG. 4 does not constitute a limitation on the terminal 400, and may include more or fewer components than shown in the figure, or combine certain components, or adopt different component arrangements.

Abstract

The present application relates to the field of communications, and relates to a database system, and an establishment method and apparatus therefor. The system comprises: a storage layer and a source data layer, the storage layer comprising a first storage system and a second storage system, and the source data layer comprising multiple databases, each database comprising at least one database table, each database table being used for storing data; a first storage system used for storing data stored in each database table comprised in each database; and a second storage system used for storing structural information corresponding to a target database table, and storing a correspondence between an identifier of the structural information and position information, the position information comprising a storage position, in the first storage system, of data comprised in the target database table, and the structural information comprising each data item in the target database table, the target database table being a database table in any one of multiple databases. The present application does not affect the original service access database corresponding to each database.

Description

一种数据库系统及其建立方法和装置Database system and establishment method and device thereof
本申请要求于2018年5月23日提交的申请号为201810502231.0、发明名称为“一种数据库系统及其建立方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority from a Chinese patent application filed on May 23, 2018 with an application number of 201810502231.0 and an invention name of "a database system and a method and device for establishing the same", the entire contents of which are incorporated herein by reference. .
技术领域Technical field
本申请涉及通信领域,特别涉及一种数据库系统及其建立方法和装置。The present application relates to the field of communications, and in particular, to a database system and a method and device for establishing the database system.
背景技术Background technique
在信息化建设的过程,很多企业的部门根据自身业务和功能需要,建立了许多相互隔离的异构数据库。由于缺乏统一的信息规化,各数据库开发的时间不一致,造成访问各数据库的方式不同,各数据库相互独立、信息无法交流和整合,形成了信息孤岛。In the process of informatization construction, many enterprise departments have established many isolated heterogeneous databases according to their own business and functional needs. Due to the lack of unified information standardization, the development time of each database is inconsistent, resulting in different ways to access each database, each database is independent of each other, information cannot be exchanged and integrated, and an information island is formed.
为了解决该问题,目前出现了一种数据库系统,该系统包括数据库层和融合层,数据库层包括多个数据库和数据库代理。当需要同时读取多个数据库时,可以向融合层发送读取请求,融合层将该读取请求转发到数据库代理。数据库代理从该多个数据库中读取数据,将从每个数据库中读取的数据发送到融合层。融合层将每个数据库的数据整合,然后再发送出去。In order to solve this problem, a database system has appeared. The system includes a database layer and a fusion layer. The database layer includes multiple databases and database agents. When multiple databases need to be read at the same time, a read request can be sent to the fusion layer, and the fusion layer forwards the read request to the database agent. The database agent reads data from the multiple databases and sends the data read from each database to the fusion layer. The fusion layer integrates the data from each database before sending it out.
发明人在实现本申请的过程中,发现上述方式至少存在如下缺陷:In the process of implementing the present application, the inventor found that the above method has at least the following defects:
数据库中的每个数据库都有各自对应的业务,在融合层通过数据库代理访问各数据库时,可能影响到该数据库对应的业务访问该数据库。Each database in the database has its own corresponding service. When the fusion layer accesses each database through a database agent, it may affect the services corresponding to the database to access the database.
发明内容Summary of the Invention
本申请实施例提供了一种数据库系统及其建立方法和装置,以避免对数据库对应的原业务访问数据库产生影响。所述技术方案如下:The embodiments of the present application provide a database system and a method and device for establishing the database system, so as to avoid affecting the original service corresponding to the database from accessing the database. The technical solution is as follows:
一方面,本申请实施例提供了一种数据库系统,包括:In one aspect, an embodiment of the present application provides a database system, including:
存储层和源数据层,所述存储层包括第一存储系统和第二存储系统,所述源数据层包括多个数据库,所述多个数据库中的每个数据库包括至少一个数据 库表,所述每个数据库包括的每个数据库表用于存储数据;A storage layer and a source data layer, the storage layer including a first storage system and a second storage system, the source data layer including a plurality of databases, each of the plurality of databases including at least one database table, the Each database table included in each database is used to store data;
所述第一存储系统,用于存储所述每个数据库包括的每个数据库表中存储的数据;The first storage system is configured to store data stored in each database table included in each database;
所述第二存储系统,用于存储目标数据库表对应的结构信息,以及存储所述结构信息的标识与位置信息的对应关系,所述位置信息包括所述目标数据库表包括的数据在所述第一存储系统中的存储位置,所述结构信息包括所述目标数据库表中的各数据项,所述目标数据库表为所述多个数据库中的任一数据库中的数据库表。The second storage system is configured to store structure information corresponding to a target database table and store a correspondence between an identifier of the structure information and location information, where the location information includes data included in the target database table in the first A storage location in a storage system, the structure information includes each data item in the target database table, and the target database table is a database table in any one of the plurality of databases.
可选的,所述第一存储系统为HDFS,所述第二存储系统为RDMS。Optionally, the first storage system is HDFS, and the second storage system is RDMS.
可选的,所述源数据层包括的数据库类型为Oracle、MySQL和HDFS中的一种或多种。Optionally, the database type included in the source data layer is one or more of Oracle, MySQL, and HDFS.
另一方面,本申请实施例提供了一种数据库系统的建立方法,所述数据库系统为一方面或一方面任一可选的所述的系统;On the other hand, the embodiment of the present application provides a method for establishing a database system, where the database system is one of the optional systems described above on the one hand or on the other hand;
所述方法包括:The method includes:
读取所述目标数据库表的结构信息和所述目标数据库表中的数据;Reading structure information of the target database table and data in the target database table;
将所述结构信息存储在所述第二存储系统,将所述目标数据库表中的数据存储在所述第一存储系统;Storing the structural information in the second storage system, and storing data in the target database table in the first storage system;
将所述结构信息的标识和所述目标数据库表中的数据在所述第一存储系统中的位置信息对应保存在所述第二存储系统中的标识与位置信息对应关系中。The identifier of the structural information and the location information of the data in the target database table in the first storage system are correspondingly stored in a correspondence between the identifier and the location information in the second storage system.
可选的,所述将所述目标数据库表中的数据存储在所述第一存储系统之后,还包括:Optionally, after the data in the target database table is stored in the first storage system, the method further includes:
定期或不定期地读取所述目标数据库表中的数据,根据所述目标数据库表的结构信息的标识从所述标识与位置信息的对应关系中获取所述目标数据库表对应的位置信息,根据所述位置信息确定出所述第一存储系统中保存的所述目标数据库表包括的数据,将所述第一存储系统中保存的所述目标数据库表包括的数据替换为读取的所述目标数据库表中的数据。Periodically or irregularly read data in the target database table, and obtain position information corresponding to the target database table from the correspondence between the identifier and location information according to the identifier of the structure information of the target database table, according to The location information determines data included in the target database table stored in the first storage system, and replaces data included in the target database table stored in the first storage system with the read target Data in a database table.
可选的,所述方法还包括:Optionally, the method further includes:
根据待查询的检索信息,在所述存储层中查询所述检索信息对应的数据。According to the search information to be queried, query data corresponding to the search information in the storage layer.
可选的,所述根据待查询的检索信息,在所述存储层中查询所述检索信息对应的数据,包括:Optionally, the querying data corresponding to the search information in the storage layer according to the search information to be queried includes:
确定待查询的检索信息所属的目标数据项;Determining the target data item to which the search information to be queried belongs;
从所述第二存储系统中获取包括所述目标数据项的结构信息;Obtaining structural information including the target data item from the second storage system;
根据所述结构信息的标识,从所述第二存储系统中获取对应的位置信息;Obtaining corresponding location information from the second storage system according to the identification of the structure information;
根据所述位置信息,在所述第一存储系统中确定出对应的数据库表;Determining a corresponding database table in the first storage system according to the location information;
根据所述检索信息在所述数据库表查询所述检索信息对应的数据。Query data corresponding to the search information in the database table according to the search information.
另一方面,本申请实施例提供了一种数据库系统的建立装置,所述数据库系统为一方面或一方面任一可选的所述的系统;On the other hand, the embodiment of the present application provides a device for establishing a database system, where the database system is an optional system on the one hand or any one of the aspects;
所述装置包括:The device includes:
读取模块,用于读取目标数据库表的结构信息和所述目标数据库表中的数据;A reading module, configured to read the structure information of the target database table and the data in the target database table;
存储模块,用于将所述结构信息存储在所述第二存储系统,将所述目标数据库表中的数据存储在所述第一存储系统;将所述结构信息的标识和所述目标数据库表中的数据在所述第一存储系统中的位置信息对应保存在所述第二存储系统中的标识与位置信息对应关系中。A storage module, configured to store the structure information in the second storage system, store data in the target database table in the first storage system, and store the identifier of the structure information and the target database table The position information of the data in the first storage system is correspondingly stored in the correspondence between the identifier and the position information in the second storage system.
可选的,所述装置还包括:Optionally, the device further includes:
查询模块,用于根据待查询的检索信息,在所述存储层中查询所述检索信息对应的数据。The query module is configured to query data corresponding to the search information in the storage layer according to the search information to be queried.
可选的,所述查询模块包括:确定单元、获取单元和查询单元;Optionally, the query module includes: a determination unit, an acquisition unit, and a query unit;
所述确定单元,用于确定所述待查询的检索信息所属的目标数据项;The determining unit is configured to determine a target data item to which the search information to be queried belongs;
所述获取单元,用于从所述第二存储系统中获取包括所述目标数据项的结构信息;根据所述结构信息的标识,从所述第二存储系统中获取对应的位置信息;The obtaining unit is configured to obtain structure information including the target data item from the second storage system; and obtain corresponding position information from the second storage system according to an identifier of the structure information;
所述确定单元,还用于根据所述位置信息,确定出对应的确定出对应的数据库表;The determining unit is further configured to determine a corresponding database table according to the location information;
所述查询单元,用于根据所述检索信息在所述数据库表查询所述检索信息 对应的数据。The query unit is configured to query data corresponding to the search information in the database table according to the search information.
本申请实施例提供的技术方案可以包括以下有益效果:The technical solutions provided in the embodiments of the present application may include the following beneficial effects:
通过在第一存储系统中存储有源数据层中的每个数据库表中的每个数据表中的数据,以及在第二存储系统中存储每个数据库表对应的结构信息,这样在查询各数据库中的数据时,可以根据第二存储系统中的各结构信息,查询第一存储系统,从而不需要查询源数据层中的各数据库,不会对各数据库对应的原业务访问数据库产生影响。By storing the data in each data table in each database table in the active data layer in the first storage system and storing the structural information corresponding to each database table in the second storage system, each database is queried When the data is stored, the first storage system can be queried according to the structural information in the second storage system, so that it is not necessary to query the databases in the source data layer, and it will not affect the original business access database corresponding to each database.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本申请。It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and should not limit the present application.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并与说明书一起用于解释本申请的原理。The drawings herein are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the description serve to explain the principles of the application.
图1-1是本申请实施例提供的一种数据库系统的结构示意图;FIG. 1-1 is a schematic structural diagram of a database system according to an embodiment of the present application; FIG.
图1-2是本申请实施例提供的另一种数据库系统的结构示意图;FIG. 1-2 is a schematic structural diagram of another database system according to an embodiment of the present application;
图2-1是本申请实施例提供的一种数据库系统的建立方法流程图;FIG. 2-1 is a flowchart of a method for establishing a database system according to an embodiment of the present application; FIG.
图2-2是本申请实施例提供的一种数据库系统的建立方法的另一流程图;2-2 is another flowchart of a method for establishing a database system according to an embodiment of the present application;
图3是本申请实施例提供的一种数据库系统的建立装置结构示意图;3 is a schematic structural diagram of an apparatus for establishing a database system according to an embodiment of the present application;
图4是本申请实施例提供的一种终端结构示意图。FIG. 4 is a schematic structural diagram of a terminal according to an embodiment of the present application.
通过上述附图,已示出本申请明确的实施例,后文中将有更详细的描述。这些附图和文字描述并不是为了通过任何方式限制本申请构思的范围,而是通过参考特定实施例为本领域技术人员说明本申请的概念。Through the above drawings, the specific embodiments of the present application have been shown, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the concept of the present application in any way, but to explain the concepts of the present application to those skilled in the art by referring to specific embodiments.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail here, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numerals in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this application. Rather, they are merely examples of devices and methods consistent with certain aspects of the application as detailed in the appended claims.
参见图1-1,本申请实施例提供了一种数据库系统,包括:Referring to FIG. 1-1, an embodiment of the present application provides a database system, including:
存储层1和源数据层2,存储层1包括第一存储系统11和第二存储系统12,源数据层2包括多个数据库,该多个数据库中的每个数据库包括至少一个数据库表,每个数据库包括的每个数据库表用于存储数据;Storage tier 1 and source data tier 2. Storage tier 1 includes a first storage system 11 and a second storage system 12. Source data tier 2 includes multiple databases. Each of the multiple databases includes at least one database table. Each database table included in each database is used to store data;
第一存储系统11,用于存储每个数据库包括的每个数据库表中存储的数据;The first storage system 11 is configured to store data stored in each database table included in each database;
第二存储系统12,用于存储目标数据库表对应的结构信息以及存储该结构信息的标识与位置信息的对应关系,该位置信息包括目标数据库表包括的数据在所述第一存储系统11中的存储位置,该结构信息包括目标数据库表中的各数据项,目标数据库表为该多个数据库中的任一数据库中的数据库表。The second storage system 12 is configured to store structure information corresponding to the target database table and store a correspondence between an identifier of the structure information and location information, where the location information includes data included in the target database table in the first storage system 11. Storage location, the structure information includes each data item in the target database table, and the target database table is a database table in any one of the multiple databases.
该存储位置可以包括目标数据库表的数据在第一存储系统11中的起始存储位置和结束存储位置。或者,该存储位置可以为目标数据库表的数据在第一存储系统11中的起始存储位置,但该位置信息还可以包括目标数据库中的数据量。The storage location may include a start storage location and an end storage location of the data of the target database table in the first storage system 11. Alternatively, the storage location may be a starting storage location of data of the target database table in the first storage system 11, but the location information may further include an amount of data in the target database.
对于源数据层2中的每个数据库包括的每个数据库表,该数据库表包括多个数据项,在该数据库表中每个数据项对应一列,数据项对应的列用于存储属于该数据项的数据。例如,参见下表1所示的数据库表,该数据库表为户籍信息表,用于存储用户的户籍信息。户籍信息表中包括四个数据项,分别为“身份证号”、“姓名”、“户口地址”和“民族”,在户籍信息表中数据项“身份证号”对应的列用于存储各用户的身份证号,数据项“姓名”对应的列用于存储各用户的姓名,数据项“户口地址”对应的列用于存储各用户的户口地址,以及数据项“民族”对应的列用于存储各用户的民族。For each database table included in each database in the source data layer 2, the database table includes multiple data items, each data item in the database table corresponds to a column, and the column corresponding to the data item is used to store the data item The data. For example, see the database table shown in Table 1 below. The database table is a household registration information table for storing household registration information of a user. The household registration information table includes four data items, which are "identity card number", "name", "hukou address" and "nation", and the corresponding column of the data item "identity card number" in the household registration information table is used to store each The user's ID number, the column corresponding to the data item "name" is used to store the name of each user, the column corresponding to the data item "account address" is used to store the account address of each user, and the column corresponding to the data item "nation" For storing the nationalities of each user.
表1为户籍信息表Table 1 is the household registration information form
身份证号identity number 姓名Name 户口地址Account Address 民族Nation
No1No1 Name1Name1 Address1Address1 Chinese
No2No2 Name2Name2 Address2Address2 White
……... ……... ……... ……...
再例如,参见下表2所示的数据库表,该数据库表为学历信息表,用于存储用户的学历信息。学历信息表中包括四个数据项,分别为“身份证号”、“姓名”、“学历”和“学校”,在学历信息表中数据项“身份证号”对应的列用于存储各用户的身份证号,数据项“姓名”对应的列用于存储各用户的姓名,数据项“学历”对应的列用于存储各用户的学历,以及数据项“学校”对应的列用 于存储各用户的学校。For another example, refer to the database table shown in Table 2 below. The database table is an education information table for storing the user's education information. The education information table includes four data items, which are "ID number", "Name", "Education" and "School". The corresponding column of the data item "ID number" in the education information table is used to store each user. ID number, the column corresponding to the data item "name" is used to store the name of each user, the column corresponding to the data item "education" is used to store the user's education, and the column corresponding to the data item "school" is used to store each user The user's school.
表2为学历信息表Table 2 is the academic information table
身份证号identity number 姓名Name 学历Education 学校school
No1No1 Name1Name1 本科Undergraduate 北京###大学Beijing University
No2No2 Name2Name2 研究生Postgraduate 北京***大学Beijing University
……... ……... ……... ……...
可选的,第一存储系统11用于存储有表1所示的户籍信息表中的数据,以及用于存储表2所示的学历信息表中的数据。第一存储系统11中可以不保存户籍信息表第一行存储的各数据项,以及可以不保存学历信息表第一行存储的各数据项。Optionally, the first storage system 11 is configured to store data in the household registration information table shown in Table 1 and to store data in the academic information table shown in Table 2. The first storage system 11 may not save each data item stored in the first row of the household registration information table, and may not save each data item stored in the first row of the academic information table.
可选的,参见下表3,第二存储系统12,用于存储户籍信息表对应的结构信息,该结构信息中包括户籍信息表中的数据项“身份证号”、“姓名”、“户口地址”和“民族”,以及用于存储学历信息表对应的结构信息,该结构信息包括学历信息表中的数据项“身份证号”、“姓名”、“学历”和“学校”。Optionally, see Table 3 below. The second storage system 12 is used to store the structural information corresponding to the household registration information table. The structural information includes data items "ID card number", "name", and "hukou" in the household registration information table. Address "and" nation ", as well as structure information corresponding to the education information table, the structure information includes data items" ID card number "," name "," education "and" school "in the education information table.
表3table 3
结构信息Structural information
“身份证号”、“姓名”、“户口地址”和“民族”"ID Number", "Name", "Hukou Address" and "Nation"
“身份证号”、“姓名”、“学历”和“学校”"ID", "Name", "Education" and "School"
……...
以及,参见下表4,第二存储系统12,还用于存储标识与位置信息的对应关系,该对应关系中包括户籍信息表对应的第一记录和学历信息表对应的第二记录。第一记录包括户籍信息表对应的结构信息的标识ID1和户籍信息表包括的数据在第一存储系统11中的位置信息Position1;以及第二记录包括学历信息表对应的结构信息的标识ID2和学历信息表包括的数据在第一存储系统11中的位置信息Position2。And, referring to Table 4 below, the second storage system 12 is further configured to store the correspondence between the identifier and the location information, where the correspondence includes the first record corresponding to the household registration information table and the second record corresponding to the academic information table. The first record includes the identification ID1 of the structural information corresponding to the household registration information table and the position information Position1 of the data included in the household registration information table in the first storage system 11; and the second record includes the identification ID2 of the structural information corresponding to the academic information table and the academic qualifications Position information Position2 of the data included in the information table in the first storage system 11.
表4Table 4
标识Logo 位置信息location information
ID1ID1 Position1Position1
ID2ID2 Position2Position2
……... ……...
可选的,参见图1-2,本申请实施例还提供:采集转换层3,采集转换层3中包括至少一个建立装置;Optionally, referring to FIGS. 1-2, the embodiment of the present application further provides: an acquisition conversion layer 3, and the acquisition conversion layer 3 includes at least one establishment device;
该建立装置,用于读取目标数据库表的结构信息和目标数据库表中的数据,将该结构信息存储在第二存储系统12中,将目标数据库表中的数据存储在第一存储系统11中,将该结构信息的标识和目标数据库表中的数据在第一存储系统11中的位置信息对应存储在第二存储系统12中的标识与位置信息的对应关系中。The establishment device is configured to read the structure information of the target database table and the data in the target database table, store the structure information in the second storage system 12, and store the data in the target database table in the first storage system 11. , The identifier of the structural information and the position information of the data in the target database table in the first storage system 11 are correspondingly stored in the correspondence between the identifier and the position information in the second storage system 12.
该建立装置,还用于定期或不定期地从源数据层2中读取目标数据库表中的数据,根据目标数据库表的结构信息的标识从第二存储系统12中的标识与位置信息的对应关系中获取目标数据库表对应的位置信息,根据该位置信息确定出第一存储系统11中保存的目标数据库表包括的数据,将第一存储系统11中保存的目标数据库表包括的数据替换为读取的目标数据库表中的数据。The establishment device is further configured to read the data in the target database table from the source data layer 2 periodically or irregularly, and according to the identification of the structure information of the target database table, the correspondence between the identification in the second storage system 12 and the location information The position information corresponding to the target database table is obtained in the relationship, and the data included in the target database table stored in the first storage system 11 is determined according to the position information, and the data included in the target database table stored in the first storage system 11 is replaced by reading Take the data from the target database table.
由于替换后的目标数据库表中的数据在第一存储系统11中的结束位置可能发生变化,或,目标数据库表中的数据量发生变化,所以该建立装置还可以重新获取目标数据表中的数据在第一存储系统11中的位置信息,在第二存储系统11保存的标识与位置信息的对应关系中将目标数据库表的结构信息的标识对应的位置信息替换为重新获取的位置信息。Because the end position of the data in the replaced target database table in the first storage system 11 may change, or the amount of data in the target database table changes, the establishment device may also obtain the data in the target data table again. The location information in the first storage system 11 is replaced with the newly acquired location information in the correspondence between the identifier and the location information stored in the second storage system 11.
可选的,源数据层2中的数据库可能属于不同的数据库类型。例如,源数据层2中可能存在至少一个数据库的数据库类型为Oracle,可能存在至少一个数据库的数据库类型为MySQL,和/或,可能存在至少一个数据库的数据库类型为Hadoop分布式文件系统(Hadoop Distributed File System,HDFS)等。Optionally, the databases in the source data layer 2 may belong to different database types. For example, the source database layer 2 may have at least one database whose database type is Oracle, there may be at least one database whose database type is MySQL, and / or, there may be at least one database whose database type is Hadoop Distributed File System (Hadoop Distributed File System) File System, HDFS).
采集转换层3可以包括至少一个数据库类型中的每个数据库类型对应的建立装置;对于每个数据库类型对应的建立装置,该建立装置用于从源数据层2中确定属于该数据库类型的数据库,对于该数据库中任一个数据库表(称为目标数据库表),获取目标数据库表的结构信息,并将该结构信息存储在第二存储系统12中,获取目标数据库表中的数据,并将目标数据库表中的数据存储在第一存储系统11以及获取该数据在第一存储系统11中的位置信息,将该结构信息的标识和该位置信息对应保存在第二存储系统12中的标识与位置信息的对应关系。The collection and conversion layer 3 may include a building device corresponding to each database type in at least one database type; for the building device corresponding to each database type, the building device is configured to determine a database belonging to the database type from the source data layer 2, For any database table in the database (referred to as the target database table), obtain the structure information of the target database table, and store the structure information in the second storage system 12, obtain the data in the target database table, and save the target database. The data in the table is stored in the first storage system 11 and the position information of the data in the first storage system 11 is obtained, and the identifier of the structural information and the position information are correspondingly stored in the identifier and the position information of the second storage system 12 Corresponding relationship.
由于不同数据库类型的数据库的结构不同,所以需要不同的建立装置来分析数据库的结构以及读取数据。在采集转换层3中的每个建立装置中预设有用于读取分析数据库的结构以及读取数据的方案,该建立装置可以采用该方案分析属于其对应的数据库类型的数据库的结构以及从该数据库中读取数据。Because the structures of databases of different database types are different, different establishment devices are needed to analyze the structure of the database and read data. Each establishment in the acquisition and conversion layer 3 presets a scheme for reading the structure of the analysis database and a scheme for reading the data. The establishment apparatus may use the scheme to analyze the structure of the database belonging to its corresponding database type and from the database. Read data from the database.
采集转换层3中的各建立装置可以是技术人员事先设置的。当源数据层2中出现新的数据库类型的数据库时,技术人员可以设计该数据库类型对应的建立装置,将该建立装置添加到采集转换层3中。Each establishment device in the acquisition conversion layer 3 may be set in advance by a technician. When a new database type database appears in the source data layer 2, a technician can design a building device corresponding to the database type, and add the building device to the acquisition conversion layer 3.
可选的,第一存储系统11可以为HDFS,第二存储系统12可以为关系数据库管理系统(Relational Data(base)Management System,RDMS)。Optionally, the first storage system 11 may be HDFS, and the second storage system 12 may be a relational database management system (Relational Data (base) Management System (RDMS)).
可选的,源数据层2包括的数据库类型可以为Oracle、MySQL和HDFS等中的一种或多种。Optionally, the database type included in the source data layer 2 may be one or more of Oracle, MySQL, and HDFS.
在本申请实施例中,由于在第一存储系统中存储有源数据层中的每个数据库表中的每个数据表中的数据,以及在第二存储系统中存储每个数据库表对应的存储项,这样在查询各数据库中的数据时,可以根据第二存储系统中的各存储项,查询第一存储系统,从而不需要查询源数据层中的各数据库,这样源数据层中的各数据库对应的原业务访问源数据层中的各数据库,不会对各数据库对应的原业务访问数据库产生影响。In the embodiment of the present application, data in each data table in each database table in the active data layer is stored in the first storage system, and storage corresponding to each database table is stored in the second storage system. Items, so that when querying data in each database, you can query the first storage system according to each storage item in the second storage system, so there is no need to query each database in the source data layer, so that each database in the source data layer The corresponding original business access to each database in the source data layer will not affect the original business access database corresponding to each database.
本申请实施例提供了一种数据库系统的建立方法,其中,该系统包括存储层和源数据层,存储层包括第一存储系统和第二存储系统,源数据层包括多个数据库,多个数据库中的每个数据库包括至少一个数据库表,每个数据库包括的每个数据库表用于存储数据。An embodiment of the present application provides a method for establishing a database system. The system includes a storage layer and a source data layer. The storage layer includes a first storage system and a second storage system. The source data layer includes multiple databases and multiple databases. Each database in the database includes at least one database table, and each database table included in each database is used to store data.
参见图2-1,该方法的执行主体可以为图1-2所示的采集转换层中的任一个建立装置,包括:Referring to FIG. 2-1, the execution body of the method may be an establishment device for any one of the acquisition conversion layers shown in FIG. 1-2, including:
步骤201:获取目标数据库表对应的结构信息,该结构信息包括目标数据库表中的各数据项,目标数据库表是源数据层中的一个数据库中的一个数据库表。Step 201: Obtain structural information corresponding to the target database table, where the structural information includes each data item in the target database table, and the target database table is a database table in a database in the source data layer.
对于采集转换层中的任一个建立装置,该建立装置对应至少一个数据库类型,从源数据层包括的数据库中确定属于其对应的数据库类型的数据库,选择该数据库中的任一个数据库表作为目标数据表,然后从本步骤开始执行。For any establishment device in the acquisition and transformation layer, the establishment device corresponds to at least one database type, determines a database belonging to its corresponding database type from the databases included in the source data layer, and selects any database table in the database as the target data Table, and then proceed from this step.
可选的,源数据层中的每个数据库包括的每个数据库表包括多个数据项,在该数据库表中每个数据项对应一列,数据项对应的列用于存储属于该数据项 的数据。例如,参见上述表1所示的数据库表,该数据库表为户籍信息表,用于存储用户的户籍信息。户籍信息表中包括四个数据项,分别为“身份证号”、“姓名”、“户口地址”和“民族”,在户籍信息表中数据项“身份证号”对应的列用于存储各用户的身份证号,数据项“姓名”对应的列用于存储各用户的姓名,数据项“户口地址”对应的列用于存储各用户的户口地址,以及数据项“民族”对应的列用于存储各用户的民族。Optionally, each database table included in each database in the source data layer includes multiple data items. Each data item in the database table corresponds to a column, and the corresponding column of the data item is used to store data belonging to the data item. . For example, refer to the database table shown in Table 1 above. The database table is a household registration information table for storing household registration information of a user. The household registration information table includes four data items, which are "identity card number", "name", "hukou address" and "nation", and the corresponding column of the data item "identity card number" in the household registration information table is used to store each The user's ID number, the column corresponding to the data item "name" is used to store the name of each user, the column corresponding to the data item "account address" is used to store the account address of each user, and the column corresponding to the data item "nation" For storing the nationalities of each user.
再例如,参见上述表2所示的数据库表,该数据库表为学历信息表,用于存储用户的学历信息。户籍信息表中包括四个数据项,分别为“身份证号”、“姓名”、“学历”和“学校”,在学历信息表中数据项“身份证号”对应的列用于存储各用户的身份证号,数据项“姓名”对应的列用于存储各用户的姓名,数据项“学历”对应的列用于存储各用户的学历,以及数据项“学校”对应的列用于存储各用户的学校。For another example, refer to the database table shown in Table 2 above. The database table is a degree information table for storing the user's degree information. The household registration information table includes four data items, which are "ID number", "Name", "Education" and "School". The corresponding column of the data item "ID number" in the education information table is used to store each user. ID number, the column corresponding to the data item "name" is used to store the name of each user, the column corresponding to the data item "education" is used to store the user's education, and the column corresponding to the data item "school" is used to store each user The user's school.
例如,假设选择表1所示的户籍信息表,则在本步骤中可以从如表1所示的户籍信息表中获取户籍信息表对应的第一结构信息,第一结构信息包括户籍信息表中的数据项,分别为“身份证号”、“姓名”、“户口地址”和“民族”。For example, if the household registration information table shown in Table 1 is selected, in this step, the first structure information corresponding to the household registration information table can be obtained from the household registration information table shown in Table 1, and the first structure information includes the household registration information table. The data items are "identity card number", "name", "hukou address" and "nation".
再例如,假设选择表2所示的学历信息表,则在本步骤中获取学历信息表对应的第二结构信息,第二结构信息包括学历信息表中的数据项,分别为“身份证号”、“姓名”、“学历”和“学校”。For another example, assuming that the academic information table shown in Table 2 is selected, in this step, the second structure information corresponding to the academic information table is obtained. The second structure information includes data items in the academic information table, which are “identity card numbers”. , "Name", "Education" and "School".
步骤202:将该结构信息存储在第二存储系统中,并获取该结构信息的标识。Step 202: Store the structure information in a second storage system, and obtain an identifier of the structure information.
可选的,将该结构信息存储在第二存储系统后,可以分配一个用于唯一标识该结构信息的标识。Optionally, after storing the structure information in the second storage system, an identifier for uniquely identifying the structure information may be allocated.
可选的,可以顺序分配该结构信息的标识,或者,可以获取目标数据库表的名称和目标数据库表所在的目标数据库的名称,根据该结构信息、目标数据库表的名称和目标数据库的名称中的至少一个,生成该结构信的标识。Optionally, the identifier of the structure information may be sequentially assigned, or the name of the target database table and the name of the target database where the target database table is located may be obtained. According to the structure information, the name of the target database table, and the At least one, generating the identification of the structure letter.
例如,可以对该结构信息、目标数据库表的名称和目标数据库的名称中的至少一个进行哈希运算得到哈希值,或对该结构信息、目标数据库表的名称和目标数据库的名称中的至少一个进行消息摘要算法(Message-Digest Algorithm,MD5)运算得到MD5值,将该哈希值或该MD5值作为该结构信息的标识。For example, a hash value may be obtained by hashing at least one of the structure information, the name of the target database table, and the name of the target database, or at least one of the structure information, the name of the target database table, and the name of the target database. One performs a Message-Digest Algorithm (MD5) operation to obtain an MD5 value, and uses the hash value or the MD5 value as an identifier of the structural information.
例如,如上表3所示,将第一结构信息包括的“身份证号”、“姓名”、“户口地址”和“民族”存储在第二存储系统中,并分配第一结构信息的标识ID1。将第二结构信息包括的“身份证号”、“姓名”、“学历”和“学校”存储在第二 存储系统中,并分配第二结构信息的标识ID2。For example, as shown in Table 3 above, the "identity number", "name", "hukou address", and "nation" included in the first structure information are stored in the second storage system, and the identification ID1 of the first structure information is assigned. . The "identification number", "name", "education", and "school" included in the second structure information are stored in the second storage system, and the identification ID2 of the second structure information is assigned.
步骤203:获取目标数据库表中的数据,将目标数据库表中的数据存储在第一存储系统,获取该数据在第一存储系统中的位置信息。Step 203: Obtain data in the target database table, store the data in the target database table in the first storage system, and obtain position information of the data in the first storage system.
例如,获取表1所示的户籍信息表中的数据,在第一存储系统中存储表1所示的户籍信息表中的数据,并获取在第一存储系统中户籍信息表中的数据的第一位置信息,第一位置信息包括存储位置Position1。For example, the data in the household registration information table shown in Table 1 is acquired, the data in the household registration information table shown in Table 1 is stored in the first storage system, and the data in the household registration information table in the first storage system is obtained. A piece of position information. The first position information includes a storage position Position1.
再例如,获取表2所示的学历信息表中的数据,在第一存储系统11中存储表2所示的学历信息表中的数据,并获取在第一存储系统11中学历信息表中的数据的第二位置信息,第二位置信息包括存储位置Position2。For another example, the data in the academic information table shown in Table 2 is acquired, the data in the academic information table shown in Table 2 is stored in the first storage system 11, and the data in the secondary school information table in the first storage system 11 is obtained The second position information of the data, and the second position information includes a storage position Position2.
步骤204:将目标数据库表的结构信息的标识和该位置信息对应保存在第二存储系统中的标识与位置信息的对应关系中。Step 204: The identifier of the structural information of the target database table and the location information are correspondingly stored in a correspondence between the identifier and the location information in the second storage system.
例如,参见上表4,可以将第一结构信息的标识ID1和第一位置信息包括的Position1对应保存在第二存储系统中的标识与位置信息的对应关系中,以及,将第二结构信息的标识ID2和第二位置信息包括的Position2对应保存在第二存储系统中的标识与位置信息的对应关系中。For example, referring to Table 4 above, the identifier ID1 of the first structure information and Position1 included in the first location information may be stored in the correspondence between the identifier and the location information in the second storage system, and the second structure information may be The position ID included in the identification ID2 and the second position information corresponds to the correspondence between the identification and the position information stored in the second storage system.
可选的,可以定期或不定期地从源数据层中读取目标数据库表中的数据,根据目标数据库表的结构信息的标识从第二存储系统中的标识与位置信息的对应关系中获取目标数据库表对应的位置信息,根据该位置信息确定出第一存储系统中保存的目标数据库表包括的数据,将第一存储系统中保存的目标数据库表包括的数据替换为读取的目标数据库表中的数据。Optionally, the data in the target database table can be read from the source data layer periodically or irregularly, and the target can be obtained from the correspondence between the identifier in the second storage system and the location information according to the identifier of the structure information of the target database table The location information corresponding to the database table, and based on the location information, determine the data included in the target database table stored in the first storage system, and replace the data included in the target database table stored in the first storage system with the read target database table The data.
由于替换后的目标数据库表中的数据在第一存储系统中的结束位置可能发生变化,或,目标数据库表中的数据量发生变化,所以该建立装置还可以重新获取目标数据表中的数据在第一存储系统中的位置信息,在第二存储系统保存的标识与位置信息的对应关系中将目标数据库表的结构信息的标识对应的位置信息替换为重新获取的位置信息。Because the end position of the data in the replaced target database table in the first storage system may change, or the amount of data in the target database table changes, the establishment device may also obtain the data in the target data table again. For the location information in the first storage system, the location information corresponding to the identifier of the structure information of the target database table is replaced with the newly acquired location information in the correspondence between the identifier and the location information stored in the second storage system.
可选的,建立完数据库系统后,当需要访问源数据层中的多个数据库时,可以发送查询请求给该系统,参见图2-2,该系统可以通过如下操作进行查询。Optionally, after the database system is established, when it is necessary to access multiple databases in the source data layer, a query request can be sent to the system. See Figure 2-2. The system can perform the query by the following operations.
步骤205:接收查询请求消息,该查询请求消息携带检索信息。Step 205: Receive a query request message, where the query request message carries search information.
该检索信息属于至少一个数据项,例如,假设该检索信息是No1,则该检索信息属于的数据项为身份证号。The search information belongs to at least one data item. For example, assuming that the search information is No1, the data item to which the search information belongs is an ID number.
步骤206:根据该检索信息,在存储层中查询数据。Step 206: Query data in the storage layer according to the retrieval information.
本步骤可以,通过如下2061至2064的操作来实现,分别为:This step can be implemented by the following operations from 2061 to 2064:
2061:确定该检索信息所属的目标数据项。2061: Determine a target data item to which the search information belongs.
例如,假设,该检索信息是No1,则该检索信息属于的目标数据项为身份证号。For example, assuming that the search information is No1, the target data item to which the search information belongs is an ID number.
2062:从第二存储系统中查询出包括该目标数据项的结构信息。2062: Query structure information including the target data item from the second storage system.
可选的,还可以根据目标数据项在结构信息的位置,确定目标数据项对应的列。Optionally, the column corresponding to the target data item may also be determined according to the position of the target data item in the structural information.
例如,从上述表3所示的第二存储系统中查询出包括身份证号的结构信息,包括第一结构信息和第二结构信息。第一结构信息包括的结构信息为“身份证号”、“姓名”、“户口地址”和“民族”,“身份证号”在第一结构信息的位置为第一个位置,进而据此确定出“身份证号”对应的列为第一列;第二结构信息包括的结构信息为“身份证号”、“姓名”、“学历”和“学校”,“身份证号”在第一结构信息的位置为第一个位置,进而据此确定出“身份证号”对应的列为第一列。For example, the second storage system shown in Table 3 is used to query the structural information including the ID number, including the first structural information and the second structural information. The structure information included in the first structure information is “ID card number”, “Name”, “Account address” and “nation”, and the position of “ID card number” in the first structure information is the first position, and it is determined accordingly. The column corresponding to "ID Card Number" is the first column; the structure information included in the second structure information is "ID Card Number", "Name", "Education" and "School", and "ID Card Number" is in the first structure The position of the information is the first position, and accordingly, the column corresponding to the "ID card number" is determined as the first column.
2063:根据该结构信息的标识获取该结构信息对应的数据库表的位置信息,在第一存储系统中确定出该位置信息对应的数据库表,该数据库表中至少包括该检索信息和与该检索信息相对应的数据。2063: Obtain the location information of the database table corresponding to the structure information according to the identifier of the structure information, and determine the database table corresponding to the location information in the first storage system. The database table includes at least the retrieval information and the retrieval information. Corresponding data.
可选的,由于该数据库表中第一行的数据项不存在,则还可以根据该目标数据项在该结构信息的位置,确定在该数据库表中目标数据项对应的列。Optionally, since the data item of the first row in the database table does not exist, the corresponding column of the target data item in the database table may also be determined according to the position of the target data item in the structural information.
例如,根据第一结构信息的标识ID1,从表4所示的标识与位置信息的对应关系中获取对应的位置信息Position1,在第一存储系统中确定出该位置信息Position1对应的户籍信息表,户籍信息表中包括身份证号No1和与No1相对应的数据,该数据包括姓名“Name1”、户口地址“Address1”以及民族“汉”。For example, according to the identifier ID1 of the first structure information, the corresponding position information Position1 is obtained from the correspondence between the identifier and the position information shown in Table 4, and the household registration information table corresponding to the position information Position1 is determined in the first storage system. The household registration information table includes the ID number No1 and data corresponding to No1, and the data includes the name "Name1", the household address "Address1", and the ethnic group "Han".
目标数据项“身份证号”排在第一结构信息中的第一个位置,根据该第一个位置确定在户籍信息表中目标数据项“身份证号”对应的列为第一列。The target data item "ID card number" is ranked at the first position in the first structure information, and the column corresponding to the target data item "ID card number" in the household registration information table is determined as the first column according to the first position.
根据第二结构信息的标识ID2,从表4所示的标识与位置信息的对应关系中获取对应的位置信息Position2,在第一存储系统中确定出该位置信息Position2对应的学历信息表,学历信息表中包括身份证号No2和与No2相对应的数据,该数据包括姓名“Name1”、学历“本科”以及学校“北京###大学”。According to the identifier ID2 of the second structure information, the corresponding position information Position2 is obtained from the correspondence between the identifier and the position information shown in Table 4, and the academic information table corresponding to the position information Position2 is determined in the first storage system. The table includes ID number No2 and data corresponding to No2, which includes the name "Name1", education "undergraduate", and the school "Beijing ### 大学".
目标数据项“身份证号”排在第二结构信息中的第一个位置,根据该第一个位置确定在学历信息表中目标数据项“身份证号”对应的列为第一列。The target data item "ID card number" is ranked at the first position in the second structure information, and the column corresponding to the target data item "ID card number" in the academic information table is determined as the first column according to the first position.
2064:根据该检索信息在该数据库表查询该检索信息对应的数据,发送查询到的数据。2064: Query data corresponding to the search information in the database table according to the search information, and send the queried data.
可选的,在该数据库表中目标数据项对应的列中寻找出与该检索信息相同的数据,获取位于该数据所在行中的其他数据,该其他数据即为查询到的该检索信息对应的数据。Optionally, find the same data as the search information in the column corresponding to the target data item in the database table, and obtain other data located in the row where the data is located, and the other data is the query information corresponding to the search information. data.
例如,根据身份证号“No1”,在户籍信息表中的第一列中查找出身份证号“No1”,在身份证号“No1”所在行中获取其他数据,包括姓名“Name1”、户口地址“Address1”以及民族“汉”;根据身份证号“No1”,在学历信息表中的第一列中查找出身份证号“No1”,在身份证号“No1”所在行中获取其他数据,包括姓名“Name1”、学历“本科”以及学校“北京###大学”。然后,可以将从各数据库表中获取的数据进行融合并发送融合后的数据。For example, according to the ID number "No1", look up the ID number "No1" in the first column in the household registration information table, and obtain other data in the row where the ID number "No1" is located, including the name "Name1", household registration Address "Address1" and ethnic "Han"; according to the ID number "No1", look up the ID number "No1" in the first column of the academic information table, and get other data in the row where the ID number "No1" is located , Including name "Name1", education "undergraduate", and school "北京 ### 大学". Then, the data obtained from each database table can be fused and the fused data can be sent.
在本申请实施例中,源数据层中的每个数据库都有各自对应的业务,对于每个业务,可以从该业务对应的数据库中查询属于该业务的数据;当需要查询多个数据库时,由于在第一存储系统中存储有源数据层中的每个数据库表中的每个数据库表中的数据,以及在第二存储系统中存储每个数据库表对应的结构信息,这样在查询各数据库中的数据时,可以根据第二存储系统中的各结构信息,查询第一存储系统,从而不需要查询源数据层中的各数据库,不会对各数据库对应的原业务访问数据库产生影响。In the embodiment of the present application, each database in the source data layer has its own corresponding service. For each service, data belonging to the service can be queried from the database corresponding to the service; when multiple databases need to be queried, Since the data in each database table in each database table in the active data layer is stored in the first storage system, and the structural information corresponding to each database table is stored in the second storage system, each database is queried in this way. When the data is stored, the first storage system can be queried according to the structural information in the second storage system, so that it is not necessary to query the databases in the source data layer, and it will not affect the original business access database corresponding to each database.
下述为本申请装置实施例,可以用于执行本申请方法实施例。对于本申请装置实施例中未披露的细节,请参照本申请方法实施例。The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
参见图3,本申请实施例提供了一种数据库系统的建立装置300,其中,该系统包括存储层和源数据层,存储层包括第一存储系统和第二存储系统,源数据层包括多个数据库,该多个数据库中的每个数据库包括至少一个数据库表,每个数据库包括的每个数据库表用于存储数据。Referring to FIG. 3, an embodiment of the present application provides a device 300 for establishing a database system, where the system includes a storage layer and a source data layer, the storage layer includes a first storage system and a second storage system, and the source data layer includes a plurality of A database, each of the plurality of databases includes at least one database table, and each database table included in each database is used to store data.
该装置300包括:The device 300 includes:
读取模块301,用于目标数据库表的结构信息和所述目标数据库表中的数据;The reading module 301 is used for structural information of a target database table and data in the target database table;
存储模块302,用于将所述结构信息存储在所述第二存储系统,将所述目标数据库表中的数据存储在所述第一存储系统;将所述结构信息的标识和所述目 标数据库表中的数据在所述第一存储系统中的位置信息对应保存在所述第二存储系统中的标识与位置信息对应关系中。A storage module 302, configured to store the structure information in the second storage system, store data in the target database table in the first storage system, and store the identifier of the structure information and the target database The position information of the data in the table in the first storage system is correspondingly stored in the correspondence between the identifier and the position information in the second storage system.
可选的,所述装置300还包括:Optionally, the apparatus 300 further includes:
查询模块,用于根据待查询的检索信息,在所述存储层中查询所述检索信息对应的数据。The query module is configured to query data corresponding to the search information in the storage layer according to the search information to be queried.
可选的,所述查询模块包括:确定单元、获取单元和查询单元;Optionally, the query module includes: a determination unit, an acquisition unit, and a query unit;
所述确定单元,用于确定所述待查询的检索信息所属的目标数据项;The determining unit is configured to determine a target data item to which the search information to be queried belongs;
所述获取单元,用于从所述第二存储系统中获取包括所述目标数据项的结构信息;根据所述结构信息的标识,从所述第二存储系统中获取对应的位置信息;The obtaining unit is configured to obtain structure information including the target data item from the second storage system; and obtain corresponding position information from the second storage system according to an identifier of the structure information;
所述确定单元,还用于根据所述位置信息,确定出对应的确定出对应的数据库表;The determining unit is further configured to determine a corresponding database table according to the location information;
所述查询单元,用于根据所述检索信息在所述数据库表查询所述检索信息对应的数据。The query unit is configured to query data corresponding to the search information in the database table according to the search information.
在本申请实施例中,由于在第一存储系统中存储有源数据层中的每个数据库表中的每个数据表中的数据,以及在第二存储系统中存储每个数据库表对应的结构信息,这样在查询各数据库中的数据时,可以根据第二存储系统中的各结构信息,查询第一存储系统,从而不需要查询源数据层中的各数据库,不会对各数据库对应的原业务访问数据库产生影响。另外,该存储系统还具有冗错的功能,就是在源数据层中的某个数据库表出现故障时,由于第一存储系统中保存有该数据库表,所以可以第一存储系统恢复该数据库表。In the embodiment of the present application, since data in each data table in each database table in the active data layer is stored in the first storage system, and a structure corresponding to each database table is stored in the second storage system Information, so when querying the data in each database, you can query the first storage system based on the structural information in the second storage system, so there is no need to query each database in the source data layer, and the original data corresponding to each database will not be Business access to the database has an impact. In addition, the storage system has a redundant function. When a database table in the source data layer fails, the first storage system can restore the database table because the database table is stored in the first storage system.
关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be described in detail here.
图4示出了本发明一个示例性实施例提供的终端400的结构框图。该终端400可以用于运行采集转换层3中的建立装置或者该终端400可以为采集转换层3中的建立装置,该终端400可以是笔记本电脑或台式电脑等。终端400还可能被称为用户设备、便携式终端、膝上型终端、台式终端等其他名称。FIG. 4 shows a structural block diagram of a terminal 400 provided by an exemplary embodiment of the present invention. The terminal 400 may be used to run the establishment device in the acquisition conversion layer 3 or the terminal 400 may be the establishment device in the acquisition conversion layer 3, and the terminal 400 may be a laptop computer or a desktop computer. The terminal 400 may also be called other names such as user equipment, portable terminal, laptop terminal, desktop terminal, and the like.
通常,终端400包括有:处理器401和存储器402。Generally, the terminal 400 includes a processor 401 and a memory 402.
处理器401可以包括一个或多个处理核心,比如4核心处理器、8核心处理 器等。处理器401可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器401也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central Processing Unit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器401可以在集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器401还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。The processor 401 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 401 may use at least one hardware form among DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). achieve. The processor 401 may also include a main processor and a co-processor. The main processor is a processor for processing data in the wake-up state, also called a CPU (Central Processing Unit). The co-processor is Low-power processor for processing data in standby. In some embodiments, the processor 401 may be integrated with a GPU (Graphics Processing Unit), and the GPU is responsible for rendering and drawing content required to be displayed on the display screen. In some embodiments, the processor 401 may further include an AI (Artificial Intelligence) processor, and the AI processor is configured to process computing operations related to machine learning.
存储器402可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器402还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。在一些实施例中,存储器402中的非暂态的计算机可读存储介质用于存储至少一个指令,该至少一个指令用于被处理器401所执行以实现本申请中方法实施例提供的多源结构化数据库系统的建立方法。The memory 402 may include one or more computer-readable storage media, which may be non-transitory. The memory 402 may also include high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 402 is used to store at least one instruction, and the at least one instruction is used to be executed by the processor 401 to implement the multiple sources provided by the method embodiments in this application. Method for establishing structured database system.
在一些实施例中,终端400还可选包括有:外围设备接口403和至少一个外围设备。处理器401、存储器402和外围设备接口403之间可以通过总线或信号线相连。各个外围设备可以通过总线、信号线或电路板与外围设备接口403相连。具体地,外围设备包括:射频电路404、触摸显示屏405、摄像头406、音频电路407、定位组件408和电源409中的至少一种。In some embodiments, the terminal 400 may optionally include a peripheral device interface 403 and at least one peripheral device. The processor 401, the memory 402, and the peripheral device interface 403 may be connected through a bus or a signal line. Each peripheral device can be connected to the peripheral device interface 403 through a bus, a signal line, or a circuit board. Specifically, the peripheral device includes at least one of a radio frequency circuit 404, a touch display screen 405, a camera 406, an audio circuit 407, a positioning component 408, and a power source 409.
外围设备接口403可被用于将I/O(Input/Output,输入/输出)相关的至少一个外围设备连接到处理器401和存储器402。在一些实施例中,处理器401、存储器402和外围设备接口403被集成在同一芯片或电路板上;在一些其他实施例中,处理器401、存储器402和外围设备接口403中的任意一个或两个可以在单独的芯片或电路板上实现,本实施例对此不加以限定。The peripheral device interface 403 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 401 and the memory 402. In some embodiments, the processor 401, the memory 402, and the peripheral device interface 403 are integrated on the same chip or circuit board; in some other embodiments, any one of the processor 401, the memory 402, and the peripheral device interface 403 or Both can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
射频电路404用于接收和发射RF(Radio Frequency,射频)信号,也称电磁信号。射频电路404通过电磁信号与通信网络以及其他通信设备进行通信。射频电路404将电信号转换为电磁信号进行发送,或者,将接收到的电磁信号转换为电信号。可选地,射频电路404包括:天线系统、RF收发器、一个或多个放大器、调谐器、振荡器、数字信号处理器、编解码芯片组、用户身份模块 卡等等。射频电路404可以通过至少一种无线通信协议来与其它终端进行通信。该无线通信协议包括但不限于:万维网、城域网、内联网、各代移动通信网络(2G、3G、4G及5G)、无线局域网和/或WiFi(Wireless Fidelity,无线保真)网络。在一些实施例中,射频电路404还可以包括NFC(Near Field Communication,近距离无线通信)有关的电路,本申请对此不加以限定。The radio frequency circuit 404 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuit 404 communicates with a communication network and other communication devices through electromagnetic signals. The radio frequency circuit 404 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 404 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and the like. The radio frequency circuit 404 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocols include, but are not limited to, the World Wide Web, metropolitan area networks, intranets, mobile communication networks (2G, 3G, 4G, and 5G) of various generations, wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 404 may further include circuits related to Near Field Communication (NFC), which is not limited in this application.
显示屏405用于显示UI(User Interface,用户界面)。该UI可以包括图形、文本、图标、视频及其它们的任意组合。当显示屏405是触摸显示屏时,显示屏405还具有采集在显示屏405的表面或表面上方的触摸信号的能力。该触摸信号可以作为控制信号输入至处理器401进行处理。此时,显示屏405还可以用于提供虚拟按钮和/或虚拟键盘,也称软按钮和/或软键盘。在一些实施例中,显示屏405可以为一个,设置终端400的前面板;在另一些实施例中,显示屏405可以为至少两个,分别设置在终端400的不同表面或呈折叠设计;在再一些实施例中,显示屏405可以是柔性显示屏,设置在终端400的弯曲表面上或折叠面上。甚至,显示屏405还可以设置成非矩形的不规则图形,也即异形屏。显示屏405可以采用LCD(Liquid Crystal Display,液晶显示屏)、OLED(Organic Light-Emitting Diode,有机发光二极管)等材质制备。The display screen 405 is used to display a UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 405 is a touch display screen, the display screen 405 also has the ability to collect touch signals on or above the surface of the display screen 405. The touch signal can be input as a control signal to the processor 401 for processing. At this time, the display screen 405 may also be used to provide a virtual button and / or a virtual keyboard, which is also called a soft button and / or a soft keyboard. In some embodiments, the display screen 405 may be one, and the front panel of the terminal 400 is provided; in other embodiments, the display screen 405 may be at least two, which are respectively disposed on different surfaces of the terminal 400 or have a folded design; In still other embodiments, the display screen 405 may be a flexible display screen disposed on a curved surface or a folded surface of the terminal 400. Moreover, the display screen 405 can also be set as a non-rectangular irregular figure, that is, a special-shaped screen. The display screen 405 can be made of materials such as LCD (Liquid Crystal Display) and OLED (Organic Light-Emitting Diode).
摄像头组件406用于采集图像或视频。可选地,摄像头组件406包括前置摄像头和后置摄像头。通常,前置摄像头设置在终端的前面板,后置摄像头设置在终端的背面。在一些实施例中,后置摄像头为至少两个,分别为主摄像头、景深摄像头、广角摄像头、长焦摄像头中的任意一种,以实现主摄像头和景深摄像头融合实现背景虚化功能、主摄像头和广角摄像头融合实现全景拍摄以及VR(Virtual Reality,虚拟现实)拍摄功能或者其它融合拍摄功能。在一些实施例中,摄像头组件406还可以包括闪光灯。闪光灯可以是单色温闪光灯,也可以是双色温闪光灯。双色温闪光灯是指暖光闪光灯和冷光闪光灯的组合,可以用于不同色温下的光线补偿。The camera component 406 is used for capturing images or videos. Optionally, the camera component 406 includes a front camera and a rear camera. Generally, the front camera is disposed on the front panel of the terminal, and the rear camera is disposed on the back of the terminal. In some embodiments, there are at least two rear cameras, each of which is a main camera, a depth-of-field camera, a wide-angle camera, and a telephoto camera, so as to realize the integration of the main camera and the depth-of-field camera. Integrate with a wide-angle camera to achieve panoramic shooting and VR (Virtual Reality, virtual reality) shooting functions or other fusion shooting functions. In some embodiments, the camera assembly 406 may further include a flash. The flash can be a monochrome temperature flash or a dual color temperature flash. A dual color temperature flash is a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.
音频电路407可以包括麦克风和扬声器。麦克风用于采集用户及环境的声波,并将声波转换为电信号输入至处理器401进行处理,或者输入至射频电路404以实现语音通信。出于立体声采集或降噪的目的,麦克风可以为多个,分别设置在终端400的不同部位。麦克风还可以是阵列麦克风或全向采集型麦克风。扬声器则用于将来自处理器401或射频电路404的电信号转换为声波。扬声器可以是传统的薄膜扬声器,也可以是压电陶瓷扬声器。当扬声器是压电陶瓷扬 声器时,不仅可以将电信号转换为人类可听见的声波,也可以将电信号转换为人类听不见的声波以进行测距等用途。在一些实施例中,音频电路407还可以包括耳机插孔。The audio circuit 407 may include a microphone and a speaker. The microphone is used to collect sound waves of the user and the environment, and convert the sound waves into electrical signals and input them to the processor 401 for processing, or input them to the radio frequency circuit 404 to implement voice communication. For the purpose of stereo collection or noise reduction, there may be multiple microphones, which are respectively disposed at different parts of the terminal 400. The microphone can also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert electrical signals from the processor 401 or the radio frequency circuit 404 into sound waves. The speaker can be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert electrical signals into sound waves audible to humans, but also convert electrical signals into sound waves inaudible to humans for ranging purposes. In some embodiments, the audio circuit 407 may further include a headphone jack.
定位组件408用于定位终端400的当前地理位置,以实现导航或LBS(Location Based Service,基于位置的服务)。定位组件408可以是基于美国的GPS(Global Positioning System,全球定位系统)、中国的北斗系统或俄罗斯的伽利略系统的定位组件。The positioning component 408 is used to locate the current geographic position of the terminal 400 to implement navigation or LBS (Location Based Service). The positioning component 408 may be a positioning component based on a US-based GPS (Global Positioning System), a Beidou system in China, or a Galileo system in Russia.
电源409用于为终端400中的各个组件进行供电。电源409可以是交流电、直流电、一次性电池或可充电电池。当电源409包括可充电电池时,该可充电电池可以是有线充电电池或无线充电电池。有线充电电池是通过有线线路充电的电池,无线充电电池是通过无线线圈充电的电池。该可充电电池还可以用于支持快充技术。The power supply 409 is used to power various components in the terminal 400. The power source 409 may be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power source 409 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.
在一些实施例中,终端400还包括有一个或多个传感器410。该一个或多个传感器410包括但不限于:加速度传感器411、陀螺仪传感器412、压力传感器413、指纹传感器414、光学传感器415以及接近传感器416。In some embodiments, the terminal 400 further includes one or more sensors 410. The one or more sensors 410 include, but are not limited to, an acceleration sensor 411, a gyroscope sensor 412, a pressure sensor 413, a fingerprint sensor 414, an optical sensor 415, and a proximity sensor 416.
加速度传感器411可以检测以终端400建立的坐标系的三个坐标轴上的加速度大小。比如,加速度传感器411可以用于检测重力加速度在三个坐标轴上的分量。处理器401可以根据加速度传感器411采集的重力加速度信号,控制触摸显示屏405以横向视图或纵向视图进行用户界面的显示。加速度传感器411还可以用于游戏或者用户的运动数据的采集。The acceleration sensor 411 can detect the magnitude of acceleration on three coordinate axes of the coordinate system established by the terminal 400. For example, the acceleration sensor 411 may be used to detect components of the acceleration of gravity on three coordinate axes. The processor 401 may control the touch display screen 405 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 411. The acceleration sensor 411 may also be used for collecting motion data of a game or a user.
陀螺仪传感器412可以检测终端400的机体方向及转动角度,陀螺仪传感器412可以与加速度传感器411协同采集用户对终端400的3D动作。处理器401根据陀螺仪传感器412采集的数据,可以实现如下功能:动作感应(比如根据用户的倾斜操作来改变UI)、拍摄时的图像稳定、游戏控制以及惯性导航。The gyro sensor 412 can detect the body direction and rotation angle of the terminal 400, and the gyro sensor 412 can cooperate with the acceleration sensor 411 to collect a 3D motion of the user on the terminal 400. Based on the data collected by the gyro sensor 412, the processor 401 can implement the following functions: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.
压力传感器413可以设置在终端400的侧边框和/或触摸显示屏405的下层。当压力传感器413设置在终端400的侧边框时,可以检测用户对终端400的握持信号,由处理器401根据压力传感器413采集的握持信号进行左右手识别或快捷操作。当压力传感器413设置在触摸显示屏405的下层时,由处理器401根据用户对触摸显示屏405的压力操作,实现对UI界面上的可操作性控件进行控制。可操作性控件包括按钮控件、滚动条控件、图标控件、菜单控件中的至少一种。The pressure sensor 413 may be disposed on a side frame of the terminal 400 and / or a lower layer of the touch display screen 405. When the pressure sensor 413 is disposed on the side frame of the terminal 400, a user's holding signal to the terminal 400 can be detected, and the processor 401 can perform left-right hand recognition or quick operation according to the holding signal collected by the pressure sensor 413. When the pressure sensor 413 is disposed on the lower layer of the touch display screen 405, the processor 401 operates according to the user's pressure operation on the touch display screen 405 to control the operable controls on the UI interface. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.
指纹传感器414用于采集用户的指纹,由处理器401根据指纹传感器414采集到的指纹识别用户的身份,或者,由指纹传感器414根据采集到的指纹识别用户的身份。在识别出用户的身份为可信身份时,由处理器401授权该用户执行相关的敏感操作,该敏感操作包括解锁屏幕、查看加密信息、下载软件、支付及更改设置等。指纹传感器414可以被设置终端400的正面、背面或侧面。当终端400上设置有物理按键或厂商Logo时,指纹传感器414可以与物理按键或厂商Logo集成在一起。The fingerprint sensor 414 is used to collect a user's fingerprint, and the processor 401 recognizes the identity of the user based on the fingerprint collected by the fingerprint sensor 414, or the fingerprint sensor 414 identifies the identity of the user based on the collected fingerprint. When the user's identity is identified as trusted, the processor 401 authorizes the user to perform related sensitive operations, such as unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings. The fingerprint sensor 414 may be provided on the front, back, or side of the terminal 400. When a physical button or a manufacturer's logo is set on the terminal 400, the fingerprint sensor 414 can be integrated with the physical button or the manufacturer's logo.
光学传感器415用于采集环境光强度。在一个实施例中,处理器401可以根据光学传感器415采集的环境光强度,控制触摸显示屏405的显示亮度。具体地,当环境光强度较高时,调高触摸显示屏405的显示亮度;当环境光强度较低时,调低触摸显示屏405的显示亮度。在另一个实施例中,处理器401还可以根据光学传感器415采集的环境光强度,动态调整摄像头组件406的拍摄参数。The optical sensor 415 is used to collect ambient light intensity. In one embodiment, the processor 401 may control the display brightness of the touch display screen 405 according to the ambient light intensity collected by the optical sensor 415. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 405 is increased; when the ambient light intensity is low, the display brightness of the touch display screen 405 is decreased. In another embodiment, the processor 401 may also dynamically adjust the shooting parameters of the camera component 406 according to the ambient light intensity collected by the optical sensor 415.
接近传感器416,也称距离传感器,通常设置在终端400的前面板。接近传感器416用于采集用户与终端400的正面之间的距离。在一个实施例中,当接近传感器416检测到用户与终端400的正面之间的距离逐渐变小时,由处理器401控制触摸显示屏405从亮屏状态切换为息屏状态;当接近传感器416检测到用户与终端400的正面之间的距离逐渐变大时,由处理器401控制触摸显示屏405从息屏状态切换为亮屏状态。The proximity sensor 416, also called a distance sensor, is usually disposed on the front panel of the terminal 400. The proximity sensor 416 is used to collect the distance between the user and the front side of the terminal 400. In one embodiment, when the proximity sensor 416 detects that the distance between the user and the front of the terminal 400 becomes gradually smaller, the processor 401 controls the touch display screen 405 to switch from the bright screen state to the closed screen state; when the proximity sensor 416 detects When the distance between the user and the front side of the terminal 400 gradually becomes larger, the processor 401 controls the touch display screen 405 to switch from the on-screen state to the on-screen state.
本领域技术人员可以理解,图4中示出的结构并不构成对终端400的限定,可以包括比图示更多或更少的组件,或者组合某些组件,或者采用不同的组件布置。Those skilled in the art can understand that the structure shown in FIG. 4 does not constitute a limitation on the terminal 400, and may include more or fewer components than shown in the figure, or combine certain components, or adopt different component arrangements.
本领域技术人员在考虑说明书及实践这里公开的申请后,将容易想到本申请的其它实施方案。本申请旨在涵盖本申请的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本申请的一般性原理并包括本申请未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本申请的真正范围和精神由下面的权利要求指出。Those skilled in the art will readily think of other embodiments of the present application after considering the specification and practicing the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application. These variations, uses, or adaptations follow the general principles of this application and include common general knowledge or conventional technical means in the technical field not disclosed in this application. . It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围进行各种修改和改变。本申请的范围仅由所附的权利要求来限制。It should be understood that the present application is not limited to the precise structure that has been described above and shown in the drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the application is limited only by the accompanying claims.

Claims (10)

  1. 一种数据库系统,其特征在于,包括:A database system, comprising:
    存储层和源数据层,所述存储层包括第一存储系统和第二存储系统,所述源数据层包括多个数据库,所述多个数据库中的每个数据库包括至少一个数据库表,所述每个数据库包括的每个数据库表用于存储数据;A storage layer and a source data layer, the storage layer including a first storage system and a second storage system, the source data layer including a plurality of databases, each of the plurality of databases including at least one database table, the Each database table included in each database is used to store data;
    所述第一存储系统,用于存储所述每个数据库包括的每个数据库表中存储的数据;The first storage system is configured to store data stored in each database table included in each database;
    所述第二存储系统,用于存储目标数据库表对应的结构信息,以及存储所述结构信息的标识与位置信息的对应关系,所述位置信息包括所述目标数据库表包括的数据在所述第一存储系统中的存储位置,所述结构信息包括所述目标数据库表中的各数据项,所述目标数据库表为所述多个数据库中的任一数据库中的数据库表。The second storage system is configured to store structure information corresponding to a target database table and store a correspondence between an identifier of the structure information and location information, where the location information includes data included in the target database table in the first A storage location in a storage system, the structure information includes each data item in the target database table, and the target database table is a database table in any one of the plurality of databases.
  2. 如权利要求1所述的系统,其特征在于,所述第一存储系统为Hadoop分布式文件系统HDFS,所述第二存储系统为关系数据库管理系统RDMS。The system of claim 1, wherein the first storage system is a Hadoop distributed file system (HDFS), and the second storage system is a relational database management system (RDMS).
  3. 如权利要求1所述的系统,其特征在于,所述源数据层包括的数据库类型为Oracle、MySQL和HDFS中的一种或多种。The system according to claim 1, wherein the source data layer comprises one or more of Oracle, MySQL, and HDFS.
  4. 一种数据库系统的建立方法,其特征在于,所述数据库系统为如权利要求1至3任一项所述的系统,所述方法包括:A method for establishing a database system, wherein the database system is a system according to any one of claims 1 to 3, and the method includes:
    读取所述目标数据库表的结构信息和所述目标数据库表中的数据;Reading structure information of the target database table and data in the target database table;
    将所述结构信息存储在所述第二存储系统,将所述目标数据库表中的数据存储在所述第一存储系统;Storing the structural information in the second storage system, and storing data in the target database table in the first storage system;
    将所述结构信息的标识和所述目标数据库表中的数据在所述第一存储系统中的位置信息对应保存在所述第二存储系统中的标识与位置信息对应关系中。The identifier of the structural information and the location information of the data in the target database table in the first storage system are correspondingly stored in a correspondence between the identifier and the location information in the second storage system.
  5. 如权利要求4所述的方法,其特征在于,所述将所述目标数据库表中的数据存储在所述第一存储系统之后,还包括:The method according to claim 4, wherein after storing the data in the target database table in the first storage system, further comprising:
    定期或不定期地读取所述目标数据库表中的数据,根据所述目标数据库表 的结构信息的标识从所述标识与位置信息的对应关系中获取所述目标数据库表对应的位置信息,根据所述位置信息确定出所述第一存储系统中保存的所述目标数据库表包括的数据,将所述第一存储系统中保存的所述目标数据库表包括的数据替换为读取的所述目标数据库表中的数据。Periodically or irregularly read data in the target database table, and obtain position information corresponding to the target database table from the correspondence between the identifier and location information according to the identifier of the structure information of the target database table, according to The location information determines data included in the target database table stored in the first storage system, and replaces data included in the target database table stored in the first storage system with the read target Data in a database table.
  6. 如权利要求4所述的方法,其特征在于,所述方法还包括:The method according to claim 4, further comprising:
    根据待查询的检索信息,在所述存储层中查询所述检索信息对应的数据。According to the search information to be queried, query data corresponding to the search information in the storage layer.
  7. 如权利要求6所述的方法,其特征在于,所述根据待查询的检索信息,在所述存储层中查询所述检索信息对应的数据,包括:The method according to claim 6, wherein the querying data corresponding to the search information in the storage layer according to the search information to be queried comprises:
    确定待查询的检索信息所属的目标数据项;Determining the target data item to which the search information to be queried belongs;
    从所述第二存储系统中获取包括所述目标数据项的结构信息;Obtaining structural information including the target data item from the second storage system;
    根据所述结构信息的标识,从所述第二存储系统中获取对应的位置信息;Obtaining corresponding location information from the second storage system according to the identification of the structure information;
    根据所述位置信息,在所述第一存储系统中确定出对应的数据库表;Determining a corresponding database table in the first storage system according to the location information;
    根据所述检索信息在所述数据库表查询所述检索信息对应的数据。Query data corresponding to the search information in the database table according to the search information.
  8. 一种数据库系统的建立装置,其特征在于,所述数据库系统为如权利要求1至3任一项所述的系统,所述装置包括:A device for establishing a database system, wherein the database system is the system according to any one of claims 1 to 3, and the device includes:
    读取模块,用于读取目标数据库表的结构信息和所述目标数据库表中的数据;A reading module, configured to read the structure information of the target database table and the data in the target database table;
    存储模块,用于将所述结构信息存储在所述第二存储系统,将所述目标数据库表中的数据存储在所述第一存储系统;将所述结构信息的标识和所述目标数据库表中的数据在所述第一存储系统中的位置信息对应保存在所述第二存储系统中的标识与位置信息对应关系中。A storage module, configured to store the structure information in the second storage system, store data in the target database table in the first storage system, and store the identifier of the structure information and the target database table The position information of the data in the first storage system is correspondingly stored in the correspondence between the identifier and the position information in the second storage system.
  9. 如权利要求8所述的装置,其特征在于,所述装置还包括:The apparatus according to claim 8, further comprising:
    查询模块,用于根据待查询的检索信息,在所述存储层中查询所述检索信息对应的数据。The query module is configured to query data corresponding to the search information in the storage layer according to the search information to be queried.
  10. 如权利要求9所述的装置,其特征在于,所述查询模块包括:确定单 元、获取单元和查询单元;The apparatus according to claim 9, wherein the query module comprises: a determination unit, an acquisition unit, and a query unit;
    所述确定单元,用于确定所述待查询的检索信息所属的目标数据项;The determining unit is configured to determine a target data item to which the search information to be queried belongs;
    所述获取单元,用于从所述第二存储系统中获取包括所述目标数据项的结构信息;根据所述结构信息的标识,从所述第二存储系统中获取对应的位置信息;The obtaining unit is configured to obtain structure information including the target data item from the second storage system; and obtain corresponding position information from the second storage system according to an identifier of the structure information;
    所述确定单元,还用于根据所述位置信息,确定出对应的确定出对应的数据库表;The determining unit is further configured to determine a corresponding database table according to the location information;
    所述查询单元,用于根据所述检索信息在所述数据库表查询所述检索信息对应的数据。The query unit is configured to query data corresponding to the search information in the database table according to the search information.
PCT/CN2019/087242 2018-05-23 2019-05-16 Database system, and establishment method and apparatus therefor WO2019223601A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810502231.0 2018-05-23
CN201810502231.0A CN110597801B (en) 2018-05-23 2018-05-23 Database system and establishing method and device thereof

Publications (1)

Publication Number Publication Date
WO2019223601A1 true WO2019223601A1 (en) 2019-11-28

Family

ID=68616176

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/087242 WO2019223601A1 (en) 2018-05-23 2019-05-16 Database system, and establishment method and apparatus therefor

Country Status (2)

Country Link
CN (1) CN110597801B (en)
WO (1) WO2019223601A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111309709A (en) * 2020-02-20 2020-06-19 全球能源互联网研究院有限公司 Database establishing and retrieving method and device
CN112818752A (en) * 2021-01-11 2021-05-18 中国石油天然气集团有限公司 Method and apparatus for safety management of product processing system

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111538713B (en) * 2020-04-02 2023-10-17 咪咕文化科技有限公司 Hive-oriented multi-mode data processing method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103942209A (en) * 2013-01-18 2014-07-23 阿里巴巴集团控股有限公司 Data processing method
US20160092557A1 (en) * 2014-09-26 2016-03-31 Oracle International Corporation Techniques for similarity analysis and data enrichment using knowledge sources
CN105630847A (en) * 2014-11-21 2016-06-01 深圳市腾讯计算机系统有限公司 Data storage method as well as data query method, apparatus and system
CN105956015A (en) * 2016-04-22 2016-09-21 四川中软科技有限公司 Service platform integration method based on big data
CN106294009A (en) * 2016-08-05 2017-01-04 北京小米移动软件有限公司 Database filing method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103942209A (en) * 2013-01-18 2014-07-23 阿里巴巴集团控股有限公司 Data processing method
US20160092557A1 (en) * 2014-09-26 2016-03-31 Oracle International Corporation Techniques for similarity analysis and data enrichment using knowledge sources
CN105630847A (en) * 2014-11-21 2016-06-01 深圳市腾讯计算机系统有限公司 Data storage method as well as data query method, apparatus and system
CN105956015A (en) * 2016-04-22 2016-09-21 四川中软科技有限公司 Service platform integration method based on big data
CN106294009A (en) * 2016-08-05 2017-01-04 北京小米移动软件有限公司 Database filing method and system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111309709A (en) * 2020-02-20 2020-06-19 全球能源互联网研究院有限公司 Database establishing and retrieving method and device
CN111309709B (en) * 2020-02-20 2023-05-23 全球能源互联网研究院有限公司 Database building and searching method and device
CN112818752A (en) * 2021-01-11 2021-05-18 中国石油天然气集团有限公司 Method and apparatus for safety management of product processing system

Also Published As

Publication number Publication date
CN110597801A (en) 2019-12-20
CN110597801B (en) 2021-09-17

Similar Documents

Publication Publication Date Title
CN108833607B (en) Physical address acquisition method, device and readable medium
WO2021164321A1 (en) Block processing method and apparatus, and data query method and apparatus based on blockchain
CN108717432B (en) Resource query method and device
WO2020001564A1 (en) Method, apparatus, and system for processing tasks
WO2022227623A1 (en) Method for displaying publish progress, and electronic device
WO2019223601A1 (en) Database system, and establishment method and apparatus therefor
CN111090687B (en) Data processing method, device and system and computer readable storage medium
US10675541B2 (en) Control method of scene sound effect and related products
US20220155939A1 (en) Icon display method and mobile terminal
WO2021120976A2 (en) Load balance control method and server
CN111694834A (en) Method, device and equipment for putting picture data into storage and readable storage medium
CN111104402A (en) Method, device, electronic equipment and medium for searching data
WO2020088542A1 (en) Data management method, apparatus and system, and server, terminal and storage medium
WO2023124729A1 (en) Data query method and apparatus, and device and storage medium
CN111192072B (en) User grouping method and device and storage medium
CN112181915B (en) Method, device, terminal and storage medium for executing service
CN110597868B (en) Information query method, device, terminal and storage medium based on block chain
CN110597840A (en) Partner relationship establishing method, device, equipment and storage medium based on block chain
CN113051485B (en) Group searching method, device, terminal and storage medium
CN112905328B (en) Task processing method, device and computer readable storage medium
CN114329292A (en) Resource information configuration method and device, electronic equipment and storage medium
WO2022052928A1 (en) Application access method and related apparatus
CN111125095B (en) Method, device, electronic equipment and medium for adding data prefix
CN110928867B (en) Data fusion method and device
CN110851435B (en) Data storage method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19808170

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19808170

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 19808170

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02/06/2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19808170

Country of ref document: EP

Kind code of ref document: A1