Redis cluster construction method, device, electronic device and storage medium

By using the bastion terminal equipment to transmit pre-stored construction configuration data in the Redis cluster construction, the Redis node is automatically built and started, solving the problem of time-consuming construction and information security in the existing technology, and achieving an efficient and secure Redis cluster construction process.

CN114338402BActive Publication Date: 2024-11-05CHINA TELECOM CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111680609.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-30
Publication Date
2024-11-05
Estimated Expiration
2041-12-30

AI Technical Summary

Technical Problem

In the prior art, Redis cluster construction takes a long time and is complex in operation. The server and network equipment need to manually transmit passwords during data transmission, which poses information security risks.

Method used

By sending a single sign-on request to the bastion terminal device, obtaining and transmitting pre-stored construction configuration data, automatically build Redis nodes, and starting after all nodes are built, the automatic construction of Redis clusters and secure data transmission are realized.

Benefits of technology

It greatly improves the efficiency of Redis cluster construction, reduces operational errors, simplifies the construction process, and ensures the security of data transmission through the media of the fortress terminal equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114338402B_ABST
    Figure CN114338402B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a method, device, electronic device and storage medium for building a Redis cluster, the method comprising: sending a single sign-on request to a fortress terminal device, so that the fortress terminal device obtains the building configuration data sent by the server according to the single sign-on request; wherein the building configuration data is obtained by the server from multiple stored building configuration data according to the configuration data acquisition request received from the fortress terminal device, and the configuration data acquisition request is generated based on the single sign-on request; receiving the building configuration data sent by the fortress terminal device; building a redis node according to the building configuration data; if all network devices indicated by the server have built redis nodes, then starting the built redis nodes to complete the building of the Redis cluster. The remote data server Redis cluster building method disclosed in the present application improves the building efficiency of the Redis cluster and ensures the security of configuration data access between the first network device and the server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of server technology, and in particular to a method, device, electronic device and storage medium for building a Redis cluster. Background Art

[0002] Redis (Remote Dictionary Server) is an open source (BSD licensed) in-memory data structure storage system that can be used as a database, cache, and message middleware. Redis Cluster is a distributed solution for Redis, which was officially launched in Redis 3.0 and effectively solves the demand for redis distribution. When encountering bottlenecks such as single-machine memory, concurrency, and traffic, the Cluster architecture can be used to achieve load balancing.

[0003] Currently, Redis clusters are usually built by manual input, which is time-consuming and complicated to operate. In addition, when the server and the host are transmitting data, the server needs to obtain the host password before accessing it. Summary of the invention

[0004] To solve the above technical problems, the embodiments of the present application provide a method, device, electronic device and storage medium for building a redis cluster.

[0005] According to one aspect of an embodiment of the present application, a method for building a remote data server Redis cluster is provided, which is applied to a first network device, and the method includes:

[0006] Sending a single sign-on request to a fortress terminal device, so that the fortress terminal device obtains the setup configuration data sent by the server according to the single sign-on request; wherein the setup configuration data is obtained by the server from a plurality of stored setup configuration data according to the configuration data acquisition request received from the fortress terminal device, and the configuration data acquisition request is generated based on the single sign-on request;

[0007] Receive the setup configuration data sent by the fortress terminal device; and set up a redis node according to the setup configuration data;

[0008] If all network devices indicated by the server have completed the construction of redis nodes, the constructed redis nodes are started to complete the construction of the Redis cluster.

[0009] According to one aspect of an embodiment of the present application, a method for building a remote data server Redis cluster is provided, which is applied to a server, and the method includes:

[0010] Receiving a configuration data acquisition request sent by a fortress terminal device; wherein the configuration data acquisition request is generated by the fortress terminal device based on a received single sign-on request sent by a first network device;

[0011] Acquire the building configuration data from the stored multiple building configuration data according to the configuration data acquisition request;

[0012] Send the setup configuration data to the fortress terminal device, so that the fortress terminal device sends the setup configuration data to the first network device, so as to build the redis node according to the setup configuration data.

[0013] According to one aspect of an embodiment of the present application, a device for building a remote data server Redis cluster is provided, the device comprising:

[0014] A sending module, configured to send a single sign-on request to a fortress terminal device, so that the fortress terminal device obtains the setup configuration data sent by the server according to the single sign-on request; wherein the setup configuration data is obtained by the server from a plurality of stored setup configuration data according to the configuration data acquisition request received from the fortress terminal device, and the configuration data acquisition request is generated based on the single sign-on request;

[0015] A receiving module, configured to receive the building configuration data sent by the fortress terminal device;

[0016] The node building module is configured to build a redis node according to the building configuration data; the node startup module is configured to start the built redis node if all network devices indicated by the server have built redis nodes to complete the building of the Redis cluster.

[0017] According to one aspect of an embodiment of the present application, a device for building a remote data server Redis cluster is also provided, the device comprising:

[0018] An acquisition request receiving module is configured to receive a configuration data acquisition request sent by a fortress terminal device; wherein the configuration data acquisition request is generated by the fortress terminal device based on a received single sign-on request sent by a first network device;

[0019] A configuration data receiving module, configured to obtain the building configuration data from the stored multiple building configuration data according to the configuration data acquisition request;

[0020] The configuration data sending module is configured to send the construction configuration data to the fortress terminal device, so that the fortress terminal device sends the construction configuration data to the first network device to build the redis node according to the construction configuration data.

[0021] According to one aspect of an embodiment of the present application, there is provided an electronic device, including:

[0022] a memory storing computer-readable instructions;

[0023] The processor reads the computer-readable instructions stored in the memory to execute any of the above methods for building a Redis cluster.

[0024] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer-readable instructions are stored. When the computer-readable instructions are executed by a processor of a computer, the computer executes the method for building a Redis cluster as described above.

[0025] In the technical solution provided in the embodiment of the present application, a single sign-on request is sent to a bastion terminal device, so that the bastion terminal device obtains the setup configuration data sent by the server according to the single sign-on request; wherein the setup configuration data is obtained by the server from multiple stored setup configuration data according to the configuration data acquisition request received from the bastion terminal device, and the configuration data acquisition request is generated based on the single sign-on request; the setup configuration data sent by the bastion terminal device is received; the redis node is built according to the setup configuration data; if all network devices indicated by the server have built the redis node, the built redis node is started to complete the building of the Redis cluster. On the one hand, since multiple configuration data are stored in the server, and when receiving the Redis cluster building instruction, it can be obtained from the stored multiple configuration data. Compared with the related technology that each time a Redis cluster is built, it is necessary to input the building configuration data required for building a Redis cluster in sequence, the building takes less time, which greatly improves the efficiency of Redis cluster building; on the other hand, the multiple configuration data stored in the server can be reused, which to a certain extent reduces the workload of the relevant staff who need to repeatedly input the building configuration data required for building a Redis cluster; on the other hand, since multiple configuration data are pre-stored in the server, the problem of operating errors caused by manual building of the Redis cluster is avoided to a certain extent, the accuracy of Redis cluster building is improved, and it is simple and easy to implement. On the other hand, compared with the prior art that the first network device needs to transmit its password to the server to realize configuration data transmission, the present application uses the fortress terminal device to establish configuration data transmission between the server and the first network device, which ensures the security of configuration data transmission between the server and the first network device.

[0026] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:

[0028] Figure 1 It is a schematic diagram of an implementation environment involved in this application;

[0029] Figure 2 yes Figure 1 A schematic diagram of a Redis cluster system corresponding to the implementation environment shown;

[0030] Figure 3 It is a flow chart of a method for building a Redis cluster shown in an exemplary embodiment of the present application;

[0031] Figure 4 is a flow chart of a method for building a Redis cluster shown in another exemplary embodiment of the present application;

[0032] Figure 5 yes Figure 4 Step S230 in the illustrated embodiment is a flow chart in an exemplary embodiment;

[0033] Figure 6 yes Figure 3 Step S140 in the illustrated embodiment is a flow chart in an exemplary embodiment;

[0034] Figure 7 is a flowchart of a method for building a Redis cluster shown in another exemplary embodiment of the present application;

[0035] Figure 8 is a block diagram of a device for building a Redis cluster shown in an exemplary embodiment of the present application;

[0036] Fig. 9 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION

[0037] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.

[0038] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0039] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.

[0040] It should also be noted that the "multiple" mentioned in this application refers to two or more than two. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship.

[0041] Redis (Remote Dictionary Server) is an open source (BSD licensed) in-memory data structure storage system that can be used as a database, cache, and message middleware. Redis Cluster is a distributed solution for Redis, which was officially launched in Redis 3.0 and effectively solves the demand for redis distribution. When encountering bottlenecks such as single-machine memory, concurrency, and traffic, the Cluster architecture can be used to achieve load balancing. In Redis Cluster, the concept of hash slots is used to implement sharding. A Redis cluster is divided into 16,384 hash slots, and all keys stored in the Redis cluster will be reflected in these hash slots.

[0042] Currently, if you want to deploy a Redis cluster, you need to manually perform various operations and file configurations on the Redis cluster, which is extremely time-consuming and labor-intensive. If the cluster is large, manual deployment of cluster nodes is prone to omissions. In addition, before the server and the network device establish a Redis node, the network device needs to store or send its password to the server so that the server and the network device can establish configuration data access, but the information security of the network device cannot be guaranteed.

[0043] Based on this, in order to improve the deployment efficiency of the Redis cluster, avoid manual deployment of cluster nodes leading to operational errors, and ensure the information security of network devices when servers and network devices are building redis nodes. The network device of the embodiment of the present application sends a single sign-on request to the fortress terminal device, so that the fortress terminal device obtains the building configuration data sent by the server according to the single sign-on request; wherein, the building configuration data is obtained by the server from the stored multiple building configuration data according to the configuration data acquisition request sent by the fortress terminal device, and the configuration data acquisition request is generated based on the single sign-on request; receiving the building configuration data sent by the fortress terminal device; building the redis node according to the building configuration data; if all network devices indicated by the server have built the redis node, the built redis node is started to complete the building of the Redis cluster.

[0044] See also Figure 1 , Figure 1 It is a schematic diagram of an implementation environment involved in the present application. The implementation environment includes a network device 100, a server 200 and a fortress terminal device 300, the network device 100 and the fortress terminal device 300 communicate with each other through a wired or wireless network, and the server 200 and the fortress terminal device 300 communicate with each other through a wired or wireless network.

[0045] During the construction of the remote data server Redis cluster, the server 200 pre-stores multiple construction configuration data. If the server 200 and the network device 100 need to build a Redis cluster, the network device 100 generates a single sign-on request and sends the single sign-on request to the fortress terminal device 300. The fortress terminal device 300 receives the single sign-on request, generates a configuration data acquisition request based on the single sign-on request, and sends the configuration data acquisition request to the server 200. The server 200 receives the configuration data acquisition request, and obtains the construction configuration data that matches the network device 100 from the stored multiple construction configuration data, and sends the construction configuration data that matches the network device 100 to the fortress terminal device 300. The fortress terminal device 300 receives the construction configuration data sent by the server 200, and sends the construction configuration data to the network device 100. The network device 100 receives the construction configuration data sent by the fortress terminal device 300, and builds the redis node based on the construction configuration data sent by the fortress terminal device 300. If all network devices indicated by the server 200 have completed the construction of the redis node, the network device 100 starts the constructed redis node to complete the construction of the Redis cluster.

[0046] See also Figure 2 , Figure 2 yes Figure 1 Schematic diagram of the Redis cluster construction system corresponding to the implementation environment shown. The Redis cluster construction system includes a server 400, multiple network devices 500, and a fortress terminal device 600 corresponding to the network device. Each network device 400 communicates with its corresponding fortress terminal device 600 via a wired or wireless network. The fortress terminal device 600 communicates with the server 400 via a wired or wireless network.

[0047] In the Redis cluster construction system, the server 400 pre-stores multiple construction configuration data. If the server 400 needs to build a Redis cluster with a network device 500, the network device 500 generates a single sign-on request and sends the single sign-on request to the fortress terminal device 600. The fortress terminal device 600 receives the single sign-on request, generates a configuration data acquisition request based on the single sign-on request, and sends the configuration data acquisition request to the server 400. The server 400 receives the configuration data acquisition request, and obtains the construction configuration data matching the network device 500 from the stored multiple construction configuration data, and sends the construction configuration data matching the network device 500 to the fortress terminal device 600. The fortress terminal device 600 receives the construction configuration data sent by the server 400, and sends the construction configuration data to the network device 500. The network device 500 receives the construction configuration data sent by the fortress terminal device 600, and builds the redis node based on the construction configuration data sent by the fortress terminal device 600. After the redis node is built between the network device 500 and the server 400, another fortress terminal device 600 receives the single sign-on request sent by the corresponding network device 500, so that the fortress terminal device 600, the corresponding network device 500 and the server 400 perform the same building operation as above. Repeat the above process so that each network device 500 builds a redis node with the server 400. If the server 400 detects that the multiple network devices 500 indicated by it have completed the redis node construction, all the built redis nodes are started to realize the construction of the Redis cluster.

[0048] in, Figure 1 The network device 100 or Figure 2 The network device 500 shown can be any network device that supports the establishment of Redis nodes, such as a smart phone, a car computer, a tablet computer, a laptop computer, or a wearable device, but is not limited thereto. Figure 1 The server 200 or Figure 2 The server 300 shown is a server, for example, it can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or it can be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms, which are not limited here. The network device end 100 can communicate with the server end 200 through wireless networks such as 2G (third generation mobile information technology), 4G (fourth generation mobile information technology), and 5G (fifth generation mobile information technology), which are not limited here.

[0049] See also Figure 3 , Figure 3 is a flowchart of a method for building a Redis cluster shown in an exemplary embodiment of the present application. The method can be applied to Figure 1 The implementation environment shown is specifically executed by the network device 100 in the implementation environment. It should be understood that the method can also be applied to other exemplary implementation environments and be specifically executed by devices in other implementation environments. This embodiment does not limit the implementation environment to which the method is applicable.

[0050] The following is a detailed introduction to the Redis cluster building method proposed in the embodiment of the present application, taking the first network device as the specific execution entity.

[0051] like Figure 3 As shown, in an exemplary embodiment, the method for building a Redis cluster includes at least steps S110 to S130, which are described in detail as follows:

[0052] Step S110, sending a single sign-on request to the bastion terminal device, so that the bastion terminal device obtains the setup configuration data sent by the server according to the single sign-on request.

[0053] First of all, it should be noted that the single sign-on request is a request for the network device to build a redis node with the server through the bastion terminal device, so that the bastion terminal device can protect the information security of the network device.

[0054] The setup configuration data includes the configuration data required to setup the redis node. The setup configuration data is obtained from the stored multiple setup configuration data when the server receives the configuration data request sent by the bastion terminal device. The configuration data request is generated based on the single sign-on request.

[0055] Configuration data includes redis source code, redis configuration file and build script. Redis source code, redis configuration file and build script correspond one to one.

[0056] The redis source code is the source code required to build a Redis cluster. The redis configuration file includes the number of nodes required to build a Redis cluster, the port number of the node, and the connection relationship between each node. The script file is the tool used to build a redis cluster.

[0057] Considering that the manual input method of setting up a Redis cluster has problems such as time-consuming construction and complex operation. To this end, the server pre-stores various versions of the construction configuration data. If the first network device needs to set up a Redis cluster with the server, a single sign-on request is sent to the bastion terminal device. The bastion terminal device receives the single sign-on request, generates a configuration data acquisition instruction based on the single sign-on request, and sends the configuration data acquisition instruction to the server. The server receives the configuration data sent by the bastion terminal device, and selects the construction configuration data that matches the first network device from the pre-stored versions of the construction configuration data, and sends the construction configuration data to the bastion terminal device. The bastion terminal device receives the construction configuration data sent by the server, and sends the construction configuration data to the first network device.

[0058] Step S120, receiving the setup configuration data sent by the fortress terminal device.

[0059] It should be noted that in order to determine the setup configuration data sent by the server to the bastion terminal device. The single sign-on request may include the setup configuration data information required for the first network device. The configuration data acquisition instruction generated by the terminal device according to the single sign-on request also includes the setup configuration data information required for the first network device. The server receives the configuration data acquisition instruction sent by the bastion terminal device, and analyzes and processes the setup configuration data information of the first network device based on the configuration data acquisition instruction, and then determines the setup configuration data that matches the first network device from multiple versions of the setup configuration data, and sends the setup configuration data to the bastion terminal device. The bastion terminal device receives the setup configuration data that matches the first network device, and sends the setup configuration data that matches the first network device to the first network device. The first network device receives the setup configuration data sent by the bastion terminal device.

[0060] Step S130, building a redis node according to the building configuration data.

[0061] The redis cluster that the first network device needs to build includes at least 3 master nodes, each master node can have zero or more slave nodes, and the data between each master node is not synchronized, but each stores its own data. Specifically, considering high concurrency, each master node has at least 1 slave node.

[0062] The first network device builds a redis node based on the building configuration data sent by the bastion terminal device and matching the first network device.

[0063] Step S140: If all network devices indicated by the server have completed the construction of redis nodes, the constructed redis nodes are started to complete the construction of the redis cluster.

[0064] All network devices indicated by the server are network devices that need to establish redis nodes with the server.

[0065] If the network devices corresponding to the required redis clusters indicated by the server have completed the redis node construction, the built redis nodes are started to complete the construction of the redis cluster.

[0066] It can be seen that the redis cluster building method of this embodiment sends a single sign-on request to the bastion terminal device, so that the bastion terminal device obtains the building configuration data sent by the server according to the single sign-on request; wherein, the building configuration data is obtained by the server from multiple stored building configuration data according to the configuration data acquisition request received from the bastion terminal device, and the configuration data acquisition request is generated based on the single sign-on request; receiving the building configuration data sent by the bastion terminal device; building the redis node according to the building configuration data; if all network devices indicated by the server have built the redis node, then starting the built redis node to complete the building of the Redis cluster. On the one hand, since multiple configuration data are stored in the server, and when receiving the Redis cluster building instruction, it can be obtained from the stored multiple configuration data. Compared with the related technology that each time a Redis cluster is built, it is necessary to input the building configuration data required for building a Redis cluster in sequence, the building takes less time, which greatly improves the efficiency of Redis cluster building; on the other hand, the multiple configuration data stored in the server can be reused, which to a certain extent reduces the workload of the relevant staff who need to repeatedly input the building configuration data required for building a Redis cluster; on the other hand, since multiple configuration data are pre-stored in the server, the problem of operating errors caused by manual building of the Redis cluster is avoided to a certain extent, the accuracy of Redis cluster building is improved, and it is simple and easy to implement. On the other hand, compared with the prior art that the first network device needs to transmit its password to the server to realize configuration data transmission, the present application uses the fortress terminal device to establish configuration data transmission between the server and the first network device, which ensures the security of configuration data transmission between the server and the first network device.

[0067] Based on the above embodiments, this embodiment provides the following solution to ensure the security and reliability of redis cluster construction.

[0068] like Figure 4 As shown, in the above exemplary embodiment, the method for building a redis cluster at least further includes steps S210 to S240, which are described in detail as follows:

[0069] Step S210, sending a single sign-on request to the bastion terminal device, so that the bastion terminal device obtains the setup configuration data sent by the server according to the single sign-on request.

[0070] The detailed description of step S210 in this embodiment can refer to step S110 in the above embodiment, and will not be repeated here.

[0071] Step S220, receiving the setup configuration data sent by the fortress terminal device.

[0072] The detailed description of step S220 in this embodiment can refer to step S120 in the above embodiment, which will not be repeated here.

[0073] Step S230: If the second network device has completed building the redis node, the redis node is built according to the building configuration data.

[0074] The second network device is the same or similar device as the first network device in the above embodiment. The second network device builds the redis node with the server before the first network device. After the second network device and the server complete the redis node construction, the first network device then builds the redis node based on the construction configuration data sent by the server through the bastion terminal device.

[0075] It should be noted that the setup configuration data sent by the server to the first network device and the second network device through the bastion terminal device may be the same or different, which is specifically determined by the network device itself and is not limited here.

[0076] Further, for the server to build redis nodes with different network devices in sequence through the fortress terminal device. On the one hand, after detecting that the second network device has completed the redis node construction, the server generates a first construction instruction and sends the first construction instruction to the fortress terminal device. The fortress terminal device forwards the first construction instruction issued by the server to the first network device. The first network device receives the first construction instruction sent by the fortress terminal device, generates a single sign-on request, and then sends the single sign-on request to the fortress terminal device. The fortress terminal device receives the single sign-on request sent by the first network device, and generates a configuration data acquisition request based on the single sign-on request, and sends the configuration data acquisition request to the server. The server receives the configuration data acquisition request sent by the fortress terminal device, and determines the construction configuration data matching the first network device from the stored multiple construction configuration data according to the configuration data acquisition request sent by the fortress terminal device. The server sends the construction configuration data matching the first network device to the fortress terminal device. The fortress terminal device receives the construction configuration data matching the first network device sent by the server, and sends the construction configuration data matching the first network device to the first network device. The first network device receives the setup configuration data matching the first network device sent by the bastion terminal device, and uses the setup configuration data to build the redis node. The first setup instruction indicates that the server detects that the second network device has completed the redis node setup.

[0077] On the other hand, after the second network device completes the redis node construction with the server, it generates a second construction instruction and sends the second construction instruction to the first network device. Among them, the second construction instruction indicates that the second network device and the server complete the redis node construction. The first network device receives the second construction instruction sent by the second network device, generates a single sign-on request, and then sends the single sign-on request to the fortress terminal device. The fortress terminal device receives the single sign-on request sent by the first network device, and generates a configuration data acquisition request based on the single sign-on request, and sends the configuration data acquisition request to the server. The server receives the configuration data acquisition request sent by the fortress terminal, and determines the construction configuration data matching the first network device from the stored multiple construction configuration data according to the configuration data acquisition request sent by the fortress terminal device. The server sends the construction configuration data matching the first network device to the fortress terminal device. The fortress terminal device receives the construction configuration data matching the first network device sent by the server, and sends the construction configuration data matching the first network device to the first network device. The first network device receives the construction configuration data matching the first network device issued by the fortress terminal device, and uses the construction configuration data to build the redis node.

[0078] It should be noted that the first network device and the second network device described in this embodiment do not limit the number of network devices that are used to build a redis node with the server. It is only through the first network device and the second network device that the server is built in sequence when building with the network device. In other embodiments, a larger number of network devices can be used to build a redis node with the server.

[0079] Furthermore, in order to ensure the stability of the production environment, the present embodiment may also adopt Figure 5 The embodiment implements step S230, specifically including steps S310 to S330:

[0080] Step S310, obtaining kernel parameters.

[0081] Kernel parameters include page parameters and memory parameters. Specifically, the page parameter is a transparent huge page. Transparent huge pages are used to dynamically allocate memory at runtime.

[0082] In order to ensure the startup of subsequent data, the first network device executes the setup configuration data that matches the first network device after receiving the setup configuration data that matches the first network device issued by the server through the bastion terminal device. Specifically, the first network device determines whether the page parameters meet the requirements corresponding to the setup configuration data. If so, step S320 is executed. If not, it is necessary to obtain root permissions, and then modify based on the root permissions. Among them, the requirement corresponding to the setup configuration data is whether the transparent large page is closed. That is, the first network device determines whether the transparent large page is closed, and if it is closed, step S320 is executed. If it is not closed, it is necessary to obtain root permissions, and then close the transparent large page based on the root permissions.

[0083] The memory parameter defines the length of the listening queue for each port, which is also the Somaxconn parameter.

[0084] Step S320: If the page parameters meet the requirements corresponding to the setup configuration data, it is determined whether the internal parameters meet the preset parameter threshold.

[0085] When transparent large pages are closed, determine whether the memory parameter meets the preset parameter threshold. If yes, execute step S330. If not, obtain root authority and modify the memory parameter size based on the root authority. Specifically, the preset parameter threshold is 1024.

[0086] Step S330, generating node information of the redis node to be built, and building the redis node based on the node information.

[0087] The node information of the redis node to be built includes log information, data directory, configuration directory and configuration file.

[0088] The first network device builds the redis node based on the node information of the redis node to be built.

[0089] It should be noted that in order to ensure the stability of the operation of the production environment of each network device of the server instruction and the security of memory usage, each network device can perform kernel parameter verification from step S310 to step S330.

[0090] Step S240: receiving a start instruction sent by the server.

[0091] The startup command is generated after the server detects that all the network devices it instructs have been built in sequence.

[0092] After detecting that all network devices have been set up, the server generates a startup instruction and sends the startup instruction to the first network device through the fortress terminal device. The first network device receives the startup instruction sent by the server through the fortress terminal device.

[0093] The first network device may be any network device that establishes a redis node with the server. Specifically, the first network device is the last network device among all network devices that establish a redis node with the server.

[0094] Step S250, starting the constructed redis node based on the start instruction.

[0095] The first network device executes the startup instruction to complete the establishment of the redis cluster.

[0096] It can be seen that the method for building a redis node in this embodiment receives the building configuration data sent by the server through the fortress terminal device. If the second network device has built the redis node, the redis node is built according to the building configuration data. When all network devices indicated by the server have built the redis node, the startup instruction sent by the server is received, and the built redis node is started based on the startup instruction. Thus, the sequential building is realized, that is, after the second network device is combined with the fortress terminal device and the server to build the redis node, the first network device is combined with the fortress terminal device and the server to build the redis node, and when all network devices instructed by the server have been built, the startup instruction is executed to complete the redis cluster building, thereby ensuring the security and reliability of the redis cluster building process, and avoiding the information insecurity caused by the network device sending a password for access when directly building the redis node with the server.

[0097] Figure 6 yes Figure 3Step S140 in the illustrated embodiment is a flowchart in an exemplary embodiment. Based on the above exemplary embodiment, in order to ensure the smooth startup of the built redis node. Figure 6 As shown, before starting the built redis node, steps S410 to S430 are also included, which are described in detail as follows:

[0098] Step S410, detecting whether the current redis environment matches the redis environment started by the built redis node.

[0099] The redis environment is the operating environment required by the redis source code.

[0100] Check whether the current redis environment matches the redis environment started by the built redis node. If they match, use the current redis environment to start the built redis node.

[0101] Step S420: If there is no match, the operating environment matching the redis node is installed according to the setup configuration data.

[0102] If they do not match, unzip the redia source code in the build configuration data, and then install the operating environment that matches the redis node based on the unzipped redis source code.

[0103] If they match, the built redis node will be started directly in the redis environment.

[0104] Step S430, starting the constructed redis node in the installed operating environment.

[0105] Based on the installed operating environment, start the built redis node.

[0106] It should be noted that in order to avoid data leakage and memory occupation by the configuration data, after starting the built redis node in the installed operating environment, it is necessary to delete the configuration data sent by the server through the bastion terminal device to the network device for redis node construction.

[0107] It can be seen that the method for building a redis cluster in this embodiment detects whether the current redis environment matches the redis environment started by the built redis node. If it does not match, the operating environment matching the redis node is installed according to the built configuration data, and the built redis node is started in the installed operating environment. Thus, by detecting whether the current redis environment is consistent with the built redis node operating environment, the smooth startup of the built redis node is ensured. By deleting the building configuration data sent by the server to the network device for building the redis node through the fortress terminal device, data leakage of the building configuration data and excessive memory occupation of the building configuration data are avoided.

[0108] The following is a detailed introduction to the Redis cluster building method proposed in the embodiment of the present application, taking the server as the specific execution entity.

[0109] like Figure 7 As shown, in an exemplary embodiment, the method for building a Redis cluster includes at least steps S510 to S530, which are described in detail as follows:

[0110] Step S510, receiving a configuration data acquisition request sent by a bastion terminal device.

[0111] The configuration data acquisition request is generated by the fortress terminal device based on the received single sign-on request sent by the first network device. The single sign-on request is sent to the fortress terminal device so that the fortress terminal device obtains the setup configuration data sent by the server according to the single sign-on request.

[0112] The terminal device sends a single sign-on request to the bastion terminal device. The bastion terminal device receives the single sign-on request sent by the network device, generates a configuration data acquisition request based on the single sign-on request, and sends the configuration data acquisition request to the server. The server receives the configuration data acquisition request sent by the bastion terminal device.

[0113] Step S520: acquiring the construction configuration data from the stored multiple construction configuration data according to the configuration data acquisition request.

[0114] The server receives the configuration data sent by the bastion endpoint device, and selects the setup configuration data that matches the first network device from the pre-stored versions of setup configuration data.

[0115] Step S530, sending the setup configuration data to the bastion terminal device, so that the bastion terminal device sends the setup configuration data to the first network device, so as to build the redis node according to the setup configuration data.

[0116] The server sends the setup configuration data matching the first network device to the fortress terminal device. The fortress terminal device receives the setup configuration data matching the first network device sent by the server, and sends the setup configuration data to the first network device. The first network device receives the setup configuration data matching it, and sets up the redis node according to the setup configuration data.

[0117] It can be seen that the redis cluster construction method of this embodiment is to obtain the configuration data by receiving the configuration data acquisition request sent by the fortress terminal device; wherein the configuration data acquisition request is generated by the fortress terminal device based on the single sign-on request sent by the first network device; according to the configuration data acquisition request, the construction configuration data is obtained from the stored multiple construction configuration data; the construction configuration data is sent to the fortress terminal device, so that the fortress terminal device sends the construction configuration data to the first network device, so as to build the redis node according to the construction configuration data. Since multiple configuration data are stored in the server, and when the Redis cluster construction instruction is received, it can be obtained from the stored multiple configuration data. Compared with the related technology, each time the Redis cluster is built, the construction configuration data required for building the Redis cluster needs to be input in sequence, and the construction time is less, which greatly improves the efficiency of the Redis cluster construction; on the other hand, the multiple configuration data stored in the server can be reused, which reduces the workload of the relevant staff who need to repeatedly input the construction configuration data required for building the Redis cluster to a certain extent; on the other hand, since multiple configuration data are pre-stored in the server, the problem of manual construction of the Redis cluster and the resulting operational errors is avoided to a certain extent, and the accuracy of the Redis cluster construction is improved, and it is simple and easy to implement.

[0118] Figure 8 is a block diagram of a Redis cluster construction device shown in an exemplary embodiment of the present application. The device can be applied to Figure 1 The device may also be applicable to other exemplary implementation environments and specifically configured in other devices, and this embodiment does not limit the implementation environment to which the device is applicable.

[0119] like Figure 8 As shown, the exemplary Redis cluster construction device 800 includes a sending module 81, a receiving module 82, a node construction module 83 and a node startup module 84. Specifically:

[0120] The sending module 81 is configured to send a single sign-on request to the bastion terminal device so that the bastion terminal device obtains the setup configuration data sent by the server according to the single sign-on request; wherein, the setup configuration data is obtained by the server from multiple stored setup configuration data according to the configuration data acquisition request received from the bastion terminal device, and the configuration data acquisition request is generated based on the single sign-on request.

[0121] The receiving module 82 is configured to receive the setup configuration data sent by the fortress terminal device.

[0122] The node building module 83 is configured to build a redis node according to the building configuration data.

[0123] The node startup module 84 is configured to start the built redis nodes if all network devices indicated by the server have built redis nodes to complete the building of the Redis cluster.

[0124] In this exemplary redis node building device, a single sign-on request is sent to a bastion terminal device so that the bastion terminal device obtains the building configuration data sent by the server according to the single sign-on request; wherein the building configuration data is obtained by the server from multiple stored building configuration data according to the configuration data acquisition request received from the bastion terminal device, and the configuration data acquisition request is generated based on the single sign-on request; the building configuration data sent by the bastion terminal device is received; the redis node is built according to the building configuration data; if all network devices indicated by the server have built the redis node, the built redis node is started to complete the building of the Redis cluster. On the one hand, since multiple configuration data are stored in the server, and when receiving the Redis cluster building instruction, it can be obtained from the stored multiple configuration data. Compared with the related technology that each time a Redis cluster is built, it is necessary to input the building configuration data required for building a Redis cluster in sequence, the building takes less time, which greatly improves the efficiency of Redis cluster building; on the other hand, the multiple configuration data stored in the server can be reused, which to a certain extent reduces the workload of the relevant staff who need to repeatedly input the building configuration data required for building a Redis cluster; on the other hand, since multiple configuration data are pre-stored in the server, the problem of operating errors caused by manual building of the Redis cluster is avoided to a certain extent, the accuracy of Redis cluster building is improved, and it is simple and easy to implement. On the other hand, compared with the prior art that the first network device needs to transmit its password to the server to realize configuration data transmission, the present application uses the fortress terminal device to establish configuration data transmission between the server and the first network device, which ensures the security of configuration data transmission between the server and the first network device.

[0125] In another exemplary embodiment, the node building module further includes:

[0126] The parameter acquisition module is configured to acquire kernel parameters, and the kernel parameters include page parameters.

[0127] The information generation module is configured to generate node information of the redis node to be built if the page parameters meet the requirements corresponding to the building configuration data, and build the redis node based on the node information.

[0128] Based on the above exemplary embodiment, the information generation module includes:

[0129] The judgment module is configured to judge whether the memory parameter meets the preset parameter threshold.

[0130] The sub-information generation module is configured to generate the node information of the redis node to be built if it is satisfied.

[0131] In another exemplary embodiment, the node startup module includes:

[0132] The receiving startup module is configured to receive the startup instruction sent by the server. The startup instruction is generated after the server detects that all network devices have built redis nodes.

[0133] The node sub-startup module is configured to start the built redis node based on the startup instruction.

[0134] Based on the above exemplary embodiment, the node startup module includes:

[0135] The environment monitoring module is configured to detect whether the current redis environment matches the redis environment started by the built redis node.

[0136] The environment installation module is configured to install the operating environment that matches the redis node according to the build configuration data if there is a mismatch.

[0137] The startup module is configured to start the built redis node in the installed operating environment.

[0138] In another exemplary embodiment, the exemplary Redis cluster building device 800 further includes:

[0139] The acquisition request receiving module is configured to receive a configuration data acquisition request sent by a fortress terminal device; wherein the configuration data acquisition request is generated by the fortress terminal device based on a received single sign-on request sent by the first network device.

[0140] The configuration data receiving module is configured to obtain the building configuration data from the stored multiple building configuration data according to the configuration data obtaining request.

[0141] The configuration data sending module is configured to send the setup configuration data to the fortress terminal device, so that the fortress terminal device sends the setup configuration data to the first network device, so as to build the redis node according to the setup configuration data. It should be noted that the Redis cluster building device provided in the above embodiment and the Redis cluster building method provided in the above embodiment belong to the same concept, wherein the specific manner in which each module and unit performs the operation has been described in detail in the method embodiment, which will not be repeated here. In actual applications, the Redis cluster building device provided in the above embodiment can allocate the above functions to different functional modules as needed, that is, divide the internal structure of the device into different functional modules to complete all or part of the functions described above, and this is not limited here.

[0142] An embodiment of the present application also provides an electronic device, including: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the electronic device implements the redis cluster building method provided in the above-mentioned embodiments.

[0143] Fig. 9 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.

[0144] It should be noted that Fig. 9 The computer system 900 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0145] like Fig. 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 902 or the program loaded from the storage part 908 to the random access memory (RAM) 903, such as executing the method described in the above embodiment. In the RAM 903, various programs and data required for system operation are also stored. The CPU 901, ROM 902 and RAM 903 are connected to each other through a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0146] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed so that a computer program read therefrom is installed into the storage section 908 as needed.

[0147] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 909, and / or installed from a removable medium 911. When the computer program is executed by a central processing unit (CPU) 901, various functions defined in the system of the present application are executed.

[0148] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as a part of a carrier wave, wherein a computer-readable computer program is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0149] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0150] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.

[0151] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the method described above is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.

[0152] Another aspect of the present application also provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the method provided in each of the above embodiments.

[0153] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person skilled in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.

Claims

1. A method for building a remote data server Redis cluster, characterized in that: Applied to a first network device, the method comprises: Sending a single sign-on request to a fortress terminal device, so that the fortress terminal device obtains the setup configuration data sent by the server according to the single sign-on request; wherein the setup configuration data is obtained by the server from a plurality of stored setup configuration data according to the configuration data acquisition request received from the fortress terminal device, and the configuration data acquisition request is generated based on the single sign-on request; Receiving the setup configuration data sent by the fortress terminal device; Acquire kernel parameters, wherein the kernel parameters include page parameters; If the page parameters meet the requirements corresponding to the building configuration data, the node information of the redis node to be built is generated, and the redis node is built based on the node information; If all network devices indicated by the server have completed the construction of redis nodes, the constructed redis nodes are started to complete the construction of the Redis cluster.

2. The method according to claim 1, characterized in that: The kernel parameters also include memory parameters. Before generating node information of the redis node to be built, the method includes: Determining whether the memory parameter meets a preset parameter threshold; If satisfied, the node information of the redis node to be built is generated.

3. The method according to claim 1, characterized in that If all network devices indicated by the server have completed the construction of redis nodes, the constructed redis nodes are started, including: Receive a startup instruction sent by the server, where the startup instruction is generated after the server detects that all network devices have built redis nodes; Start the built redis node based on the startup instruction.

4. The method according to any one of claims 1 to 3, characterized in that The built configuration data also includes configuration data required to start the redis node; before starting the built redis node, the method also includes: Check whether the current redis environment matches the redis environment started by the built redis node; If they do not match, installing the operating environment that matches the redis node according to the setup configuration data; Start the built redis node in the installed operating environment.

5. A method for building a remote data server Redis cluster, characterized in that: Applied to a server, the method comprises: Receiving a configuration data acquisition request sent by a fortress terminal device; wherein the configuration data acquisition request is generated by the fortress terminal device based on a received single sign-on request sent by a first network device; Acquire the building configuration data from the stored multiple building configuration data according to the configuration data acquisition request; Send the setup configuration data to the bastion terminal device so that the bastion terminal device sends the setup configuration data to the first network device to obtain kernel parameters, and the kernel parameters include page parameters; if the page parameters meet the requirements corresponding to the setup configuration data, the node information of the redis node to be built is generated, and the redis node is built based on the node information.

6. A device for building a remote data server Redis cluster, characterized in that: The device comprises: A sending module, configured to send a single sign-on request to a fortress terminal device, so that the fortress terminal device obtains the setup configuration data sent by the server according to the single sign-on request; wherein the setup configuration data is obtained by the server from a plurality of stored setup configuration data according to the configuration data acquisition request received from the fortress terminal device, and the configuration data acquisition request is generated based on the single sign-on request; A receiving module, configured to receive the building configuration data sent by the fortress terminal device; A node building module is configured to obtain kernel parameters, wherein the kernel parameters include page parameters; if the page parameters meet the requirements corresponding to the building configuration data, node information of the redis node to be built is generated, and the redis node is built based on the node information; The node startup module is configured to start the built redis nodes if all network devices indicated by the server have built redis nodes to complete the building of the Redis cluster.

7. A device for building a remote data server Redis cluster, characterized in that: The device comprises: An acquisition request receiving module is configured to receive a configuration data acquisition request sent by a fortress terminal device; wherein the configuration data acquisition request is generated by the fortress terminal device based on a received single sign-on request sent by a first network device; A configuration data receiving module, configured to obtain the building configuration data from the stored multiple building configuration data according to the configuration data acquisition request; The configuration data sending module is configured to send the construction configuration data to the bastion terminal device, so that the bastion terminal device sends the construction configuration data to the first network device to obtain kernel parameters, and the kernel parameters include page parameters; if the page parameters meet the requirements corresponding to the construction configuration data, the node information of the redis node to be built is generated, and the redis node is built based on the node information.

8. An electronic device, characterized in that: include: a memory storing computer-readable instructions; The processor reads the computer-readable instructions stored in the memory to execute the method for building a Redis cluster as described in any one of claims 1 to 5.

9. A computer-readable storage medium, characterized in that: Computer-readable instructions are stored thereon, and when the computer-readable instructions are executed by a processor of a computer, the computer is caused to execute the method for building a Redis cluster as described in any one of claims 1-5.

Citation Information

Patent Citations

  • PAAS cloud cluster construction method and device, electronic device and storage medium

    CN111193782A

  • Redis cluster creation and management method and system, computer equipment and storage medium

    CN112527780A

  • Distributed queueing over a Redis cluster

    US10901819B1