Redis Sentinel cluster deployment method, device, equipment and storage medium
By displaying inquiry information on the screen and using the ansible module to generate an execution list, the Redis Sentinel cluster deployment is automatically completed, and the problems of low manual deployment efficiency and high error rate are solved, and efficient and accurate cluster deployment is achieved.
Patent Information
- Application Number
- CN202111255692.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-27
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2041-10-27
AI Technical Summary
Manually deploying Redis Sentinel clusters is inefficient, time-cost and error-rate.
By displaying inquiry information on the screen, receiving user input configuration parameters, using the ansible module to generate an execution list, and automatically completing the deployment of the Redis Sentinel cluster.
Simplifies deployment steps for Redis Sentinel clusters, reduces deployment time and reduces error rates.
Smart Images

Figure CN114090574B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to computer technology, and in particular to a Redis (Remote Dictionary Server) sentinel cluster deployment method, apparatus, device and storage medium. Background Art
[0002] When a server provides services to the outside world, it needs to be divided into master and slave nodes. The master node primarily monitors the working status of the slave nodes, while the slave nodes primarily provide services to the outside world. Master and slave nodes may experience failures during operation. In such cases, it is necessary to monitor the status of the master and slave nodes in real time and, if a master node fails, to switch an appropriate slave node to the master node. Currently, this task is performed by deploying a Redis Sentinel Cluster on the server.
[0003] Currently, Redis Sentinel clusters are generally deployed manually. Since each server plays a different role in the service process, the commands that need to be executed are different. Manually deploying a Redis Sentinel cluster requires configuring each server one by one.
[0004] However, manually deploying the Redis Sentinel Cluster on each server node one by one has the problems of low efficiency, high time cost and high error rate. Summary of the Invention
[0005] The present application provides a Redis Sentinel cluster deployment method, apparatus, device and storage medium to solve the problems of low efficiency, high time cost and high error rate of manual deployment.
[0006] In the first aspect, the present application provides a Redis Sentinel cluster deployment method, including: displaying query information on the screen; receiving configuration parameters of the remote dictionary service Redis Sentinel cluster of the server node to be configured input by the user according to the query information; writing the configuration parameters of the Redis Sentinel cluster of the server node to be configured into a preset command segment, obtaining an Ansible module executable command, and forming an execution list of the Ansible module executable commands; controlling the Ansible module to read the execution list, and completing the deployment of the Redis Sentinel cluster of each server node to be configured according to the Ansible module executable command in the execution list.
[0007] In one possible implementation, query information is displayed on the screen, including: displaying one or more of the following query information on the screen: the port number of the listening port and the corresponding default parameters, prompt information; the database access password and the corresponding default parameters, prompt information; the number of database nodes and the corresponding default parameters, prompt information; the number of sentinel nodes and the corresponding default parameters, prompt information and the database deployment location and the corresponding default parameters, prompt information; accordingly, receiving the configuration parameters of the remote dictionary service Redis sentinel cluster of the server node to be configured input by the user according to the query information, including: receiving one or more of the port number of the listening port of the server node to be configured, the database access password, the number of database nodes, the number of sentinel nodes and the database deployment location input by the user according to the query information.
[0008] In a possible implementation, receiving configuration parameters of a Redis Sentinel cluster of a server node to be configured of a remote dictionary service Redis Sentinel cluster input by a user according to query information includes: when the Redis Sentinel cluster configuration parameters received from the user input are empty, determining default parameters or randomly generated parameters as the configuration parameters of the Redis Sentinel cluster.
[0009] In a possible implementation, after determining the default parameters or the randomly generated parameters as the configuration parameters of the Redis Sentinel cluster, the method further includes: sending the default parameters or the randomly generated parameters to a screen for display.
[0010] In one possible implementation, the Ansible module is controlled to read the execution list, and the deployment of the Redis Sentinel cluster on each server node to be configured is completed according to the Ansible module executable commands in the execution list, including: controlling the Ansible module to read the execution list, and executing the Ansible module executable commands to configure the Redis Sentinel cluster to the server node to be configured, thereby completing the deployment of the Redis Sentinel cluster.
[0011] In one possible implementation, after controlling the Ansible module to read the execution list and completing the deployment of the Redis Sentinel cluster of each server node to be configured according to the Ansible module executable commands in the execution list, it also includes: receiving a preset instruction for cluster status check input by the user, obtaining the cluster status of the Redis Sentinel cluster according to the preset instruction, and sending the cluster status to the screen for display, wherein the cluster status includes the server status parameters corresponding to the preset instruction and the configuration parameters of the Redis Sentinel cluster.
[0012] In the second aspect, the present application provides a Redis Sentinel cluster deployment device, including: an inquiry information display module for displaying inquiry information on the screen; a configuration parameter receiving module for receiving the configuration parameters of the remote dictionary service Redis Sentinel cluster of the server node to be configured input by the user according to the inquiry information; an execution list acquisition module for writing the configuration parameters of the Redis Sentinel cluster of the server node to be configured into a preset command segment, obtaining an Ansible module executable command, and forming an execution list of the Ansible module executable commands; a control module for controlling the Ansible module to read the execution list, and completing the deployment of the Redis Sentinel cluster of each server node to be configured according to the Ansible module executable command in the execution list.
[0013] In a third aspect, the present application also provides an electronic device comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; and the processor executes the computer-executable instructions stored in the memory to implement a method as described in any of the above aspects.
[0014] In a fourth aspect, the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the Redis Sentinel cluster deployment method as described in any of the above aspects.
[0015] In a fifth aspect, the present application also provides a computer program product, comprising a computer program, which implements any of the above methods when executed by a processor.
[0016] The Redis Sentinel cluster deployment method, apparatus, device and storage medium provided in the present application complete the collection of the configuration parameters of the Redis Sentinel cluster by displaying query information on the screen and receiving the configuration parameters of the remote dictionary service Redis Sentinel cluster of the server node to be configured input by the user according to the query information, and then writes the configuration parameters of the Redis Sentinel cluster of the server node to be configured into a preset command segment to obtain Ansible module executable commands, and composes the Ansible module executable commands into an execution list, and finally controls the Ansible module to read the execution list and completes the deployment of the Redis Sentinel cluster of each server node to be configured according to the Ansible module executable commands in the execution list, thereby realizing the automatic deployment of the Redis Sentinel cluster after obtaining the configuration parameters, reducing the time required for deploying the Redis Sentinel cluster, improving the efficiency of deploying the Redis Sentinel cluster and reducing the error rate of deployment. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0018] Figure 1 Schematic diagram of the application scenario of the Redis Sentinel cluster deployment provided in the embodiment of the present application;
[0019] Figure 2 A flow chart of the Redis Sentinel cluster deployment method provided in an embodiment of the present application;
[0020] Figure 3 A schematic diagram of the structure of a Redis Sentinel cluster deployment device provided in an embodiment of the present application;
[0021] Figure 4 Schematic diagram of an electronic device provided in an embodiment of the present application.
[0022] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION
[0023] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
[0024] With the continuous acceleration of network construction, society's demand for network services is increasing. Currently, servers have become an essential component of network service provision. When providing services to the outside world, servers are typically divided into master nodes and slave nodes. The master node needs to monitor the status of the slave nodes, and the slave nodes provide services to the outside world. During server operation, failures may occur. In such cases, it is necessary to monitor the server status and make appropriate adjustments to the master and slave nodes when a server failure occurs. Currently, Redis Sentinel Cluster can be used to monitor server status and respond to server failures.
[0025] To use the Redis Sentinel Cluster, you must first deploy the Redis Sentinel Cluster on the server. However, since each server plays an inconsistent role during operation and sometimes there are many servers, manually deploying the Redis Sentinel Cluster takes a lot of time and is prone to errors that lead to deployment failure.
[0026] In view of the above problems, this application proposes a Redis Sentinel cluster deployment method. This method asks the user for information, then receives configuration parameters entered by the user based on the query information, and forms a pre-set command segment based on the configuration parameters to obtain an execution list. Finally, the execution list is read using the Ansible module, and the Ansible module executable commands in the execution list are executed to complete the deployment of the Redis Sentinel cluster. The Redis Sentinel cluster deployment method provided in this application simplifies the steps of Redis Sentinel cluster deployment, reduces the time of Redis Sentinel cluster deployment, and reduces the error rate during the deployment process.
[0027] The embodiments of the present application provide a Redis Sentinel cluster deployment method, apparatus, device, and storage medium, which are applied to Redis Sentinel cluster deployment scenarios.
[0028] Figure 1 Schematic diagram of the application scenario of Redis Sentinel cluster deployment provided in this application embodiment. Figure 1 As shown, in this scenario, there are servers (101, 102, 103) and a client 104, and the servers (101, 102, 103) and the client 104 are connected in communication. The servers (101, 102, 103) use the CentOS system and have installed Python 2.4 or a version of Python 2.4 or above. When the installed Python version is lower than Python 2.5, pythonsimplejson is also installed. If selinux is enabled on the server, libselinux-python is also installed on the server. The client 104 can include a computer, tablet, mobile phone, PDA (Personal Digital Assistant), notebook or any other computing device with networking capabilities. The client can be connected to input devices such as a mouse and keyboard. The above-mentioned servers (101, 102, 103) can be implemented using a server or server group with more powerful processing power and higher security. This application does not limit the number of servers. The networks used for communication connections between them may include various types of wired and wireless networks, such as but not limited to: the Internet, local area networks, Wireless Fidelity (WIFI), Wireless Local Area Networks (WLAN), cellular communication networks (General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), 2G / 3G / 4G / 5G cellular networks), satellite communication networks, etc.
[0029] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0030] Figure 2 The Redis Sentinel cluster deployment method provided in this embodiment can be implemented by Figure 1 The server shown can also be executed by other dedicated deployment servers ( Figure 1 (not shown) is executed, and this embodiment of the application does not impose any limitation on this. Figure 2 As shown, the method includes:
[0031] S201: Display inquiry information on the screen.
[0032] Specifically, the server sends the query information to the client, and the client's screen displays the query information. Figure 1 The client's screen.
[0033] In this step, the inquiry information includes an inquiry about the configuration parameters, default parameters, and prompt information corresponding to the configuration parameters.
[0034] For example, "Please enter the listening port number after the database is started (the port number range is 4000-10000, the default port number is 6001, please avoid using port 6379)":", "Please enter the database access password (default random rule password):" and / or "Please enter the number of database nodes (the default is 3)", etc. This application does not limit the specific form and expression of the inquiry information. As long as it can express a prompt for the content that needs to be entered, the embodiments of this application do not list the inquiry information one by one.
[0035] S202: Receive configuration parameters of the remote dictionary service Redis Sentinel cluster of the server node to be configured, which are input by the user according to the query information.
[0036] In this step, the server node to be configured represents a node on which the Redis Sentinel cluster has not yet been deployed, and the configuration parameters of the Redis Sentinel cluster correspond to the query information.
[0037] For example, when the query information is "Please enter the listening port number after the database is started (the port number range is 4000-10000, the default port number is 6001, please avoid using port 6379):", the configuration parameters of the Redis Sentinel cluster should be a port number that conforms to the prompt information in the query information, such as "6012", "6031" or "9999", etc. When the query information is "Please enter the database access password (default random rule password):", the configuration parameters of the Redis Sentinel cluster should be a combination of a string of letters, numbers and / or symbols, such as "SAH3865!", "PIU87650" or "09673950", etc. The embodiments of this application do not list the configuration parameters one by one.
[0038] S203: writing the configuration parameters of the Redis Sentinel cluster of the server node to be configured into a preset command segment, obtaining an Ansible module executable command, and forming an execution list with the Ansible module executable command.
[0039] In this step, the pre-set command segment is the command segment to be filled with parameters. Once the configuration parameters are written to the command segment with the preset values, the pre-set command segment becomes complete and becomes an executable command for the Ansible module. Finally, all the obtained Ansible module executable commands are organized into an execution list, so that the Ansible module can execute all the Ansible module executable commands contained therein in sequence.
[0040] S204: Control the Ansible module to read the execution list, and complete the deployment of the Redis Sentinel cluster of each server node to be configured according to the Ansible module executable commands in the execution list.
[0041] In this step, the Ansible module is built into the server. The execution list can be implemented as a playbook or a list. The corresponding Ansible module can implement executable commands as tasks or plays. Multiple plays can form a playbook and complete the Redis Sentinel deployment task according to a pre-arranged mechanism. The Ansible module can gradually execute the Redis Sentinel cluster deployment according to the execution list.
[0042] From the description of the above embodiments, it can be seen that the deployment method of the Redis Sentinel cluster provided in the present application completes the collection of the configuration parameters of the Redis Sentinel cluster by displaying the query information on the screen and receiving the configuration parameters of the remote dictionary service Redis Sentinel cluster of the server node to be configured input by the user according to the query information, and then writes the configuration parameters of the Redis Sentinel cluster of the server node to be configured into a preset command segment to obtain the Ansible module executable command, and composes the Ansible module executable commands into an execution list, and finally controls the Ansible module to read the execution list, and completes the deployment of the Redis Sentinel cluster of each server node to be configured according to the Ansible module executable commands in the execution list, thereby realizing the automatic deployment of the Redis Sentinel cluster after obtaining the configuration parameters, reducing the time required for deploying the Redis Sentinel cluster, improving the efficiency of deploying the Redis Sentinel cluster and reducing the error rate of deployment.
[0043] In one possible implementation, S201 includes displaying one or more of the following query information on a screen: the port number of the listening port and corresponding default parameters and prompt information; the database access password and corresponding default parameters and prompt information; the number of database nodes and corresponding default parameters and prompt information; the number of sentinel nodes and corresponding default parameters and prompt information; and the database location and corresponding default parameters and prompt information. Accordingly, S202 includes receiving one or more of the following input from a user based on the query information: the port number of the listening port of the server node to be configured, the database access password, the number of database nodes, the number of sentinel nodes, and the database deployment location.
[0044] In this embodiment, the query information of the port number of the listening port may include: "Please enter the port number of the listening port (the port number range is 4000-10000, the default is 6001, please avoid using port 6379) :", wherein "6001" is the default parameter corresponding to the port number of the listening port, and "the port number range is 4000-10000" and "Please avoid using port 6379" are prompt information corresponding to the port number of the listening port. The corresponding server receives the numbers entered by the user, such as "8543" or "7456". The query information of the database access password may include "Please enter the database database access password (default random password, please do not set it too simple) :", wherein the random password is the default parameter corresponding to the database access password, and "please do not set it too simple" is the prompt information corresponding to the database access password. The corresponding server receives one or more combinations of numbers, letters and symbols entered by the user. The query information for the number of database nodes may include "Please enter the number of database nodes (the default is 3, please enter a number greater than 2):" where "3" is the default parameter corresponding to the number of database nodes, and "Please enter a number greater than 2" is the prompt information corresponding to the number of database nodes. The query information for the number of sentinel nodes may include "Please enter the number of sentinel nodes (the default is 3, please enter a number greater than 2):" where "3" is the default parameter corresponding to the number of sentinel nodes, and "Please enter a number greater than 2" is the prompt information corresponding to the number of sentinel nodes. The corresponding server receives the number of nodes entered by the user, where the number of nodes can be an integer greater than 2. The query information for the database deployment location may include "Please enter the database deployment location (the default path is / data / redis, and the disk storage space must be sufficient):" where " / data / redis" is the default parameter corresponding to the number of sentinel nodes, and "The disk storage space must be sufficient" is the prompt information corresponding to the number of sentinel nodes. The corresponding server receives the database installation path entered by the user.
[0045] If the received Redis Sentinel Cluster configuration parameters do not meet the preset requirements, for example, if the user enters a listening port number less than 4000 or greater than 10000, the screen displays "Input does not meet the requirements, please re-enter" or "Port number is out of range, please re-enter" and the corresponding prompt message is displayed again. If the received Redis Sentinel Cluster configuration parameters do not meet the requirements, they will not be written into the preset command segment. The preset requirements can be set in advance.
[0046] As can be seen from the description of the above embodiment, the solution provided by this embodiment can provide detailed prompts for the configuration parameters that need to be input by displaying query information, making the deployment method of the entire Redis Sentinel cluster simpler and clearer.
[0047] In a possible implementation, after receiving the database node number input by the user, the method further includes: displaying query information of the database node IP address (Internet Protocol Address) on the screen.
[0048] Specifically, the query information of the database node IP address includes: a query of the IP address of each database node.
[0049] The query information for the database node IP address is, for example, one or more of “please enter the IP address of the first database node”, “please enter the IP address of the second database node”, and “please enter the IP address of the third database node”.
[0050] In a possible implementation, after receiving the number of sentinel nodes input by the user, the method further includes: displaying query information of the sentinel node IP address on the screen.
[0051] Specifically, the query information of the sentinel node IP address includes: a query of each sentinel node IP address.
[0052] The query information of the sentinel node IP address is, for example, one or more of “please enter the IP address of the first sentinel node”, “please enter the IP address of the second sentinel node” and “please enter the IP address of the third sentinel node”.
[0053] Correspondingly, the server will also receive the server node IP address and sentinel node IP address input by the user. It should be noted that this application does not limit the specific content of the query information of the database node IP address and the sentinel node IP address, and the user can be prompted.
[0054] In addition, the default port number of the sentinel's listening port includes the database listening port plus 10000. For example, if the database listening port is 6001, the port number of the sentinel's listening port is 16001. The port number of the sentinel's listening port can also be set by yourself. The embodiment of the present application does not limit the specific form of the port number of the sentinel's listening port and the default port number.
[0055] In a possible implementation, step S202 may be to determine default parameters or randomly generated parameters as configuration parameters of the Redis Sentinel cluster when the Redis Sentinel cluster configuration parameters received from the user are empty.
[0056] In this embodiment, the Redis Sentinel cluster configuration parameter is empty, which means that only the signal of the Enter key or the Enter key is received, and no other input characters are received. At this time, the computer uses the above default parameters as configuration parameters, or randomly generates a configuration parameter that meets the requirements.
[0057] The method of determining the default parameters or randomly generated parameters as the configuration parameters of the Redis Sentinel Cluster is, for example, when the port number of the received listening port is empty, the default parameter "6001" can be used as the port number of the listening port. When the port number "6001" is already occupied, a number between 4000 and 10000 is randomly generated as the port number, and the randomly generated number will not be 6379. If the randomly generated number is already used as the port number, it is randomly generated again; when the received database access password is empty, a password is randomly generated. The randomly generated password can be a combination of numbers, letters and / or symbols. This application does not limit the specific form of the password. In addition, when the received number of database nodes, number of sentinel nodes and database deployment location are empty, the default parameters or randomly generated parameters can also be used as configuration parameters.
[0058] From the description of the above embodiment, it can be seen that the embodiment of the present application can use default parameters or randomly generated parameters as the configuration parameters of the Redis Sentinel cluster when the configuration parameters of the Redis Sentinel cluster received from the user are empty. This further simplifies the deployment process of the Redis Sentinel cluster, reduces the deployment time of the Redis Sentinel cluster, and improves the deployment efficiency of the Redis Sentinel cluster.
[0059] In a possible implementation, connected to the previous embodiment provided in this application, after the default parameters or randomly generated parameters are determined as the configuration parameters of the Redis Sentinel cluster, the default parameters or randomly generated parameters can also be sent to the screen for display.
[0060] In this embodiment, the default parameters or randomly generated parameters are as shown in the above embodiment. After the default parameters or randomly generated parameters are determined as configuration parameters, the server sends the determined configuration parameters to the client, and the client displays the corresponding configuration parameters received on the screen.
[0061] From the description of the above embodiment, it can be seen that by sending the default parameters or randomly generated parameters to the screen for display, the determined configuration parameters can be informed to the user in a displayed manner, thereby making the configuration parameters public to the user, making the subsequent configuration and maintenance of the Redis Sentinel cluster more convenient.
[0062] In one possible implementation, controlling the Ansible module to read the execution list and completing the deployment of the Redis Sentinel cluster on each server node to be configured according to the Ansible module executable commands in the execution list may include controlling the Ansible module to read the execution list and executing the Ansible module executable commands to configure the Redis Sentinel cluster to the server node to be configured, thereby completing the deployment of the Redis Sentinel cluster.
[0063] In this embodiment, the Ansible module can execute the Ansible module executable commands in the above execution list in sequence, gradually completing the configuration of the number of database nodes, the number of sentinel nodes, and the database access password, and finally completing the deployment of the Redis Sentinel cluster.
[0064] After the Redis Sentinel cluster is deployed, you can also start the Redis Sentinel cluster. The Redis Sentinel cluster can be started according to the startup instruction after receiving the user's startup instruction, or it can be started automatically after the Redis Sentinel cluster is deployed.
[0065] As can be seen from the description of the above embodiment, by using the ansible module to read the execution list and execute the ansible module executable commands in the above execution list, the deployment and startup of the Redis Sentinel cluster can be automatically completed after the configuration parameters are received and written.
[0066] In one possible implementation, after step S204 of the above embodiment, a preset instruction for cluster status check input by the user can be received, the cluster status of the Redis Sentinel cluster is obtained according to the preset instruction, and the cluster status is sent to the screen for display, where the cluster status includes the server status parameters corresponding to the preset instruction and the configuration parameters of the Redis Sentinel cluster.
[0067] In this embodiment, the preset instructions are used to reflect the hardware parameters of the cluster and the configuration parameters of the Redis Sentinel cluster. The cluster hardware parameters include the number of CPU (central processing unit) cores, the total memory size, the specific services provided by the specific server, the remaining memory size and / or the network speed, etc., which are not listed one by one in this application.
[0068] From the description of the above embodiment, it can be seen that by sending the server status parameters and the configuration parameters of the Redis Sentinel cluster to the screen for display, the cluster status can be further made more transparent, and the unified display of the server status parameters and the configuration parameters also makes the output more concise.
[0069] In one possible implementation, the Ansible module is controlled to read the execution list and complete the deployment of the Redis Sentinel cluster of each server node to be configured according to the Ansible module executable commands in the execution list. Then, the cluster status will be automatically sent to the screen for display according to the preset instructions.
[0070] In this embodiment, the server will detect the running status of the Ansible module. When the Ansible module stops running, the server obtains the cluster status according to the preset instructions and sends the cluster status to the screen for display. The cluster status and display process are the same as in the above embodiment and will not be repeated here.
[0071] From the description of the above embodiment, it can be seen that the server will detect the running status of the Ansible module, and automatically obtain the cluster status according to the preset instructions when the Ansible module stops running, and send the cluster status to the screen for display, which further reduces the operation steps and speeds up the overall speed of deploying the Redis Sentinel cluster.
[0072] In a possible implementation, in step S203, a withdrawal instruction may be received, and according to the withdrawal instruction, the current Redis Sentinel configuration parameters may be deleted, the Ansible module executable command may be returned to a preset command segment, and the query information may be redisplayed on the screen.
[0073] In this embodiment, the withdraw instruction can be an instruction to withdraw once or an instruction to withdraw multiple times. When the withdraw instruction is an instruction to withdraw once, only the configuration parameters written most recently are deleted. When the withdraw instruction is an instruction to withdraw multiple times, the configuration parameters written a specified number of times starting from the most recent number are deleted, and then the query information is displayed on the screen based on the configuration parameters that have not been written.
[0074] From the description of the above embodiment, it can be seen that by receiving a withdrawal instruction and deleting the current Redis Sentinel configuration parameters according to the withdrawal instruction, the rollback of the Redis Sentinel cluster deployment process is achieved, the flexibility of the Redis Sentinel cluster deployment is increased, and the situation of having to redeploy due to input errors is prevented.
[0075] Figure 3 This is a schematic diagram of the structure of the Redis Sentinel cluster deployment device provided in the embodiment of this application. For an example, see Figure 3 As shown, the Redis Sentinel cluster deployment device 300 may include: an inquiry information display module 301 , a configuration parameter receiving module 302 , an execution list obtaining module 303 and a control module 304 .
[0076] The inquiry information display module 301 is used to display the inquiry information on the screen.
[0077] The configuration parameter receiving module 302 is used to receive the configuration parameters of the remote dictionary service Redis Sentinel cluster of the server node to be configured, which are input by the user according to the query information.
[0078] The execution list obtaining module 303 is used to write the configuration parameters of the Redis Sentinel cluster of the server node to be configured into a preset command segment, obtain an Ansible module executable command, and form an execution list with the Ansible module executable command.
[0079] The control module 304 is used to control the Ansible module to read the execution list and complete the deployment of the Redis Sentinel cluster of each server node to be configured according to the Ansible module executable commands in the execution list.
[0080] In one possible implementation, the inquiry information display module 301 is specifically used to display one or more of the following inquiry information on the screen: the port number of the listening port and the corresponding default parameters and prompt information; the database access password and the corresponding default parameters and prompt information; the number of database nodes and the corresponding default parameters and prompt information; the number of sentinel nodes and the corresponding default parameters and prompt information and the database deployment location and the corresponding default parameters and prompt information.
[0081] The configuration parameter receiving module 302 is specifically used to receive one or more of the listening port number of the server node to be configured, the database access password, the number of database nodes, the number of sentinel nodes and the database deployment location input by the user according to the query information.
[0082] In a possible implementation, the configuration parameter receiving module 302 is further configured to determine default parameters or randomly generated parameters as the configuration parameters of the Redis Sentinel cluster when the Redis Sentinel cluster configuration parameters received from the user are empty.
[0083] In a possible implementation, the Redis Sentinel cluster deployment device further includes a parameter display module (not shown in the figure) for sending default parameters or randomly generated parameters to a screen for display.
[0084] In a possible time mode, the control module 304 is specifically used to control the ansible module to read the execution list and execute the ansible module executable command to configure the Redis sentinel cluster to the server node to be configured, thereby completing the deployment of the Redis sentinel cluster.
[0085] In one possible time mode, the Redis Sentinel cluster deployment device also includes a cluster status display module (not shown in the figure), which is used to receive preset instructions for cluster status check input by the user, obtain the cluster status of the Redis Sentinel cluster according to the preset instructions, and send the cluster status to the screen for display, wherein the cluster status includes server status parameters corresponding to the preset instructions and configuration parameters of the Redis Sentinel cluster.
[0086] Figure 4 Schematic diagram of an electronic device provided in an embodiment of the present application. For example, see Figure 4 As shown, the electronic device 400 includes: a processor 401 and a memory 402 communicatively connected to the processor.
[0087] Memory 402 stores computer-executable instructions. Processor 401 executes the computer-executable instructions stored in memory 402. Furthermore, electronic device 400 may further include an I / O interface (not shown) that provides an interface between electronic device 400 and a peripheral interface module, such as a keyboard, click wheel, or button, to implement a method as described in any of the above embodiments.
[0088] The computer-readable storage medium stores computer-executable instructions. When the processor executes the computer-executable instructions, the technical solution of the Redis Sentinel cluster deployment method in any of the above embodiments is implemented. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the Redis Sentinel cluster deployment method. Please refer to the implementation principle and beneficial effects of the Redis Sentinel cluster deployment method, which will not be repeated here.
[0089] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the technical solution of the Redis Sentinel cluster deployment method in any of the above embodiments. Its implementation principles and beneficial effects are similar to those of the Redis Sentinel cluster deployment method. Please refer to the implementation principles and beneficial effects of the Redis Sentinel cluster deployment method, which will not be repeated here.
[0090] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules is only a logical function division. In actual implementation, there may be other division methods, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or module, which can be electrical, mechanical or other forms.
[0091] Modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, that is, they may be located in one place or distributed across multiple network elements. Some or all of these modules may be selected to implement the solution of this embodiment based on actual needs.
[0092] In addition, the functional modules in the various embodiments of the present application may be integrated into a single processing unit, or each module may exist physically separately, or two or more modules may be integrated into a single unit. The above-mentioned modules may be implemented in the form of hardware or hardware plus software functional units.
[0093] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform some steps of the method provided in each embodiment of the present application.
[0094] It should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), or application-specific integrated circuits (ASICs). A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly implemented by a hardware processor or implemented by a combination of hardware and software modules in the processor.
[0095] The memory may include a high-speed RAM memory, and may also include non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk.
[0096] The storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.
[0097] An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the storage medium can also exist as discrete components in an electronic device or a main control device.
[0098] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0099] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of the present application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0100] It should be understood that the present application is not limited to the exact structure described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A Redis Sentinel cluster deployment method, characterized in that: include: Display one or more of the following inquiry information on the screen: the port number of the listening port and the corresponding default parameters and prompt information; the database access password and the corresponding default parameters and prompt information; the number of database nodes and the corresponding default parameters and prompt information; the number of sentinel nodes and the corresponding default parameters and prompt information; and the database deployment location and the corresponding default parameters and prompt information; Receive configuration parameters of the remote dictionary service Redis Sentinel cluster of the server node to be configured input by the user according to the query information; Write the configuration parameters of the Redis Sentinel cluster of the server node to be configured into a preset command segment to obtain an Ansible module executable command, and form an execution list with the Ansible module executable command; Control the ansible module to read the execution list and execute the ansible module executable command to configure the Redis Sentinel cluster to the server node to be configured, thereby completing the deployment of the Redis Sentinel cluster; The configuration parameters of the Redis Sentinel cluster of the remote dictionary service Redis Sentinel cluster to be configured, which are received by the user according to the query information, include: Receive one or more of the port number of the listening port of the server node to be configured, the database access password, the number of database nodes, the number of sentinel nodes, and the database deployment location input by the user according to the query information.
2. The method according to claim 1, characterized in that The configuration parameters of the Redis Sentinel cluster of the remote dictionary service Redis Sentinel cluster to be configured, which are received by the user according to the query information, include: When the Redis Sentinel cluster configuration parameters received from the user are empty, default parameters or randomly generated parameters are determined as the configuration parameters of the Redis Sentinel cluster.
3. The method according to claim 2, characterized in that After determining the default parameters or randomly generated parameters as the configuration parameters of the Redis Sentinel cluster, the method further includes: The default parameters or randomly generated parameters are sent to the screen for display.
4. The method according to any one of claims 1 to 3, characterized in that After controlling the Ansible module to read the execution list and execute the Ansible module executable command to configure the Redis Sentinel cluster to the server node to be configured, and completing the deployment of the Redis Sentinel cluster, the method further includes: Receive a preset instruction for cluster status check input by the user, obtain the cluster status of the Redis Sentinel cluster according to the preset instruction, and send the cluster status to the screen for display, wherein the cluster status includes the server status parameters corresponding to the preset instruction and the configuration parameters of the Redis Sentinel cluster.
5. A Redis Sentinel cluster deployment device, comprising: The query information display module is used to display one or more of the following query information on the screen: the port number of the listening port and the corresponding default parameters and prompt information; the database access password and the corresponding default parameters and prompt information; the number of database nodes and the corresponding default parameters and prompt information; the number of sentinel nodes and the corresponding default parameters and prompt information; and the database deployment location and the corresponding default parameters and prompt information; A configuration parameter receiving module, configured to receive the configuration parameters of the remote dictionary service Redis Sentinel cluster of the server node to be configured input by the user according to the query information; An execution list acquisition module is used to write the configuration parameters of the Redis Sentinel cluster of the server node to be configured into a preset command segment, obtain an Ansible module executable command, and form an execution list with the Ansible module executable command; A control module is used to control the Ansible module to read the execution list and execute the Ansible module executable command to configure the Redis Sentinel cluster to the server node to be configured, thereby completing the deployment of the Redis Sentinel cluster; The configuration parameter receiving module is specifically used to receive one or more of the port number of the listening port of the server node to be configured, the database access password, the number of database nodes, the number of sentinel nodes and the database deployment location input by the user according to the query information.
6. An electronic device comprising: a processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 4.
7. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the Redis Sentinel cluster deployment method according to any one of claims 1 to 4.
8. A computer program product comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Server cluster monitoring method and apparatus
CN108234170A
An implementation method and a system for deploying OpenStack
CN109213496A