CN113420013A - Clickhouse-based interaction method and system, electronic device and storage medium - Google Patents

Clickhouse-based interaction method and system, electronic device and storage medium Download PDF

Info

Publication number
CN113420013A
CN113420013A CN202110799552.3A CN202110799552A CN113420013A CN 113420013 A CN113420013 A CN 113420013A CN 202110799552 A CN202110799552 A CN 202110799552A CN 113420013 A CN113420013 A CN 113420013A
Authority
CN
China
Prior art keywords
clickhouse
database
command
data
interaction method
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110799552.3A
Other languages
Chinese (zh)
Inventor
韩涛
裴玉超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Minglue Zhaohui Technology Co Ltd
Original Assignee
Beijing Minglue Zhaohui Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Minglue Zhaohui Technology Co Ltd filed Critical Beijing Minglue Zhaohui Technology Co Ltd
Priority to CN202110799552.3A priority Critical patent/CN113420013A/en
Publication of CN113420013A publication Critical patent/CN113420013A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/211Schema design and management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

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

Abstract

The invention provides an interaction method, a system, electronic equipment and a storage medium based on Clickhouse, wherein the technical scheme of the method comprises a database analysis connection step, wherein basic information for connecting the Clickhouse database is analyzed through a dynamic parameter, and the Clickhouse database is connected through jdbc; a data control processing step, namely, using jline to input and read a command of a console, receiving the input command, and performing data control processing by calling an http interface of the clickhouse database; and a data compression and decompression step, namely compressing and decompressing the data requested to the clickhouse database and the data returned to the clickhouse database by an lz4 compression algorithm. The method and the device solve the problems of complex installation, troublesome configuration and complex operation of the existing interaction method based on the Cl ickhouse.

Description

Clickhouse-based interaction method and system, electronic device and storage medium
Technical Field
The invention belongs to the technical field of databases, and particularly relates to an interaction method and system based on Clickhouse, electronic equipment and a storage medium.
Background
With the continuous development of the internet and the internet of things, a large amount of data needs to be stored and analyzed, numerous big data tools can play the roles of the data tools, and the clickhouse is used as a column storage database for open-source real-time data analysis, so that the high-efficiency data processing speed of the data tools is more widely used. However, when the traditional mysql database is used, interactive operation can be performed through the mysql command line and the mysql database, but the clickhouse needs to implement data interaction processing by installing a clickhouse-client or calling an http interface thereof, so that a remote server connected with the clickhouse needs to additionally install the clickhouse-client or call http by using a curl, which is very cumbersome and increases the workload of operation and maintenance of records of related commands.
In the prior art, one of the methods can install a clickhouse-client on a called server, but the method is cumbersome to install: a clickhouse-client needs to be installed independently, extra dependence is needed for installation, an updated configuration source needs to be added independently, the process is complex, and the time consumption is long; the configuration is troublesome, a plurality of configuration files still need to be independently modified for use after the clickhouse-client is installed, and the configuration is relatively complex; poor portability: and each new server needs to completely re-deploy a new clickhouse-client and perform corresponding configuration modification.
In the second prior art, a clickhouse-server is called through a curl command to externally expose an http interface, different parameters are transmitted and a database is interacted, but the method is complex in operation: the called api corresponding to different operations needs to be known; the parameters to be transmitted are difficult to remember, and the parameter data structure is more complex; the command line is difficult to use, namely the http service can be called by using the curl, but a plurality of parameters need to be spliced, and time is wasted; repeatedly filling: each call needs to repeatedly fill parameters such as url, database name, authentication information and the like of the request, and even if the call uses curl, a large string needs to be spliced to initiate the call.
Disclosure of Invention
The embodiment of the application provides an interaction method, an interaction system, electronic equipment and a storage medium based on a Clickhouse, and aims to at least solve the problems of complex installation, troublesome configuration and complex operation of the existing interaction method based on the Clickhouse.
In a first aspect, an embodiment of the present application provides an interaction method based on Clickhouse, including: analyzing and connecting the databases, analyzing the basic information connected with the clickhouse database through a dynamic parameter, and connecting the clickhouse database through jdbc; a data control processing step, namely, using jline to input and read a command of a console, receiving the input command, and performing data control processing by calling an http interface of the clickhouse database; and a data compression and decompression step, namely compressing and decompressing the data requested to the clickhouse database and the data returned to the clickhouse database by an lz4 compression algorithm.
Preferably, the method further comprises: and a database analysis switching step, wherein when the database is switched, the switched database name is analyzed by dynamically receiving a database switching command, and the switched database is used through the command operation.
Preferably, the method further comprises: and a history operation saving step, namely locally saving the command, loading the history operation command stored locally when the clickhouse database is started by using a script, and inquiring the history operation command through the shell.
Preferably, the database parsing and connecting step further includes: writing codes to realize the transmission of the dynamic parameters, reading and verifying the dynamic parameters, and connecting the verified dynamic parameters to the clickhouse database through an http interface externally provided by the clickhouse database after the verified dynamic parameters are packaged.
In a second aspect, an embodiment of the present application provides an interaction system based on Clickhouse, which is suitable for the above interaction method based on Clickhouse, and includes: the database analysis connection module is used for analyzing the basic information connected with the clickhouse database through a dynamic parameter and connecting the clickhouse database through jdbc; the data control processing module is used for inputting and reading commands of the console by using jline, receiving the input commands and controlling and processing data by calling an http interface of the clickhouse database; and the data compression and decompression module is used for compressing and decompressing the data requested to the clickhouse database and the data returned to the clickhouse database by an lz4 compression algorithm.
In some of these embodiments, the system further comprises: and the database analysis switching module is used for analyzing the switched database name and using the switched database through the command operation by dynamically receiving a database switching command when switching the database.
In some of these embodiments, the system further comprises: and the historical operation storage module is used for locally storing the command, loading the historical operation command stored locally when the clickhouse database is started by using a script, and inquiring the historical operation command through the shell.
In some embodiments, the database parsing connection module further comprises: writing codes to realize the transmission of the dynamic parameters, reading and verifying the dynamic parameters, and connecting the verified dynamic parameters to the clickhouse database through an http interface externally provided by the clickhouse database after the verified dynamic parameters are packaged.
In a third aspect, an embodiment of the present application provides an electronic device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor, when executing the computer program, implements the Clickhouse-based interaction method as described in the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a Clickhouse-based interaction method as described in the first aspect above.
The method and the device can be applied to the technical field of cloud service capability. Compared with the related art, the interaction method based on the Clickhouse provided by the embodiment of the application has the following advantages:
1. simple and easy to use: after jar and the script are directly uploaded, the script is started to transmit connection information, and a clickhouse can be connected for operation;
2. support for remote connection: supporting the connection of remote clickhouse databases, so that different clickhouse databases can be connected on one machine;
3. adapting the common commands: all commands for operating the clickhouse database are basically supported, a user does not need to remember extra complicated commands, the commands are basically matched with the commands used by a common database, and extra memory burden is not caused to the user;
4. supporting dynamic library switching: dynamic bank switching is carried out through the select dbname, and switching among different databases is facilitated;
5. support history input commands: history input commands are recorded, so that the previous operation commands are convenient to browse, and the efficiency is improved;
6. providing data transmission compression: the time of the interaction process is saved by compressing the data in the transmission process.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
FIG. 1 is a flow chart of a Clickhouse-based interaction method of the present invention;
FIG. 2 is a block diagram of a Clickhouse-based interactive system of the present invention;
FIG. 3 is a block diagram of an electronic device of the present invention;
in the above figures:
1. the database analysis connection module; 2. a data control processing module; 3. a data compression and decompression module; 4. the database analysis switching module; 5. a historical operation saving module; 60. a bus; 61. a processor; 62. a memory; 63. a communication interface.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments provided in the present application without any inventive step are within the scope of protection of the present application.
It is obvious that the drawings in the following description are only examples or embodiments of the present application, and that it is also possible for a person skilled in the art to apply the present application to other similar contexts on the basis of these drawings without inventive effort. Moreover, it should be appreciated that in the development of any such actual implementation, as in any engineering or design project, numerous implementation-specific decisions must be made to achieve the developers' specific goals, such as compliance with system-related and business-related constraints, which may vary from one implementation to another.
Reference in the specification to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the specification. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of ordinary skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments without conflict.
Unless defined otherwise, technical or scientific terms referred to herein shall have the ordinary meaning as understood by those of ordinary skill in the art to which this application belongs. Reference to "a," "an," "the," and similar words throughout this application are not to be construed as limiting in number, and may refer to the singular or the plural. The present application is directed to the use of the terms "including," "comprising," "having," and any variations thereof, which are intended to cover non-exclusive inclusions; for example, a process, method, system, article, or apparatus that comprises a list of steps or modules (elements) is not limited to the listed steps or elements, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Embodiments of the invention are described in detail below with reference to the accompanying drawings:
fig. 1 is a flowchart of an interaction method based on Clickhouse, please refer to fig. 1, and the interaction method based on Clickhouse includes the following steps:
s1: analyzing the basic information connected with the clickhouse database through a dynamic parameter, and connecting the clickhouse database through jdbc.
Optionally, a code is written to transmit the dynamic parameter, read and verify the dynamic parameter, and the verified dynamic parameter is packaged and then connected to the clickhouse database through an http interface provided externally by the clickhouse database.
In a specific implementation, the code is written to implement the function of interactively operating with clickhouse data volume, and the specific design scheme and steps are as follows:
a. the input of dynamic parameters is supported, the reading and the verification of the parameters can be carried out, and optionally, a prompt is printed if necessary parameters are not input. In specific implementation, the parameters supported by the embodiment of the present application are as follows:
Figure BDA0003164133250000061
Figure BDA0003164133250000071
b. the verified parameters are packaged, and then the verified parameters are connected with a clickhouse through an http interface externally provided by the clickhouse, optionally, a test of connection query can be performed through 'select 0', and if the query is in error, an error is printed out on a console;
s2: and using jline to input and read commands of the console, receiving the input commands, and calling an http interface of the clickhouse database to control and process data.
In specific implementation, a jline is used for monitoring and reading an input interactive command, a clickhouse http interface is called to carry out data interaction after the command is read, and an interaction result is obtained and printed on a console;
s3: and compressing and decompressing the data requested to the clickhouse database and the data returned to the clickhouse database by an lz4 compression algorithm.
In the specific implementation, in the process of interactive query with a clickhouse database through an http interface, in order to solve the problem of overlarge transmitted data volume, a lz4 compression algorithm is used for data compression before a request is transmitted and decompressing a request result, so that the query time is saved, and the response is faster.
S4: when the database is switched, the database name is analyzed and the switched database is used through the command operation by dynamically receiving a database switching command.
In specific implementation, aiming at a command for switching a database, a new database name is analyzed, a test sql is sent to carry out connection, if the connection is passed, the database name in a code cache is modified into the new database name, if the connection is passed, an error is returned to a console and the operation of replacing the database is not executed;
s5: and locally storing the command, loading the historical operation command stored locally when the clickhouse database is started by using a script, and inquiring the historical operation command through the shell.
In specific implementation, after the code is started through the script, the historical operation command stored in the local file can be loaded, the historical command can be acquired through up-down turning, each operation can be added to the historical record, the operation can be conveniently carried out through the historical command, and the efficiency is improved.
Optionally, the embodiment of the application further provides a help command, which records some more important operation commands and helps a user to understand and use the commands more quickly.
Optionally, in a specific implementation, the click call can be interactively called with a click call by writing a call script click-shell.
The present application provides a specific embodiment to further explain the above steps and the use of the script clickhouse-shell.sh:
uploading jar and scripts on a server, endowing the scripts with authority through the chmod 775clickhouse-shell, starting the scripts of the clickhouse-shell, and connecting clicchuuse:
./clickhouse-shell.sh-h host-p port-u username-pw password-ddatabase
if it is not known what parameters are transmitted at the time of startup, it can be directly used
./clickhouse-shell.sh
The required parameters are printed at the console.
Connecting clickcouse prints log and entering help prints references and prompts for specific commands.
In particular implementations, a clickhouse-cli supports all commands of a clickhouse-client.
And performing database checking and library switching, and then performing interactive operation with the database:
example 1: switching database
The format is as follows: user databaseName;
example 2: and (3) inquiring data:
the format is as follows: select from tableme limit 1;
example 3: exporting data and converting into a JSON format:
the format is as follows: select from bottom eip tableme person INTO OUTFILE '/tmp/test Json' FORMAT JSON
It should be noted that the steps illustrated in the above-described flow diagrams or in the flow diagrams of the figures may be performed in a computer system, such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flow diagrams, in some cases, the steps illustrated or described may be performed in an order different than here.
The embodiment of the application provides an interaction system based on Clickhouse, and is suitable for the interaction method based on Clickhouse. As used below, the terms "unit," "module," and the like may implement a combination of software and/or hardware of predetermined functions. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware or a combination of software and hardware is also possible and contemplated.
Fig. 2 is a block diagram of a Clickhouse-based interactive system according to the present invention, please refer to fig. 2, which includes:
database parsing connection module 1: analyzing the basic information connected with the clickhouse database through a dynamic parameter, and connecting the clickhouse database through jdbc.
Optionally, a code is written to transmit the dynamic parameter, read and verify the dynamic parameter, and the verified dynamic parameter is packaged and then connected to the clickhouse database through an http interface provided externally by the clickhouse database.
In a specific implementation, the code is written to implement the function of interactively operating with clickhouse data volume, and the specific design scheme and steps are as follows:
a. the input of dynamic parameters is supported, the reading and the verification of the parameters can be carried out, and optionally, a prompt is printed if necessary parameters are not input. In specific implementation, the parameters supported by the embodiment of the present application are as follows:
Figure BDA0003164133250000101
Figure BDA0003164133250000111
Figure BDA0003164133250000121
b. the verified parameters are packaged, and then the verified parameters are connected with a clickhouse through an http interface externally provided by the clickhouse, optionally, a test of connection query can be performed through 'select 0', and if the query is in error, an error is printed out on a console;
the data control processing module 2: and using jline to input and read commands of the console, receiving the input commands, and calling an http interface of the clickhouse database to control and process data.
In specific implementation, a jline is used for monitoring and reading an input interactive command, a clickhouse http interface is called to carry out data interaction after the command is read, and an interaction result is obtained and printed on a console;
the data compression and decompression module 3: and compressing and decompressing the data requested to the clickhouse database and the data returned to the clickhouse database by an lz4 compression algorithm.
In the specific implementation, in the process of interactive query with a clickhouse database through an http interface, in order to solve the problem of overlarge transmitted data volume, a lz4 compression algorithm is used for data compression before a request is transmitted and decompressing a request result, so that the query time is saved, and the response is faster.
The database analysis switching module 4: when the database is switched, the database name is analyzed and the switched database is used through the command operation by dynamically receiving a database switching command.
In specific implementation, aiming at a command for switching a database, a new database name is analyzed, a test sql is sent to carry out connection, if the connection is passed, the database name in a code cache is modified into the new database name, if the connection is passed, an error is returned to a console and the operation of replacing the database is not executed;
the history operation saving module 5: and locally storing the command, loading the historical operation command stored locally when the clickhouse database is started by using a script, and inquiring the historical operation command through the shell.
In specific implementation, after the code is started through the script, the historical operation command stored in the local file can be loaded, the historical command can be acquired through up-down turning, each operation can be added to the historical record, the operation can be conveniently carried out through the historical command, and the efficiency is improved.
Optionally, the embodiment of the application further provides a help command, which records some more important operation commands and helps a user to understand and use the commands more quickly.
Optionally, in a specific implementation, the click call can be interactively called with a click call by writing a call script click-shell.
The application provides a specific embodiment to further explain the technical scheme and the use of the script clickhouse-shell.sh:
uploading jar and scripts on a server, endowing the scripts with authority through the chmod 775clickhouse-shell, starting the scripts of the clickhouse-shell, and connecting clicchuuse:
./clickhouse-shell.sh-h host-p port-u username-pw password-ddatabase
if it is not known what parameters are transmitted at the time of startup, it can be directly used
./clickhouse-shell.sh
The required parameters are printed at the console.
Connecting clickcouse prints log and entering help prints references and prompts for specific commands.
In particular implementations, a clickhouse-cli supports all commands of a clickhouse-client.
And performing database checking and library switching, and then performing interactive operation with the database:
example 1: switching database
The format is as follows: user databaseName;
example 2: and (3) inquiring data:
the format is as follows: select from tableme limit 1;
example 3: exporting data and converting into a JSON format:
the format is as follows: select from bottom eip tableme person INTO OUTFILE '/tmp/test Json' FORMAT JSON
In addition, a Clickhouse-based interaction method described in connection with fig. 1 may be implemented by an electronic device. Fig. 3 is a block diagram of an electronic device of the present invention.
The electronic device may comprise a processor 61 and a memory 62 in which computer program instructions are stored.
Specifically, the processor 61 may include a Central Processing Unit (CPU), or A Specific Integrated Circuit (ASIC), or may be configured to implement one or more Integrated circuits of the embodiments of the present Application.
Memory 62 may include, among other things, mass storage for data or instructions. By way of example, and not limitation, memory 62 may include a Hard Disk Drive (Hard Disk Drive, abbreviated HDD), a floppy Disk Drive, a Solid State Drive (SSD), flash memory, an optical Disk, a magneto-optical Disk, tape, or a Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 62 may include removable or non-removable (or fixed) media, where appropriate. The memory 62 may be internal or external to the data processing apparatus, where appropriate. In a particular embodiment, the memory 62 is a Non-Volatile (Non-Volatile) memory. In particular embodiments, Memory 62 includes Read-Only Memory (ROM) and Random Access Memory (RAM). The ROM may be mask-programmed ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), Electrically rewritable ROM (EAROM), or FLASH Memory (FLASH), or a combination of two or more of these, where appropriate. The RAM may be a Static Random-Access Memory (SRAM) or a Dynamic Random-Access Memory (DRAM), where the DRAM may be a Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), an Extended data output Dynamic Random-Access Memory (EDODRAM), a Synchronous Dynamic Random-Access Memory (SDRAM), and the like.
The memory 62 may be used to store or cache various data files that need to be processed and/or used for communication, as well as possible computer program instructions executed by the processor 61.
The processor 61 implements any of the above embodiments of the Clickhouse-based interaction methods by reading and executing computer program instructions stored in the memory 62.
In some of these embodiments, the electronic device may also include a communication interface 63 and a bus 60. As shown in fig. 3, the processor 61, the memory 62, and the communication interface 63 are connected via a bus 60 to complete communication therebetween.
The communication port 63 may be implemented with other components such as: the data communication is carried out among external equipment, image/data acquisition equipment, a database, external storage, an image/data processing workstation and the like.
The bus 60 includes hardware, software, or both to couple the components of the electronic device to one another. Bus 60 includes, but is not limited to, at least one of the following: data Bus (Data Bus), Address Bus (Address Bus), Control Bus (Control Bus), Expansion Bus (Expansion Bus), and Local Bus (Local Bus). By way of example, and not limitation, Bus 60 may include an Accelerated Graphics Port (AGP) or other Graphics Bus, an Enhanced Industry Standard Architecture (EISA) Bus, a Front-Side Bus (FSB), a Hyper Transport (HT) Interconnect, an ISA (ISA) Bus, an InfiniBand (InfiniBand) Interconnect, a Low Pin Count (LPC) Bus, a memory Bus, a microchannel Architecture (MCA) Bus, a PCI (Peripheral Component Interconnect) Bus, a PCI-Express (PCI-X) Bus, a Serial Advanced Technology Attachment (SATA) Bus, a Video Electronics Bus (audio Electronics Association), abbreviated VLB) bus or other suitable bus or a combination of two or more of these. Bus 60 may include one or more buses, where appropriate. Although specific buses are described and shown in the embodiments of the application, any suitable buses or interconnects are contemplated by the application.
The electronic device can execute a Clickhouse-based interaction method in the embodiment of the application.
In addition, in combination with the Clickhouse-based interaction method in the foregoing embodiments, the embodiments of the present application may be implemented by providing a computer-readable storage medium. The computer readable storage medium having stored thereon computer program instructions; the computer program instructions, when executed by a processor, implement any of the above embodiments of a Clickhouse-based interaction method.
And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. An interaction method based on Clickhouse is characterized by comprising the following steps:
analyzing and connecting the databases, analyzing the basic information connected with the clickhouse database through a dynamic parameter, and connecting the clickhouse database through jdbc;
a data control processing step, namely, using jline to input and read a command of a console, receiving the input command, and performing data control processing by calling an http interface of the clickhouse database;
and a data compression and decompression step, namely compressing and decompressing the data requested to the clickhouse database and the data returned to the clickhouse database by an lz4 compression algorithm.
2. The Clickhouse-based interaction method according to claim 1, further comprising:
and a database analysis switching step, wherein when the database is switched, the switched database name is analyzed by dynamically receiving a database switching command, and the switched database is used through the command operation.
3. The Clickhouse-based interaction method according to claim 1, further comprising:
and a history operation saving step, namely locally saving the command, loading the history operation command stored locally when the clickhouse database is started by using a script, and inquiring the history operation command through the shell.
4. The Clickhouse-based interaction method as claimed in claim 1, wherein the database parsing connection step further comprises: writing codes to realize the transmission of the dynamic parameters, reading and verifying the dynamic parameters, and connecting the verified dynamic parameters to the clickhouse database through an http interface externally provided by the clickhouse database after the verified dynamic parameters are packaged.
5. An interactive system based on Clickhouse, comprising:
the database analysis connection module is used for analyzing the basic information connected with the clickhouse database through a dynamic parameter and connecting the clickhouse database through jdbc;
the data control processing module is used for inputting and reading commands of the console by using jline, receiving the input commands and controlling and processing data by calling an http interface of the clickhouse database;
and the data compression and decompression module is used for compressing and decompressing the data requested to the clickhouse database and the data returned to the clickhouse database by an lz4 compression algorithm.
6. The Clickhouse-based interaction system as recited in claim 5, wherein the system further comprises:
and the database analysis switching module is used for analyzing the switched database name and using the switched database through the command operation by dynamically receiving a database switching command when switching the database.
7. The Clickhouse-based interaction system as recited in claim 5, wherein the system further comprises:
and the historical operation storage module is used for locally storing the command, loading the historical operation command stored locally when the clickhouse database is started by using a script, and inquiring the historical operation command through the shell.
8. The Clickhouse-based interaction system as claimed in claim 5, wherein the database parsing connection module further comprises: writing codes to realize the transmission of the dynamic parameters, reading and verifying the dynamic parameters, and connecting the verified dynamic parameters to the clickhouse database through an http interface externally provided by the clickhouse database after the verified dynamic parameters are packaged.
9. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the Clickhouse-based interaction method as recited in any one of claims 1 to 4 when executing the computer program.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the Clickhouse-based interaction method according to any one of claims 1 to 4.
CN202110799552.3A 2021-07-15 2021-07-15 Clickhouse-based interaction method and system, electronic device and storage medium Pending CN113420013A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110799552.3A CN113420013A (en) 2021-07-15 2021-07-15 Clickhouse-based interaction method and system, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110799552.3A CN113420013A (en) 2021-07-15 2021-07-15 Clickhouse-based interaction method and system, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN113420013A true CN113420013A (en) 2021-09-21

Family

ID=77721119

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110799552.3A Pending CN113420013A (en) 2021-07-15 2021-07-15 Clickhouse-based interaction method and system, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN113420013A (en)

Similar Documents

Publication Publication Date Title
JP5658283B2 (en) Application operating method, apparatus and system
CN108111555B (en) Method and system for controlling installation package downloading process
US20170060713A1 (en) Systems and methods for device compatibility testing and reporting
US10191838B2 (en) Method and device for checking influence of deleting cache file, and mobile terminal
CN108650287B (en) Upgrading method and device for terminal device in Internet of things and computer readable medium
CN107239309B (en) Patch generation method and device, updating method, electronic device and storage medium
CN105138376A (en) Mixed model application, webpage resource upgrading method thereof, mobile terminal and system
CN111049889B (en) Static resource uploading method and device, integrated server and system
CN107798064B (en) Page processing method, electronic device and computer readable storage medium
WO2018040270A1 (en) Method and device for loading linux-system elf file in windows system
CN108874825B (en) Abnormal data verification method and device
CN109558331B (en) Application program defect detection method, device, equipment and storage medium
US20190149571A1 (en) Method and device for repairing page vulnerability
CN112416964A (en) Data processing method, device and system, computer equipment and computer readable storage medium
KR20210084417A (en) Method for monitoring web server based on cloud streaming service and apparatus for the same
CN112187921B (en) Object file downloading method, device, system, server and storage medium
WO2019148657A1 (en) Method for testing associated environments, electronic device and computer readable storage medium
CN103294742A (en) Apparatus and method for determining duplication of content in portable terminal
CN112417014A (en) Dynamic modification execution plan method, system, and computer-readable storage medium
CN111552517B (en) Application program starting method and device, electronic equipment and computer storage medium
CN111562929A (en) Method, device and equipment for generating patch file and storage medium
CN108108203B (en) Method, device and system for downloading and installing process of installation package
CN113420013A (en) Clickhouse-based interaction method and system, electronic device and storage medium
CN102360381B (en) Device and method for performing lossless compression on embedded program
CN111382179A (en) Data processing method and device and electronic equipment

Legal Events

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