A method, apparatus, device and medium for establishing a cluster node connection

By creating and recording the communication addresses and identifiers of container instances on the master and slave nodes on the cloud platform, constructing a list of container instances and mounting it to a specified directory, the problem of connection reset after node restart is solved, and the business processing efficiency of the cluster is improved.

CN116709574BActive Publication Date: 2026-08-04JINAN INSPUR DATA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JINAN INSPUR DATA TECH CO LTD
Filing Date
2023-06-28
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

When deploying a data analytics application cluster on a Kubernetes-based cloud platform, the /etc/hosts file needs to be manually reset after a node restart, which consumes a lot of time and affects business processing efficiency.

Method used

By obtaining the image files of the master and slave nodes, container instances are created and their communication addresses and identifiers are recorded. A list of container instances is built and mounted to a specified directory, so that connections are automatically established after the nodes restart.

Benefits of technology

No manual reset is required after a node restart, allowing for rapid establishment of node connections and improving the cluster's business processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116709574B_ABST
    Figure CN116709574B_ABST
Patent Text Reader

Abstract

The application provides a cluster node connection establishment method and device, equipment and medium, including: obtaining a master node image file of a master node and a slave node image file of a slave node in a target cluster; creating a master node container instance using the master node image file, and creating a slave node container instance using the slave node image file; obtaining a first communication address and a first container instance identifier corresponding to the master node container instance, and a second communication address and a second container instance identifier corresponding to the slave node container instance; constructing a container instance list of the target cluster based on the first communication address, the first container instance identifier, the second communication address and the second container instance identifier, and mounting the container instance list to a specified directory of each node in the container cluster. By mounting to the specified directory of each node, the application can quickly establish a connection when the nodes in the cluster are restarted, saving the node reset time and improving the business processing efficiency of the cluster.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and specifically to a method, apparatus, device, and medium for establishing cluster node connections. Background Technology

[0002] When deploying a CloudSuite data analytics application cluster (including one master node and multiple slave nodes) on a Kubernetes-based cloud platform, after creating the master and slave node container instances, the first step is to record the IP address and hostname assigned to each node by the platform. Then, modify the ` / etc / hosts` file on each node to ensure that it contains the IP addresses and hostnames of all nodes in the cluster. Next, execute the built-in connection establishment commands on each node: ` / root / entrypoint.sh master` on the master node and ` / root / entrypoint.sh slave[master_hostname]` on the slave nodes, where `master_hostname` is the master node's hostname. Finally, execute the ` / opt / hadoop-2.9.1 / bin / hdfs dfsadmin-report-live` command on any node to check for all slave nodes among the online nodes in the cluster. After these steps, the data analytics application cluster establishes a connection.

[0003] However, due to the characteristic that container instances are recreated upon restart, if a node in the cluster restarts, its ` / etc / hosts` file will be reset, requiring the same steps to be repeated. When multiple nodes in the cluster restart, each node needs to be reset, which is time-consuming and impacts the efficiency of business operations within the cluster. Summary of the Invention

[0004] In view of this, embodiments of the present invention provide a method, apparatus, device and medium for establishing cluster node connections, in order to solve the problem that when multiple nodes in a cluster restart, each node in the cluster needs to be reset, which consumes a lot of time and affects the business processing efficiency of the nodes in the cluster.

[0005] In a first aspect, embodiments of the present invention provide a method for establishing a cluster node connection, the method comprising:

[0006] Obtain the master node image file of the master node and the slave node image file of the slave node in the target cluster;

[0007] Create a master node container instance using the master node image file, and create a slave node container instance using the slave node image file;

[0008] Obtain the first communication address and the first container instance identifier corresponding to the master node container instance, and the second communication address and the second container instance identifier corresponding to the slave node container instance;

[0009] Based on the first communication address, the first container instance identifier, the second communication address, and the second container instance identifier, a container instance list for the target cluster is constructed, and the container instance list is mounted to a specified directory of each node in the container cluster, so that each node in the container cluster can communicate based on the container instance list.

[0010] Furthermore, obtaining the master node image file of the master node and the slave node image file of the slave node in the target cluster includes:

[0011] Obtain the original image file, and use the original image file to create the first container corresponding to the master node and the second container corresponding to each slave node;

[0012] Obtain the first script file corresponding to the first container and the second script file corresponding to the second container;

[0013] The first script file is used to create the master node image file corresponding to the master node, and the second script file is used to create the slave node image file corresponding to the slave node.

[0014] Furthermore, obtaining the first script file corresponding to the first container and the second script file corresponding to the second container includes:

[0015] Receive script configuration commands;

[0016] In response to the script configuration command, the first control interface corresponding to the first container and the second control interface corresponding to the second container are displayed.

[0017] A first script file and a second script file are generated based on the script content input on the first control interface and the script content input on the second control interface, respectively.

[0018] Furthermore, the step of creating the master node image file corresponding to the master node using the first script file, and creating the slave node image file corresponding to the slave node using the second script file, includes:

[0019] Generate a first temporary image corresponding to the master node and a second temporary image corresponding to the slave node;

[0020] The first script file is used to update the first temporary image to obtain the master node image, and the second script file is used to update the target command in the second temporary image to obtain the slave node image, wherein the target command is the command executed by the master node and the slave node after the node container starts.

[0021] The master node image file is generated using the master node image, and the slave node image file is generated using the slave node image.

[0022] Furthermore, constructing the container instance list of the target cluster based on the first communication address, the first container instance identifier, the second communication address, and the second container instance identifier includes:

[0023] A first key-value pair is constructed using the first communication address and the first container instance identifier, wherein the first communication address is the key name and the first container instance identifier is the key value;

[0024] A second key-value pair is constructed using the second communication address and the second container instance identifier, wherein the second communication address is the key name and the second container instance identifier is the key value;

[0025] The container instance list is constructed based on the first key-value pair and the second key-value pair.

[0026] Furthermore, before mounting the list of container instances to a specified directory on each node in the container cluster, the method further includes:

[0027] Close each container instance in the container instance list.

[0028] Furthermore, after mounting the list of container instances to a specified directory on each node in the container cluster, the method further includes:

[0029] Open each container instance in the container instance list;

[0030] Receive communication commands for the target container instance, wherein the target container instance is a container instance on any node in the target cluster;

[0031] In response to the communication command, the system sends feedback to the target container instance based on the container instance list, indicating that the container instances are online.

[0032] Secondly, embodiments of the present invention provide a device for establishing cluster node connections, the device comprising:

[0033] The acquisition module is used to acquire the master node image file of the master node and the slave node image file of the slave node in the target cluster;

[0034] The module creates a module that allows us to create master node container instances using the master node image file, and to create slave node container instances using the slave node image file.

[0035] The query module is used to obtain the first communication address and the first container instance identifier corresponding to the master node container instance, and the second communication address and the second container instance identifier corresponding to the slave node container instance.

[0036] The processing module is configured to construct a container instance list of the target cluster based on the first communication address, the first container instance identifier, the second communication address, and the second container instance identifier, and mount the container instance list to a specified directory of each node in the container cluster, so that each node in the container cluster can communicate based on the container instance list.

[0037] Thirdly, embodiments of the present invention provide a computer device, including: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the method described in the first aspect or any corresponding embodiment thereof.

[0038] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer instructions for causing a computer to perform the method described in the first aspect or any corresponding embodiment thereof.

[0039] The embodiments of this application have the following beneficial effects:

[0040] The method provided in this application creates master node container instances and slave node container instances using master node image files and slave node image files respectively. During the creation process, the communication address and container instance identifier of the container instance are recorded. A container instance list is constructed using the communication address and container instance identifier. Finally, the container instance list is mounted to a specified directory on each node. This allows for the rapid establishment of connections with other nodes after a node restarts based on the container instance list in the specified directory, eliminating the need for a reset operation after a node restart. This saves time and improves the business processing efficiency of the cluster. Attached Figure Description

[0041] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0042] Figure 1 This is a flowchart illustrating a method for establishing cluster node connections according to some embodiments of the present invention;

[0043] Figure 2 This is a structural block diagram of the cluster node connection establishment setting according to an embodiment of the present invention;

[0044] Figure 3 This is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0045] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0046] According to embodiments of the present invention, a method, apparatus, device, and medium for establishing cluster node connections are provided. It should be noted that the steps shown in the flowcharts in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowcharts, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0047] This embodiment provides a method for establishing cluster node connections. Figure 1 This is a flowchart of a method for establishing cluster node connections according to an embodiment of the present invention, such as... Figure 1 As shown, the process includes the following steps:

[0048] Step S11: Obtain the master node image file of the master node and the slave node image file of the slave node in the target cluster.

[0049] The method provided in this application is applied to a target host where Docker services are deployed. Users can transfer a raw image file in .tar format to the target host and trigger a loading command, specifically the `docker load -i` command. The target host then responds to the `docker load -i` command, loads the raw image file, and creates a container using the raw image file. Finally, a script file is used to configure the container, creating the master node image file for the master node and the slave node image files for the slave nodes in the target cluster.

[0050] Specifically, obtaining the master node image file of the master node and the slave node image files of the slave nodes in the target cluster includes the following steps A1-A3:

[0051] Step A1: Obtain the original image file and use it to create the first container corresponding to the master node and the second containers corresponding to each slave node.

[0052] In this embodiment, after the target host loads the original image file, it automatically executes the command `docker run --itd --name master[IMAGE ID]` to create the first container corresponding to the master node. After the container on the master node is created, the target host automatically executes the command `docker run --itd --name slave[IMAGE ID]` to create the second container corresponding to the slave node. The IMAGE ID is the image ID generated by the target host loading the original image.

[0053] Step A2: Obtain the first script file corresponding to the first container and the second script file corresponding to the second container.

[0054] In this embodiment of the application, obtaining the first script file corresponding to the first container and the second script file corresponding to the second container includes: receiving a script configuration command; responding to the script configuration command and displaying the first control interface corresponding to the first container and the second control interface corresponding to the second container; and generating the first script file and the second script file based on the script content input on the first control interface and the script content input on the second control interface, respectively.

[0055] Specifically, for the master node: First, the user can trigger the `docker exec -it master / bin / bash` command on the target host to configure the script. The target host will respond to the script configuration command and enter the first control interface of the master node. Then, on the first control interface, execute the `vi / root / buildconn.sh` command to create the script content, which is:

[0056] #! / bin / bash

[0057] cp / hostsconfig / hosts.txt / etc / hosts

[0058] / / Retrieves configuration information from the specified directory / hostsconfig and modifies the / etc / hosts file;

[0059] / root / entrypoint.sh master

[0060] / / Execute the command to establish a connection with the master node.

[0061] In this embodiment of the application, a first script file for the first container on the master node is generated based on the script content configured above.

[0062] For slave nodes: Users can trigger the `docker exec -it slave / bin / bash` command on the target host to configure the script. The target host responds to the script configuration command and enters the master node's second control interface. Then, in the second control interface, the `vi / root / buildconn.sh` command is executed to create the script content, which is:

[0063] #! / bin / bash

[0064] cp / hostsconfig / hosts.txt / etc / hosts

[0065] / / Retrieves configuration information from the specified directory / hostsconfig and modifies the / etc / hosts file;

[0066] master_hostname=`cat / etc / hosts|awk NR==1'{printf$2}'`

[0067] / / Get the hostname of the master node from / etc / hosts;

[0068] / root / entrypoint.sh slave master_hostname

[0069] / / Execute the command to establish a connection with the node.

[0070] In this embodiment of the application, a second script file for the second container on the slave node is generated based on the script content configured above.

[0071] Step A3: Use the first script file to create the master node image file corresponding to the master node, and use the second script file to create the slave node image file corresponding to the slave node.

[0072] In this embodiment of the application, the creation of a master node image file corresponding to the master node using a first script file and the creation of a slave node image file corresponding to the slave node using a second script file include the following steps A301-A303:

[0073] Step A301: Generate the first temporary image corresponding to the master node and the second temporary image corresponding to the slave node;

[0074] In this embodiment, the target host triggers a command to generate a temporary image for the master node. The command is `docker commit master master:linshi`, and the target host responds to this command, generating the first temporary image for the master node. Similarly, the target host triggers a command to generate a temporary image for the slave node. The command is `docker commit slave slave:linshi`, and the target host responds to this command, generating the second temporary image for the slave node. The target host can then execute `docker images` to view the two generated temporary images.

[0075] Step A302: Update the first temporary image using the first script file to obtain the master node image, and update the target command in the second temporary image using the second script file to obtain the slave node image. The target command is the command executed by the master node and the slave node after the node container starts.

[0076] In this embodiment, an image update mechanism is first triggered on the target host to update the first and second temporary images. Specifically, based on the image update mechanism, the target host is triggered to execute the command `docker run-itd --entrypoint=" / root / buildconn.sh" --name master_final master:linshi`. This command modifies the target command (entrypoint) in the first temporary image of the master node to the first script file. Then, the command `docker commit master_final master:final` is executed to generate the master node image.

[0077] Similarly, on the target host, executing the command `docker run-itd --entrypoint=" / root / buildconn.sh" --name slave_final slave:linshi` modifies the target command (entrypoint) in the second temporary image of the slave node into the second script file. Then, executing `docker commit slave_finalslave:final` generates the slave node image; you can also execute `docker images` to view the two newly generated images.

[0078] It should be noted that the purpose of using script files to update the temporary images of the master and slave nodes is to enable the container instances between the nodes to automatically connect after the master and slave nodes start up.

[0079] Step A303: Generate a master node image file using the master node image and a slave node image file using the slave node image.

[0080] In this embodiment, the target host saves the master node image as a .tar format master node image file and the slave node image as a .tar format slave node image file, and stores them locally. Specifically, the target host triggers image storage commands, including: the master node image storage command is `docker save -o master.tar master:final`, and the slave node image storage command is `docker save -o slave.tar slave:final`. The target host executes the master node image storage command to generate a .tar format master node image file. The target host executes the slave node image storage command to generate a .tar format slave node image file.

[0081] It should be noted that, in this embodiment of the application, the original image is modified to create a container image, and a script file for automatically executing commands is added to the container image to modify the target command of the image, so that the container instance can automatically execute the script when the node restarts.

[0082] Step S12: Create a master node container instance using the master node image file, and create a slave node container instance using the slave node image file.

[0083] In this embodiment, the cloud platform login operation is performed based on the target host. After logging into the cloud platform, the master node image file master.tar, which is stored locally, is selected and uploaded to the image library. The real-time progress of the image file upload can be viewed in the cloud platform taskbar. Similarly, the slave node image file slave.tar is also uploaded to the cloud platform's image library.

[0084] In this embodiment, after the master node image file and slave node image files are uploaded, a creation command is triggered. The cloud platform responds to the creation command, displays the container instance creation page, pulls the master node image file from the image repository based on the container instance creation page, and obtains the basic configuration data of the container instance, thereby obtaining the created master node container instance. The real-time progress of the container instance creation can also be viewed in the cloud platform taskbar.

[0085] In this embodiment, after the master node container instance is created, a creation command is triggered. The cloud platform responds to the creation command, displays a container instance creation page, pulls the slave node image file from the image library based on the container instance creation page, and obtains the basic configuration data of the container instance, thereby obtaining the created slave node container instance. When multiple slave node image files exist, the above operation can be repeated to create multiple slave node container instances.

[0086] Step S13: Obtain the first communication address and first container instance identifier corresponding to the master node container instance, and the second communication address and second container instance identifier corresponding to the slave node container instance.

[0087] In this embodiment, when creating the master node container instance and the slave node container instance, the communication address (IP address) of the node where the container instance is located and the container instance identifier (hostname) are recorded. The communication address of the node where the container instance is located is used as the communication address corresponding to the container instance.

[0088] For example: The master node IP of container instance 1 is 192.168.5.5, and the hostname is pod000001.

[0089] The IP address of the slave node 1 where container instance 2 is located is 192.168.5.6, and the hostname is pod000002.

[0090] The IP address of the slave node 2 where container instance 3 resides is 192.168.5.7, and the hostname is pod000003.

[0091] Step S14: Construct a list of container instances for the target cluster based on the first communication address, the first container instance identifier, the second communication address, and the second container instance identifier, and mount the list of container instances to a specified directory of each node in the container cluster so that each node in the container cluster can communicate based on the list of container instances.

[0092] In this embodiment of the application, constructing a list of container instances for the target cluster based on a first communication address, a first container instance identifier, a second communication address, and a second container instance identifier includes the following steps B1-B3:

[0093] Step B1: Construct a first key-value pair using the first communication address and the first container instance identifier, wherein the first communication address is the key name and the first container instance identifier is the key value.

[0094] In this embodiment of the application, the first key-value pair is<Key:IP1,Value:hostname1> .

[0095] Step B2: Construct a second key-value pair using the second communication address and the second container instance identifier, wherein the second communication address is the key name and the second container instance identifier is the key value.

[0096] In this embodiment of the application, the second key-value pair is<Key:IP2,Value:hostname2> .

[0097] Step B3: Construct a list of container instances based on the first key-value pair and the second key-value pair.

[0098] In this embodiment, since the master node has a higher priority than the slave node, the container instances of the master node appear first in the container instance list configmap, followed by the container instances of the slave nodes. For example, the constructed container instance list configmap is as follows:

[0099] Key: 192.168.5.5, value: pod000001.

[0100] Key: 192.168.5.6, value: pod000002.

[0101] Key: 192.168.5.7, value: pod000003.

[0102] In this embodiment of the application, before mounting the container instance list to a specified directory on each node in the container cluster, the method further includes: shutting down each container instance in the container instance list. Specifically, based on the container instance list displayed on the container function page, all node container instances in the cluster are selected, and a shutdown command is issued to shut down each container instance in the container instance list.

[0103] In this embodiment, mounting the container instance list to a specified directory on each node in the container cluster includes: selecting any shut-down container instance and performing an edit operation on that instance. The edit operation includes: adding configuration items based on the container instance's ConfigMap tab, obtaining a container instance list configmap named "hosts", determining the mount path, and mounting the container instance list to the specified directory / hostsconfig according to the mount path. Each node's container instance is edited in the same way, mounting the container instance list configmap to the specified directory.

[0104] It's important to note that the process involves creating container instances from image files with added scripts, creating a list of container instances based on their communication addresses and identifiers, and finally mounting these container instances to the specified directories on each node. This allows container instances on different nodes to automatically establish connections. Even if a node restarts, manual resetting is unnecessary; instead, container instances on each node communicate based on the container instance list, thus achieving connectivity between nodes within the cluster.

[0105] In this embodiment of the application, after mounting the list of container instances to a specified directory on each node in the container cluster, the method further includes: starting each container instance in the list of container instances; receiving a communication command for a target container instance, wherein the target container instance is a container instance on any node in the target cluster; and responding to the communication command by sending feedback to the target container instance based on the list of container instances to indicate which container instances are online.

[0106] In this embodiment, all container instances on all nodes within the target cluster are selected, and a startup command is triggered. After the container instances start, a communication command can be triggered within any node container instance (the target container instance). The communication command is ` / opt / hadoop-2.9.1 / bin / hdfs dfsadmin-report–live`. The cloud platform responds to the communication command and, based on the container instance list, reports back to the target container instance the container instances that are online. For example, the key-value pair of the target container instance in the container instance list is: Key: 192.168.5.5, value: pod000001. At this point, the container instances in the container instance list that are online are: 192.168.5.6pod000002 and 192.168.5.7pod000003. Then, 192.168.5.6pod000002 and 192.168.5.7pod000003 are fed back to the target container instance, so that the target container instance can communicate based on the feedback information, thereby realizing the connection between the node where the target container instance is located and other nodes.

[0107] The method provided in this application creates master node container instances and slave node container instances using master node image files and slave node image files respectively. During the creation process, the communication address and container instance identifier of the container instance are recorded. A container instance list is constructed using the communication address and container instance identifier. Finally, the container instance list is mounted to a specified directory on each node. After a node in the cluster restarts, it can quickly establish connections with other nodes based on the container instance list in the specified directory without having to perform a reset operation after a node restart. This saves time, improves the business processing efficiency of the cluster, and greatly optimizes the usage process.

[0108] This embodiment also provides a cluster node connection establishment device, which is used to implement the above embodiments and preferred embodiments, and will not be repeated as already described. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0109] This embodiment provides a device for establishing cluster node connections, such as... Figure 2 As shown, it includes:

[0110] The acquisition module 21 is used to acquire the master node image file of the master node and the slave node image file of the slave node in the target cluster;

[0111] Create module 22, which is used to create master node container instances using master node image files and slave node container instances using slave node image files;

[0112] The query module 23 is used to obtain the first communication address and the first container instance identifier corresponding to the master node container instance, and the second communication address and the second container instance identifier corresponding to the slave node container instance.

[0113] The processing module 24 is used to construct a list of container instances of the target cluster based on the first communication address, the first container instance identifier, the second communication address, and the second container instance identifier, and to mount the list of container instances to a specified directory of each node in the container cluster so that each node in the container cluster can communicate based on the list of container instances.

[0114] In this embodiment of the application, the acquisition module 21 includes:

[0115] The first acquisition unit is used to acquire the original image file and use the original image file to create the first container corresponding to the master node and the second container corresponding to each slave node.

[0116] The second acquisition unit is used to acquire the first script file corresponding to the first container and the second script file corresponding to the second container;

[0117] The creation unit is used to create a master node image file corresponding to the master node using the first script file, and to create a slave node image file corresponding to the slave node using the second script file.

[0118] In this embodiment of the application, the second acquisition unit is configured to receive a script configuration command; respond to the script configuration command by displaying a first control interface corresponding to the first container and a second control interface corresponding to the second container; and generate a first script file and a second script file based on the script content input on the first control interface and the script content input on the second control interface, respectively.

[0119] In this embodiment, a creation unit is used to generate a first temporary image corresponding to the master node and a second temporary image corresponding to the slave node; update the first temporary image using a first script file to obtain the master node image, and update the target command in the second temporary image using a second script file to obtain the slave node image, wherein the target command is the command executed by the master node and the slave node after the node container starts; generate a master node image file using the master node image and generate a slave node image file using the slave node image.

[0120] In this embodiment of the application, the processing module 24 is used to construct a first key-value pair using a first communication address and a first container instance identifier, wherein the first communication address is the key name and the first container instance identifier is the key value; construct a second key-value pair using a second communication address and a second container instance identifier, wherein the second communication address is the key name and the second container instance identifier is the key value; and construct a container instance list based on the first key-value pair and the second key-value pair.

[0121] In this embodiment of the application, the cluster node connection establishment device further includes: a first execution module, used to shut down each container instance in the container instance list.

[0122] In this embodiment, the group node connection establishment device further includes: a second execution module, configured to: start each container instance in the container instance list; receive a communication command for a target container instance, wherein the target container instance is a container instance on any node in the target cluster; and respond to the communication command by providing feedback to the target container instance on the container instance list regarding the container instances that are online.

[0123] Please see Figure 3 , Figure 3 This is a schematic diagram of the structure of a computer device provided in an optional embodiment of the present invention, such as... Figure 3 As shown, the computer device includes one or more processors 10, memory 20, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system).

[0124] Processor 10 may be a central processing unit, a network processor, or a combination thereof. Processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The programmable logic device may be a complex programmable logic device (CAMP), a field-programmable gate array (FPGA), a general-purpose array logic (GDA), or any combination thereof.

[0125] The memory 20 stores instructions executable by at least one processor 10 to cause the at least one processor 10 to perform the method shown in the above embodiments.

[0126] The memory 20 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created based on the use of the computer device as shown by a landing page for an app. Furthermore, the memory 20 may include high-speed random access memory and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some alternative embodiments, the memory 20 may optionally include memory remotely located relative to the processor 10, which can be connected to the computer device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0127] The memory 20 may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as flash memory, hard disk or solid-state drive; the memory 20 may also include a combination of the above types of memory.

[0128] The computer device also includes a communication interface 30 for communicating with other devices or communication networks.

[0129] This invention also provides a computer-readable storage medium. The methods described above according to embodiments of the invention can be implemented in hardware or firmware, or implemented as computer code that can be recorded on a storage medium, or implemented as computer code downloaded via a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code, which, when accessed and executed by the computer, processor, or hardware, implements the methods shown in the above embodiments.

[0130] Although embodiments of the invention have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations all fall within the scope defined by the appended claims.

Claims

1. A method for establishing a cluster node connection, characterized in that, The method includes: Obtain the master node image file of the master node and the slave node image file of the slave node in the target cluster; Create a master node container instance using the master node image file, and create a slave node container instance using the slave node image file; Obtain the first communication address and the first container instance identifier corresponding to the master node container instance, and the second communication address and the second container instance identifier corresponding to the slave node container instance; Based on the first communication address, the first container instance identifier, the second communication address, and the second container instance identifier, a container instance list of the target cluster is constructed, and the container instance list is mounted to a specified directory of each node in the container cluster, so that each node in the container cluster can communicate based on the container instance list. The step of obtaining the master node image file of the master node and the slave node image files of the slave nodes in the target cluster includes: obtaining the original image file and using the original image file to create a first container corresponding to the master node and a second container corresponding to each slave node; obtaining a first script file corresponding to the first container and a second script file corresponding to the second container; using the first script file to create the master node image file corresponding to the master node and using the second script file to create the slave node image file corresponding to the slave node, wherein the first script file is created when the target host responds to the script configuration command and enters the first control interface of the master node, and the second script file is created when the target host responds to the script configuration command and enters the second control interface of the master node.

2. The method according to claim 1, characterized in that, The step of obtaining the first script file corresponding to the first container and the second script file corresponding to the second container includes: Receive script configuration commands; In response to the script configuration command, the first control interface corresponding to the first container and the second control interface corresponding to the second container are displayed. A first script file and a second script file are generated based on the script content input on the first control interface and the script content input on the second control interface, respectively.

3. The method according to claim 1, characterized in that, The step of creating a master node image file corresponding to the master node using the first script file and creating a slave node image file corresponding to the slave node using the second script file includes: Generate a first temporary image corresponding to the master node and a second temporary image corresponding to the slave node; The first script file is used to update the first temporary image to obtain the master node image, and the second script file is used to update the target command in the second temporary image to obtain the slave node image, wherein the target command is the command executed by the master node and the slave node after the node container starts. The master node image file is generated using the master node image, and the slave node image file is generated using the slave node image.

4. The method according to claim 1, characterized in that, The step of constructing the container instance list of the target cluster based on the first communication address, the first container instance identifier, the second communication address, and the second container instance identifier includes: A first key-value pair is constructed using the first communication address and the first container instance identifier, wherein the first communication address is the key name and the first container instance identifier is the key value; A second key-value pair is constructed using the second communication address and the second container instance identifier, wherein the second communication address is the key name and the second container instance identifier is the key value; The container instance list is constructed based on the first key-value pair and the second key-value pair.

5. The method according to claim 1, characterized in that, Before mounting the list of container instances to a specified directory on each node in the container cluster, the method further includes: Close each container instance in the container instance list.

6. The method according to claim 1, characterized in that, After mounting the list of container instances to a specified directory on each node in the container cluster, the method further includes: Open each container instance in the container instance list; Receive communication commands for the target container instance, wherein the target container instance is a container instance on any node in the target cluster; In response to the communication command, the system sends feedback to the target container instance based on the container instance list, indicating that the container instances are online.

7. A device for establishing cluster node connections, characterized in that, The device includes: The acquisition module is used to acquire the master node image file of the master node and the slave node image file of the slave node in the target cluster; The module creates a module that allows us to create master node container instances using the master node image file, and to create slave node container instances using the slave node image file. The query module is used to obtain the first communication address and the first container instance identifier corresponding to the master node container instance, and the second communication address and the second container instance identifier corresponding to the slave node container instance. The processing module is configured to construct a container instance list of the target cluster based on the first communication address, the first container instance identifier, the second communication address, and the second container instance identifier, and mount the container instance list to a specified directory of each node in the container cluster, so that each node in the container cluster can establish a communication connection based on the container instance list. The acquisition module is used to acquire the original image file and use the original image file to create a first container corresponding to the master node and a second container corresponding to each slave node; acquire a first script file corresponding to the first container and a second script file corresponding to the second container; use the first script file to create a master node image file corresponding to the master node and use the second script file to create a slave node image file corresponding to the slave node, wherein the first script file is created when the target host responds to the script configuration command and enters the first control interface of the master node, and the second script file is created when the target host responds to the script configuration command and enters the second control interface of the master node.

8. A computer device, characterized in that, include: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the method of any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the method described in any one of claims 1 to 6.