CN113835843A - Fuzzy operation method and device of redis cluster, computer equipment and storage medium - Google Patents

Fuzzy operation method and device of redis cluster, computer equipment and storage medium Download PDF

Info

Publication number
CN113835843A
CN113835843A CN202111149339.4A CN202111149339A CN113835843A CN 113835843 A CN113835843 A CN 113835843A CN 202111149339 A CN202111149339 A CN 202111149339A CN 113835843 A CN113835843 A CN 113835843A
Authority
CN
China
Prior art keywords
target
redis cluster
cluster
instruction
operation instruction
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
CN202111149339.4A
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.)
Ping An Pension Insurance Corp
Original Assignee
Ping An Pension Insurance Corp
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 Ping An Pension Insurance Corp filed Critical Ping An Pension Insurance Corp
Priority to CN202111149339.4A priority Critical patent/CN113835843A/en
Publication of CN113835843A publication Critical patent/CN113835843A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to a fuzzy operation method and device of a redis cluster, computer equipment and a storage medium. The method comprises the following steps: firstly, acquiring a target redis cluster and connecting the target redis cluster; then, acquiring a target operation instruction input by a user for the target redis cluster; when the target operation instruction is a fuzzy operation instruction, converting the target operation instruction into a target query instruction; pushing a target query instruction and a preset fuzzy operation instruction to a target redis cluster, wherein the target query instruction is used for controlling the target redis cluster to perform query operation to obtain a query result, and the preset fuzzy operation instruction is used for controlling the target redis cluster to perform operation corresponding to the fuzzy operation instruction according to the query result; and finally, receiving an operation result returned by the target redis cluster. The fuzzy operation of the target cluster is converted into the fuzzy query operation by directly connecting the fuzzy operation to the target redis cluster, and the target redis cluster is operated according to the obtained query result, so that the fuzzy operation of a plurality of redis clusters is realized.

Description

Fuzzy operation method and device of redis cluster, computer equipment and storage medium
Technical Field
The present application relates to the technical field of server clusters, and in particular, to a fuzzy operation method and apparatus for a redis cluster, a computer device, and a storage medium.
Background
Redis is an excellent middleware, is widely applied to caching high-frequency data, and avoids the problems that direct operation of data generates large pressure on a database and the whole performance is slowed down. In use, redis is typically deployed in an application in the form of a cluster.
At present, a plurality of clients for operating the redis exist, only one machine in a cluster can be operated by inputting a command in practical use, and data in the cluster usually circulates on each server, so that the server where the data to be operated is located cannot be determined, and thus the fuzzy operation of a plurality of redis clusters is difficult to realize.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a computer device and a storage medium for obfuscating a redis cluster, which can improve operational efficiency of the redis cluster.
In a first aspect, a fuzzy operation method for a redis cluster is provided, where the method includes:
acquiring a target redis cluster and connecting the target redis cluster;
acquiring a target operation instruction input by a user for a target redis cluster;
when the target operation instruction is a fuzzy operation instruction, converting the target operation instruction into a target query instruction;
pushing a target query instruction and a preset fuzzy operation instruction to a target redis cluster, wherein the target query instruction is used for controlling the target redis cluster to perform query operation to obtain a query result, and the preset fuzzy operation instruction is used for controlling the target redis cluster to perform operation corresponding to the fuzzy operation instruction according to the query result;
and receiving an operation result returned by the target redis cluster.
In one embodiment, obtaining the target redis cluster includes: pushing a redis cluster selection prompt; responding to the selection operation of a user, and converting the selected redis cluster name into a json expression; and acquiring a locally stored redis cluster configuration file, taking a json expression as a parameter, and calling a preset json path function to analyze the redis cluster configuration file to obtain the selected target redis cluster.
In one embodiment, connecting the target redis cluster includes: judging whether a target redis cluster exists or not; and when the target redis cluster exists, connecting the target redis cluster according to a preset connecting instruction.
In one embodiment, the method further comprises: and when the target redis cluster does not exist, pushing the name of the non-existing redis cluster and re-pushing the redis cluster selection prompt.
In one embodiment, connecting the target redis cluster when the target redis cluster exists includes: acquiring corresponding target redis cluster configuration information according to the cluster name of the target redis cluster; and connecting the target redis cluster according to the target redis cluster configuration information and the preset connecting instruction.
In one embodiment, acquiring the corresponding target redis cluster configuration information according to the cluster name of the target redis cluster includes: converting the cluster name of the target redis cluster into a json expression; and taking the json expression as a parameter, calling a preset jsonnpath function to analyze the redis cluster configuration file, and acquiring target redis cluster configuration information.
In one embodiment, the method further comprises: when the target operation instruction is a non-fuzzy operation instruction, pushing the non-fuzzy operation instruction and a preset non-fuzzy operation instruction to the target redis cluster, wherein the preset non-fuzzy operation instruction is used for controlling the target redis cluster to perform an operation corresponding to the non-fuzzy operation instruction; and receiving an operation result returned by the target redis cluster.
In a second aspect, a fuzzy operation apparatus for a redis cluster is provided, the apparatus including:
the cluster acquisition module is used for acquiring a target redis cluster and connecting the target redis cluster;
the instruction acquisition module is used for acquiring a target operation instruction input by a user for the target redis cluster;
the conversion module is used for converting the target operation instruction into a target query instruction when the target operation instruction is a fuzzy operation instruction;
the operation module is used for pushing a target query instruction and a preset fuzzy operation instruction to the target redis cluster, the target query instruction is used for controlling the target redis cluster to perform query operation to obtain a query result, and the preset fuzzy operation instruction is used for controlling the target redis cluster to perform operation corresponding to the fuzzy operation instruction according to the query result;
and the receiving module is used for receiving the operation result returned by the target redis cluster.
In a third aspect, a computer device is provided, comprising a memory storing a computer program and a processor implementing the following steps when the processor executes the computer program:
acquiring a target redis cluster and connecting the target redis cluster;
acquiring a target operation instruction input by a user for a target redis cluster;
when the target operation instruction is a fuzzy operation instruction, converting the target operation instruction into a target query instruction;
pushing a target query instruction and a preset fuzzy operation instruction to a target redis cluster, wherein the target query instruction is used for controlling the target redis cluster to perform query operation to obtain a query result, and the preset fuzzy operation instruction is used for controlling the target redis cluster to perform operation corresponding to the fuzzy operation instruction according to the query result;
and receiving an operation result returned by the target redis cluster.
In a fourth aspect, there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring a target redis cluster and connecting the target redis cluster;
acquiring a target operation instruction input by a user for a target redis cluster;
when the target operation instruction is a fuzzy operation instruction, converting the target operation instruction into a target query instruction;
pushing a target query instruction and a preset fuzzy operation instruction to a target redis cluster, wherein the target query instruction is used for controlling the target redis cluster to perform query operation to obtain a query result, and the preset fuzzy operation instruction is used for controlling the target redis cluster to perform operation corresponding to the fuzzy operation instruction according to the query result;
and receiving an operation result returned by the target redis cluster.
Firstly, acquiring a target redis cluster and connecting the target redis cluster with the target redis cluster; then, acquiring a target operation instruction input by a user for the target redis cluster; when the target operation instruction is a fuzzy operation instruction, converting the target operation instruction into a target query instruction; pushing a target query instruction and a preset fuzzy operation instruction to a target redis cluster, wherein the target query instruction is used for controlling the target redis cluster to perform query operation to obtain a query result, and the preset fuzzy operation instruction is used for controlling the target redis cluster to perform operation corresponding to the fuzzy operation instruction according to the query result; and finally, receiving an operation result returned by the target redis cluster. The fuzzy operation of the target cluster is converted into the fuzzy query operation by directly connecting the fuzzy operation to the target redis cluster, and the target redis cluster is operated according to the obtained query result, so that the fuzzy operation of a plurality of redis clusters is realized.
Drawings
FIG. 1 is a diagram of an application environment for a fuzzy operation method of a redis cluster in one embodiment;
FIG. 2 is a flow chart illustrating a fuzzy operation method of the redis cluster in one embodiment;
FIG. 3 is a complete flow diagram of a fuzzy operation method of the redis cluster in one embodiment;
FIG. 4 is a block diagram of a fuzzy operating apparatus of a redis cluster in one embodiment;
FIG. 5 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail 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.
At present, redis is used as an excellent middleware and widely applied to caching high-frequency data, and avoids the problems that direct operation of data generates large pressure on a database and the whole performance is slowed down. The usage is usually deployed in the application in the form of clusters.
At present, a plurality of clients for operating a redis cluster are available, but the clients can only operate one machine in the redis cluster when inputting an operation command each time, and data in the cluster is usually circulated on each server, so that it is impossible to determine on which server the data to be operated is located, and blindly input the operation command one by one, and data may be on the server in the first 1 second, but the data is circulated to another server after the command is input, so that the trouble that the data does not exist is caused, that is, the current clients cannot operate the whole cluster at one time.
In addition, the current clients do not support the fuzzy deletion function (the redis service does not have a fuzzy deletion command), and batch operations such as deleting a certain initial key and the like are sometimes required in practical use, so that the fuzzy batch operation efficiency is low.
The fuzzy operation method of the redis cluster provided by the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers.
In an embodiment, as shown in fig. 2, a fuzzy operation method for a redis cluster is provided, which is described by taking the method as an example applied to the terminal in fig. 1, and includes the following steps:
step 202, obtaining a target redis cluster and connecting the target redis cluster.
The target redis cluster refers to a redis cluster which a user needs to operate, and the number of the redis in the target redis cluster is at least one.
Specifically, the executable file of the terminal acquires the target redis cluster selected by the user and is connected to the target redis cluster without login.
And step 204, acquiring a target operation instruction input by a user for the target redis cluster.
The target operation instruction comprises any operation such as adding, deleting, modifying and checking the redis cluster.
Specifically, after an executable file of the terminal is connected to a target redis cluster, pushing a redis cluster operation prompt on an executable file display interface so that a user inputs an operation instruction for the target redis; and when the executable file of the terminal receives the input operation of the user, acquiring a target operation instruction of the user on the target redis cluster from the input interface. Further, the executable file may be an exe file of the terminal.
And step 206, when the target operation instruction is a fuzzy operation instruction, converting the target operation instruction into a target query instruction.
The types of the target operation instructions comprise fuzzy operation instructions and non-fuzzy operation instructions, wherein the fuzzy operation instructions refer to instructions containing preset characters, and the non-fuzzy operation instructions refer to instructions not containing the preset characters.
Specifically, the executable file of the terminal judges the type of the target operation instruction, and when the executable file of the terminal identifies that the target operation instruction contains a preset character, the target operation instruction is judged to be a fuzzy operation instruction, and the target operation instruction is converted into a target query instruction. For example, a target operation instruction input by a user is ' del ABC ', a key related to the beginning of ' ABC ' in a target redis cluster is deleted, an exe file identifies that the target operation instruction contains a preset character ', the target operation instruction is judged to be a fuzzy operation instruction, the target operation instruction is converted into a target query instruction, the conversion operation is to convert the operation character in the target operation instruction into a preset query character ' keys ', and for example, the ' del ABC ' is converted into the ' keys ABC '.
And 208, pushing a target query instruction and a preset fuzzy operation instruction to the target redis cluster, wherein the target query instruction is used for controlling the target redis cluster to perform query operation to obtain a query result, and the preset fuzzy operation instruction is used for controlling the target redis cluster to perform operation corresponding to the fuzzy operation instruction according to the query result.
Specifically, the exe file selects a corresponding preset fuzzy operation instruction according to the type of the target operation instruction, for example, if the fuzzy operation instruction is a fuzzy deletion instruction, the preset fuzzy operation instruction is a deletion operation on the query result, and if the fuzzy operation instruction is a fuzzy modification instruction, the preset fuzzy operation instruction is a modification operation on the query result. The exe file pushes the target query instruction and a preset fuzzy operation instruction for controlling the target redis cluster to the target redis cluster so that the target redis cluster can perform query operation according to the target query instruction to obtain a query result, the target redis cluster performs operation corresponding to the fuzzy operation instruction according to the query result and the preset fuzzy operation instruction, and pushes the operation result to the exe file. Furthermore, each minimum unit in the target redis cluster carries out operation corresponding to the fuzzy operation instruction according to the query result and the preset fuzzy operation instruction in sequence, and the operation result of each minimum unit is merged and then pushed to the exe file. For example, the target operation instruction input by the user is "del ABC", the exe file converts "del ABC" into "keys ABC" to query all keys related to the beginning of ABC, and then the deleting command is executed on each minimum unit in a circulating manner to delete all key values.
And finally, optimizing the execution results of all the servers, pushing and outputting the execution results of each server to a display interface of an exe file, wherein the output content comprises each server ip and the corresponding execution result. If the user inputs a query command, the query result is returned, and if the user inputs a deletion command, the deletion completion or deletion failure is returned.
In the embodiment, a user can operate all the redis servers in the target redis cluster by inputting the target operation instruction once, and does not need to frequently switch to log in the redis servers, so that the operation efficiency is improved.
In the embodiment, the redis command is expanded to support fuzzy batch deletion, and simultaneously, all redis native instructions can be compatible. The exe file can be written by python, and can also be written by other voices, the embodiment is not limited in the above, the size of the exe file written by python is only about 5M, the transmission is convenient, and the exe file can run in an environment without python.
And step 210, receiving an operation result returned by the target redis cluster.
Specifically, the executable file of the terminal receives the operation result returned by the target redis cluster and displays the operation result on the display interface.
In the fuzzy operation method of the redis cluster, firstly, a target redis cluster is obtained and connected; then, acquiring a target operation instruction input by a user for the target redis cluster; when the target operation instruction is a fuzzy operation instruction, converting the target operation instruction into a target query instruction; pushing a target query instruction and a preset fuzzy operation instruction to a target redis cluster, wherein the target query instruction is used for controlling the target redis cluster to perform query operation to obtain a query result, and the preset fuzzy operation instruction is used for controlling the target redis cluster to perform operation corresponding to the fuzzy operation instruction according to the query result; and finally, receiving an operation result returned by the target redis cluster. The fuzzy operation of the target cluster is converted into the fuzzy query operation by directly connecting the fuzzy operation to the target redis cluster, and the target redis cluster is operated according to the obtained query result, so that the fuzzy operation of a plurality of redis clusters is realized.
In an optional embodiment, obtaining the target redis cluster includes: pushing a redis cluster selection prompt; responding to the selection operation of a user, and converting the selected redis cluster name into a json expression; and acquiring a locally stored redis cluster configuration file, taking a json expression as a parameter, and calling a preset json path function to analyze the redis cluster configuration file to obtain the selected target redis cluster.
Specifically, after a user triggers an executable file, a terminal pushes a cluster selection prompt and an optional redis cluster through the executable file, so that the user selects the redis cluster needing to be operated in a selection box; the executable file of the terminal converts the cluster name selected by the user into a json expression; and taking the json expression as a parameter of the json-Path function, and analyzing the locally stored redis cluster configuration file to obtain the selected target redis cluster. In this embodiment, the executable file may further obtain a target redis cluster selected by the user after obtaining the selection operation of the redis cluster by the user according to the tkiner extraction rule. In the embodiment of the application, the redis cluster which the user needs to operate can be obtained through the input box, the target redis cluster input by the user is obtained after the input operation of the user is obtained through the tkiner extraction rule, and the target redis cluster can be extracted through other extraction rules.
In an alternative embodiment, connecting the target redis clusters comprises: judging whether a target redis cluster exists or not; and when the target redis cluster exists, connecting the target redis cluster according to a preset connecting instruction.
Specifically, after the executable file of the terminal acquires the target redis cluster selected by the user, whether the target redis cluster exists is searched in the redis cluster configuration file, the redis cluster configuration file stores configuration information of a plurality of redis clusters, and the configuration information of each redis cluster includes ip, port and login password of a plurality of contained minimum units (namely, redis servers). When configuration information of a target redis cluster exists in a redis cluster configuration file, judging that the target redis cluster exists, and when the target redis cluster exists, sequentially connecting the corresponding redis cluster according to an ip, a port, a login password and a connection instruction of each redis cluster in the target redis cluster, for example, the preset connection instruction may be 'redis-cli-h ip-p port-a password', the ip represents the ip of the redis cluster, the port represents the port number of the redis cluster, the password represents the login password, the preset connection instruction may also be realized through other instructions, and only if a user can be prevented from logging in the redis cluster, the connection of the redis cluster is realized.
In an optional embodiment, the method further comprises: and when the target redis cluster does not exist, pushing the name of the non-existing redis cluster and re-pushing the redis cluster selection prompt.
Specifically, after an executable file of the terminal acquires a target redis cluster selected by a user, whether the target redis cluster exists is searched in a redis cluster configuration file, when configuration information of any one of the redis clusters in the target redis cluster is absent in the redis cluster configuration file, the target redis cluster is judged to include the absent redis cluster, the information of the absent redis cluster is pushed to a display interface of an exe file, and a redis cluster selection prompt is pushed again, so that the user can reselect the target redis cluster.
In an alternative embodiment, connecting the target redis cluster when the target redis cluster exists includes: acquiring corresponding target redis cluster configuration information according to the cluster name of the target redis cluster; and connecting the target redis cluster according to the target redis cluster configuration information and the preset connecting instruction.
Specifically, the corresponding configuration information of the target redis cluster, that is, the ip, the port and the login password of the minimum unit in each redis cluster, is obtained in the redis cluster configuration file according to the ip of the minimum unit in each redis cluster in the target redis cluster. And the exe file is connected with the target redis cluster according to the ip, the port and the login password of the minimum unit in each redis cluster and a preset connection instruction. The operation of connecting the target redis cluster can also be executed after a target operation instruction input by a user is obtained, and can also be executed before the target query instruction and a preset fuzzy operation instruction are pushed to the target redis cluster after the target operation instruction is converted into the target query instruction.
In an optional embodiment, obtaining the corresponding target redis cluster configuration information according to the cluster name of the target redis cluster includes: converting the cluster name of the target redis cluster into a json expression; and taking the json expression as a parameter, calling a preset jsonnpath function to analyze the redis cluster configuration file, and acquiring target redis cluster configuration information.
Specifically, the exe file forms a json expression from the ip of the target redis cluster, the json expression is used as a parameter, a preset json path function is called to search corresponding target redis cluster configuration information in the configuration file of the redis cluster, and namely the ip, the port and the login password of the minimum unit in each redis cluster are obtained. The exe file is connected with the target redis cluster by adopting a preset connecting instruction according to the ip, the port and the login password of the minimum unit in each redis cluster, and the preset connecting instruction can also be connected with a redisjar packet of python.
In the embodiment, the exe file directly searches the configuration information of the target redis cluster from the configuration files of the redis cluster, and is connected to the target redis cluster according to the configuration information of the target redis cluster, so that a user does not need to input a login password of each redis server in the target redis cluster in sequence, login-free operation of the target redis cluster is realized, user operation is simplified, and operation efficiency is improved.
In an optional embodiment, the method further comprises: when the target operation instruction is a non-fuzzy operation instruction, pushing the non-fuzzy operation instruction and a preset non-fuzzy operation instruction to the target redis cluster, wherein the preset non-fuzzy operation instruction is used for controlling the target redis cluster to perform an operation corresponding to the non-fuzzy operation instruction; and receiving an operation result returned by the target redis cluster.
Specifically, the executable file of the terminal judges the type of the target operation instruction, and when the executable file of the terminal identifies that the target operation instruction does not contain a preset character, the target operation instruction is judged to be a non-fuzzy operation instruction. The exe file selects a corresponding preset non-fuzzy operation instruction according to the type of the target operation instruction, for example, if the non-fuzzy operation instruction is a pair deletion instruction, the preset non-fuzzy operation instruction is a deletion operation, and if the non-fuzzy operation instruction is a modification instruction, the preset non-fuzzy operation instruction is a modification operation. The exe file pushes the non-fuzzy operation instruction and the preset non-fuzzy operation instruction to the target redis cluster, so that the target redis cluster performs operation corresponding to the non-fuzzy operation instruction according to the preset non-fuzzy operation, and pushes an operation result to the exe file.
In this embodiment, the configuration information of the corresponding redis cluster may also be modified according to the deletion or addition operation of the target redis cluster, so that the configuration information of the redis cluster is consistent with the server in the background.
In order to easily understand the technical solution provided by the embodiment of the present application, as shown in fig. 3, a fuzzy operation method of a redis cluster provided by the embodiment of the present application is briefly described with a complete fuzzy operation process of the redis cluster:
(1) and running an exe program file (namely a client), and pushing a redis cluster selection prompt.
(2) Responding to the selection operation of the user, and acquiring the selected target redis cluster
(3) And judging whether the target redis cluster exists.
(4) And when the target redis cluster does not exist, re-pushing the redis cluster selection prompt.
(5) And when the target redis cluster exists, acquiring a target operation instruction input by a user and applied to the target redis cluster.
(6) Entering an incorrect command prompts the command for an error and again waits for the command to be entered.
(7) After a q command is input (q is a self-defined return shortcut key), the previous page can be returned, for example, after the command window inputs q, and a carriage return is pressed, the previous step can be returned.
(8) And judging whether the target operation instruction is a fuzzy operation instruction or not.
(9) And when the target operation instruction is a fuzzy operation instruction, converting the target operation instruction into a target query instruction. When the target operation instruction is a non-fuzzy operation instruction, pushing the non-fuzzy operation instruction and a preset non-fuzzy operation instruction to the target redis cluster, wherein the preset non-fuzzy operation instruction is used for controlling the target redis cluster to perform an operation corresponding to the non-fuzzy operation instruction; and receiving an operation result returned by the target redis cluster.
(10) And pushing the target query instruction and a preset fuzzy operation instruction to the target redis cluster, and connecting the target redis cluster.
(11) And controlling the target redis cluster to perform query operation according to the target query instruction to obtain a query result.
(12) And controlling the target redis cluster to perform an operation corresponding to the fuzzy operation instruction according to the query result according to a preset fuzzy operation instruction.
(13) And receiving an operation result returned by the target redis cluster.
(14) And after the command execution is finished, returning to a command to be input state to wait for the input of the next command.
It should be understood that although the various steps in the flow charts of fig. 2-3 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-3 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
In one embodiment, as shown in fig. 4, there is provided a fuzzy operation apparatus of a redis cluster, including: a cluster acquisition module 402, an instruction acquisition module 404, a conversion module 406, an operation module 408, and a reception module 410, wherein:
the cluster obtaining module 402 is configured to obtain a target redis cluster and connect the target redis cluster.
And an instruction obtaining module 404, configured to obtain a target operation instruction input by a user for the target redis cluster.
And the conversion module 406 is configured to convert the target operation instruction into a target query instruction when the target operation instruction is a fuzzy operation instruction.
The operation module 408 is configured to push a target query instruction and a preset fuzzy operation instruction to the target redis cluster, where the target query instruction is used to control the target redis cluster to perform a query operation to obtain a query result, and the preset fuzzy operation instruction is used to control the target redis cluster to perform an operation corresponding to the fuzzy operation instruction according to the query result.
And the receiving module 410 is configured to receive an operation result returned by the target redis cluster.
In one embodiment, the cluster obtaining module 402 is further configured to push a redis cluster selection hint; responding to the selection operation of a user, and converting the selected redis cluster name into a json expression; and acquiring a locally stored redis cluster configuration file, taking a json expression as a parameter, and calling a preset json path function to analyze the redis cluster configuration file to obtain the selected target redis cluster.
In an embodiment, the cluster obtaining module 402 is further configured to determine whether a target redis cluster exists; and when the target redis cluster exists, connecting the target redis cluster according to a preset connecting instruction.
In one embodiment, the cluster obtaining module 402 is further configured to push a non-existing redis cluster name and re-push a redis cluster selection hint when the target redis cluster does not exist.
In an embodiment, the cluster obtaining module 402 is further configured to obtain, according to a cluster name of the target redis cluster, corresponding target redis cluster configuration information; and connecting the target redis cluster according to the target redis cluster configuration information and the preset connecting instruction.
In one embodiment, the cluster obtaining module 402 is further configured to convert a cluster name of the target redis cluster into a json expression; and taking the json expression as a parameter, calling a preset jsonnpath function to analyze the redis cluster configuration file, and acquiring target redis cluster configuration information.
In an embodiment, the operation module 408 is further configured to, when the target operation instruction is a non-fuzzy operation instruction, push the non-fuzzy operation instruction and a preset non-fuzzy operation instruction to the target redis cluster, where the preset non-fuzzy operation instruction is used to control the target redis cluster to perform an operation corresponding to the non-fuzzy operation instruction; and receiving an operation result returned by the target redis cluster.
For specific limitation of the fuzzy operation device of the redis cluster, reference may be made to the above limitation of the fuzzy operation method of the redis cluster, and details are not described herein again. The modules in the fuzzy operating device of the redis cluster can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 5. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a method of fuzzy operation of a redis cluster. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 5 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring a target redis cluster and connecting the target redis cluster;
acquiring a target operation instruction input by a user for a target redis cluster;
when the target operation instruction is a fuzzy operation instruction, converting the target operation instruction into a target query instruction;
pushing a target query instruction and a preset fuzzy operation instruction to a target redis cluster, wherein the target query instruction is used for controlling the target redis cluster to perform query operation to obtain a query result, and the preset fuzzy operation instruction is used for controlling the target redis cluster to perform operation corresponding to the fuzzy operation instruction according to the query result;
and receiving an operation result returned by the target redis cluster.
In one embodiment, the processor, when executing the computer program, further performs the steps of: the acquiring of the target redis cluster comprises: pushing a redis cluster selection prompt; responding to the selection operation of a user, and converting the selected redis cluster name into a json expression; and acquiring a locally stored redis cluster configuration file, taking a json expression as a parameter, and calling a preset json path function to analyze the redis cluster configuration file to obtain the selected target redis cluster.
In one embodiment, the processor, when executing the computer program, further performs the steps of: connecting the target redis cluster includes: judging whether a target redis cluster exists or not; and when the target redis cluster exists, connecting the target redis cluster according to a preset connecting instruction.
In one embodiment, the processor, when executing the computer program, further performs the steps of: the method further comprises the following steps: and when the target redis cluster does not exist, pushing the name of the non-existing redis cluster and re-pushing the redis cluster selection prompt.
In one embodiment, the processor, when executing the computer program, further performs the steps of: connecting the target redis cluster when the target redis cluster exists includes: acquiring corresponding target redis cluster configuration information according to the cluster name of the target redis cluster; and connecting the target redis cluster according to the target redis cluster configuration information and the preset connecting instruction.
In one embodiment, the processor, when executing the computer program, further performs the steps of: according to the cluster name of the target redis cluster, acquiring corresponding target redis cluster configuration information comprises: converting the cluster name of the target redis cluster into a json expression; and taking the json expression as a parameter, calling a preset jsonnpath function to analyze the redis cluster configuration file, and acquiring target redis cluster configuration information. In one embodiment, the processor, when executing the computer program, further performs the steps of: the method further comprises the following steps: when the target operation instruction is a non-fuzzy operation instruction, pushing the non-fuzzy operation instruction and a preset non-fuzzy operation instruction to the target redis cluster, wherein the preset non-fuzzy operation instruction is used for controlling the target redis cluster to perform an operation corresponding to the non-fuzzy operation instruction; and receiving an operation result returned by the target redis cluster.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a target redis cluster and connecting the target redis cluster;
acquiring a target operation instruction input by a user for a target redis cluster;
when the target operation instruction is a fuzzy operation instruction, converting the target operation instruction into a target query instruction;
pushing a target query instruction and a preset fuzzy operation instruction to a target redis cluster, wherein the target query instruction is used for controlling the target redis cluster to perform query operation to obtain a query result, and the preset fuzzy operation instruction is used for controlling the target redis cluster to perform operation corresponding to the fuzzy operation instruction according to the query result;
and receiving an operation result returned by the target redis cluster.
In one embodiment, the computer program when executed by the processor further performs the steps of: the acquiring of the target redis cluster comprises: pushing a redis cluster selection prompt; responding to the selection operation of a user, and converting the selected redis cluster name into a json expression; and acquiring a locally stored redis cluster configuration file, taking a json expression as a parameter, and calling a preset json path function to analyze the redis cluster configuration file to obtain the selected target redis cluster.
In one embodiment, the computer program when executed by the processor further performs the steps of: connecting the target redis cluster includes: judging whether a target redis cluster exists or not; and when the target redis cluster exists, connecting the target redis cluster according to a preset connecting instruction.
In one embodiment, the computer program when executed by the processor further performs the steps of: the method further comprises the following steps: and when the target redis cluster does not exist, pushing the name of the non-existing redis cluster and re-pushing the redis cluster selection prompt.
In one embodiment, the computer program when executed by the processor further performs the steps of: connecting the target redis cluster when the target redis cluster exists includes: acquiring corresponding target redis cluster configuration information according to the cluster name of the target redis cluster; and connecting the target redis cluster according to the target redis cluster configuration information and the preset connecting instruction.
In one embodiment, the computer program when executed by the processor further performs the steps of: according to the cluster name of the target redis cluster, acquiring corresponding target redis cluster configuration information comprises: converting the cluster name of the target redis cluster into a json expression; and taking the json expression as a parameter, calling a preset jsonnpath function to analyze the redis cluster configuration file, and acquiring target redis cluster configuration information.
In one embodiment, the computer program when executed by the processor further performs the steps of: the method further comprises the following steps: when the target operation instruction is a non-fuzzy operation instruction, pushing the non-fuzzy operation instruction and a preset non-fuzzy operation instruction to the target redis cluster, wherein the preset non-fuzzy operation instruction is used for controlling the target redis cluster to perform an operation corresponding to the non-fuzzy operation instruction; and receiving an operation result returned by the target redis cluster.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as 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. A method of fuzzy operation of a redis cluster, the method comprising:
acquiring a target redis cluster and connecting the target redis cluster;
acquiring a target operation instruction input by a user and applied to the target redis cluster;
when the target operation instruction is a fuzzy operation instruction, converting the target operation instruction into a target query instruction;
the target query instruction and a preset fuzzy operation instruction are pushed to the target redis cluster, the target query instruction is used for controlling the target redis cluster to perform query operation to obtain a query result, and the preset fuzzy operation instruction is used for controlling the target redis cluster to perform operation corresponding to the fuzzy operation instruction according to the query result;
and receiving an operation result returned by the target redis cluster.
2. The method of claim 1, wherein the obtaining the target redis cluster comprises:
pushing a redis cluster selection prompt;
responding to the selection operation of a user, and converting the selected redis cluster name into a json expression;
and acquiring a locally stored redis cluster configuration file, taking the json expression as a parameter, and calling a preset json path function to analyze the redis cluster configuration file to obtain the selected target redis cluster.
3. The method of claim 2, wherein the connecting the target redis cluster comprises:
judging whether the target redis cluster exists or not;
and when the target redis cluster exists, connecting the target redis cluster according to a preset connecting instruction.
4. The method of claim 3, further comprising:
and when the target redis cluster does not exist, pushing the name of the existing redis cluster and re-pushing the redis cluster selection prompt.
5. The method according to claim 3, wherein the connecting the target redis cluster according to a preset connection instruction when the target redis cluster exists comprises:
acquiring corresponding target redis cluster configuration information according to the cluster name of the target redis cluster;
and connecting the target redis cluster according to the target redis cluster configuration information and the preset connection instruction.
6. The method according to claim 5, wherein the obtaining of the corresponding target redis cluster configuration information according to the cluster name of the target redis cluster comprises:
converting the cluster name of the target redis cluster into a json expression;
and taking the json expression as a parameter, calling a preset jsonnpath function to analyze the redis cluster configuration file, and acquiring the target redis cluster configuration information.
7. The method of claim 1, further comprising:
when the target operation instruction is a non-fuzzy operation instruction, pushing the non-fuzzy operation instruction and a preset non-fuzzy operation instruction to the target redis cluster, wherein the preset non-fuzzy operation instruction is used for controlling the target redis cluster to perform an operation corresponding to the non-fuzzy operation instruction;
and receiving an operation result returned by the target redis cluster.
8. An apparatus for fuzzy operation of a redis cluster, the apparatus comprising:
the cluster acquisition module is used for acquiring a target redis cluster and connecting the target redis cluster;
the instruction acquisition module is used for acquiring a target operation instruction input by a user and applied to the target redis cluster;
the conversion module is used for converting the target operation instruction into a target query instruction when the target operation instruction is a fuzzy operation instruction;
an operation module, configured to push the target query instruction and a preset fuzzy operation instruction to the target redis cluster, where the target query instruction is used to control the target redis cluster to perform a query operation, so as to obtain a query result, and the preset fuzzy operation instruction is used to control the target redis cluster to perform an operation corresponding to the fuzzy operation instruction according to the query result;
and the receiving module is used for receiving the operation result returned by the target redis cluster.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202111149339.4A 2021-09-29 2021-09-29 Fuzzy operation method and device of redis cluster, computer equipment and storage medium Pending CN113835843A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111149339.4A CN113835843A (en) 2021-09-29 2021-09-29 Fuzzy operation method and device of redis cluster, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111149339.4A CN113835843A (en) 2021-09-29 2021-09-29 Fuzzy operation method and device of redis cluster, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113835843A true CN113835843A (en) 2021-12-24

Family

ID=78967482

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111149339.4A Pending CN113835843A (en) 2021-09-29 2021-09-29 Fuzzy operation method and device of redis cluster, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113835843A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110381107A (en) * 2019-05-24 2019-10-25 平安普惠企业管理有限公司 Document down loading method, device, computer equipment and storage medium
CN110659272A (en) * 2019-08-30 2020-01-07 深圳壹账通智能科技有限公司 Data cleaning method and system
CN110750268A (en) * 2019-10-21 2020-02-04 网易(杭州)网络有限公司 File cleaning method and device, computer readable storage medium and electronic equipment
CN113296911A (en) * 2021-05-24 2021-08-24 北京京东振世信息技术有限公司 Cluster calling method, cluster calling device, electronic equipment and readable storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110381107A (en) * 2019-05-24 2019-10-25 平安普惠企业管理有限公司 Document down loading method, device, computer equipment and storage medium
CN110659272A (en) * 2019-08-30 2020-01-07 深圳壹账通智能科技有限公司 Data cleaning method and system
CN110750268A (en) * 2019-10-21 2020-02-04 网易(杭州)网络有限公司 File cleaning method and device, computer readable storage medium and electronic equipment
CN113296911A (en) * 2021-05-24 2021-08-24 北京京东振世信息技术有限公司 Cluster calling method, cluster calling device, electronic equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN108304201B (en) Object updating method, device and equipment
CN109814854B (en) Project framework generation method, device, computer equipment and storage medium
CN111563220A (en) Business website project construction method and device, computer equipment and storage medium
CN112988284B (en) Application program starting method and device, computer equipment and storage medium
CN108418797B (en) Webpage access method and device, computer equipment and storage medium
CN111258680B (en) Resource loading method and device, storage medium and electronic device
US20180218276A1 (en) Optimizing Application Performance Using Finite State Machine Model and Machine Learning
CN108415998B (en) Application dependency relationship updating method, terminal, device and storage medium
CN112866348A (en) Database access method and device, computer equipment and storage medium
CN113961510A (en) File processing method, device, equipment and storage medium
CN111008022B (en) Relationship diagram generation method, device, computer equipment and storage medium
CN112527416A (en) Task processing method and device, computer equipment and storage medium
CN110647753B (en) Method, device and equipment for acquiring kernel file and storage medium
CN111488286B (en) Method and device for independently developing Android modules
CN111381830A (en) Data request processing method and device in program and computer equipment
CN113835843A (en) Fuzzy operation method and device of redis cluster, computer equipment and storage medium
CN113434217B (en) Vulnerability scanning method, vulnerability scanning device, computer equipment and medium
CN112860355B (en) Application program running and issuing method and device, computer equipment and storage medium
CN115525305A (en) Data processing method, application starting method, device, computer equipment and storage medium
CN114237736A (en) Page resource loading method, system, device, computer equipment and storage medium
CN113051299A (en) Proxy information processing method, proxy information processing device, computer equipment and storage medium
CN112417020A (en) Method and device for realizing service expansion, computer equipment and storage medium
CN112417324A (en) Chrome-based URL (Uniform resource locator) interception method and device and computer equipment
CN112328498A (en) Service testing method and device, storage medium and electronic device
CN112612531A (en) Application program starting method and device, electronic equipment and storage medium

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