Updated on 2026-11-25 GMT+08:00

Preparing for Adding a Host to a Host Cluster

Preparations

Configuring a Security Group

Before verifying host connectivity, configure a security group and enable some ports. Otherwise, the connectivity verification may fail. (The following uses a Linux host as an example.)

  1. Go to the console, and choose Service List > Compute > Elastic Cloud Server. The Elastic Cloud Server page is displayed.
  2. Click the target ECS to go to its details page. Click the Security Groups tab. Choose Manage Rule > Inbound Rules of the corresponding target security group to configure inbound rules.

    Figure 1 Configuring rules

  3. Click Fast-Add Rules and set the parameters as follows:

    Figure 2 Fast-add rules

    • Protocols and ports: Port 22 must be open for Linux systems, and ports 54, 5985, and 5986 must be open for Windows systems. These are the ports specified when a target host or agent host is added.
    • Source: In an inbound rule, it is used to match the source address of an external request. Set it to 0.0.0.0/0, which opens the ports above to all IP addresses.

      If stricter security is required, the management ports do not have to be open to all IP addresses. In this case, the CodeArts Deploy's external IP address can be added to the security group, with the required ports opened for it. The IP address is the external IP address of the official agent pool in CodeArts Deploy, and is used for communications with target hosts and agent hosts. If this parameter is not configured, host connectivity cannot be verified.

  4. Remove the inbound restrictions on the ports used by deployed applications (for example, port 8080 for Tomcat; for other applications, the ports they require). Otherwise, the applications cannot be accessed.
  5. Do not restrict outbound traffic, or at least allow access to ports 80 and 443.

Configuring the Firewall

Check the firewall configuration of the host to make sure that the firewall allows access to the SSH protocol. Otherwise, the connectivity verification may fail. The following part describes how to configure the firewall for different OSs.

Table 1 Linux firewall configurations

OS Series

Configuration Method

CentOS/EulerOS/UnionTechOS

  1. Check whether the SSH software package is installed on the local host.
    rpm -qa | grep ssh

    If the command output contains openssh-server, the SSH software package has been installed.

  2. If no SSH software package is available, run the following command:
    yum install openssh-server
  3. Enable the SSH service.
    service sshd start
  4. Open the sshd configuration file.
    vi /etc/ssh/sshd_config
  5. Delete the comment tag (#) before Port 22 and adjust the port number as required.
  6. Restart the SSH service.
    sudo service sshd restart
  7. Check whether port 22 is enabled.

    After you run the following command, the current ufw status (for example, "active" indicates that ufw is enabled) and rule list are displayed. If port 22 is enabled, 22/tcp or ssh will be displayed in the rule (SSH uses port 22 by default).

    netstat -ntpl | grep 22
  8. If you have high security requirements on the overall deployment process and do not want to open the preceding ports to all IP addresses, you can configure an IP address whitelist.

    Add the following command to the end of the sshd_config file and save the file.

    User: whitelisted username. IP: whitelisted IP address. The whitelist should contain CodeArts IP address range.

    AllowUsers {User}@{IP}

    Restart the SSH service.

    sudo service sshd restart

    All regions: For details, see CodeArts Deploy's External IP Addresses. These IP addresses above are open IP addresses in the official agent pool of CodeArts Deploy for communications with target hosts and agent hosts.

Debian

  1. Log in to the system as the root user and install the ufw.
    apt install ufw
  2. Enable port 22.
    ufw allow 22/tcp
  3. Check whether port 22 is enabled.
    After you run the following command, the current ufw status (for example, "active" indicates that ufw is enabled) and rule list are displayed. If port 22 is enabled, 22/tcp or ssh will be displayed in the rule (SSH uses port 22 by default).
    ufw status

    If the ufw status is "inactive", run the following command to start ufw:

    ufw enable
  4. If you have high security requirements on the overall deployment process and do not want to open the preceding ports to all IP addresses, you can configure an IP address whitelist.

    Run the following command to add an IP address whitelist. IP: whitelisted IP address. The whitelist should contain CodeArts IP address range.

    ufw allow from {IP} to any port 22

    Check the ufw rule list. The sequence number is marked for each rule, facilitating subsequent rule deletion or modification.

    ufw status numbered

    Disable the SSH connection rule (disable the rule whose source IP address is Anywhere to implement whitelist restriction). {Number} indicates the number of the rule to be disabled.

    ufw delete {Number}

    All regions: For details, see CodeArts Deploy's External IP Addresses. These IP addresses above are open IP addresses in the official agent pool of CodeArts Deploy for communications with target hosts and agent hosts.

Ubuntu

  1. Check the IP address of the local host.
    ifconfig

    The value following inet is the IP address.

  2. Check whether the 22 port is occupied.
    netstat -nltp|grep 22

    If any command output is displayed, port 22 is occupied. If no command output is displayed, port 22 is not listened on by any process.

  3. If no port process exists, run the following commands in sequence:
    sudo apt-get install openssh-server
    sudo apt-get install ufw
    sudo ufw enable
    sudo ufw allow 22
  4. If you have high security requirements on the overall deployment process and do not want to open the preceding ports to all IP addresses, you can configure an IP address whitelist.

    Run the following command to add an IP address whitelist. IP: the whitelisted IP address. The whitelist should contain CodeArts IP address range.

    ufw allow from {IP} to any port 22

    Check the ufw rule list. The sequence number is marked for each rule, facilitating subsequent rule deletion or modification.

    ufw status numbered

    Disable the SSH connection rule (disable the rule whose source IP address is Anywhere to implement whitelist restriction). {Number} indicates the number of the rule to be disabled.

    ufw delete {Number}

    All regions: For details, see external IP addresses of CodeArts Deploy. These IP addresses are external IP addresses in the official agent pool of CodeArts Deploy for communications with target hosts and agent hosts.

This section uses Windows Server 2012 as an example.

  1. Choose Windows Firewall on the control panel of the Windows host.

  2. Click Advanced settings.

  3. Click Inbound Rules.

  4. Click New Rule.

  5. Set Rule Type to Port and click Next.

  6. Select TCP and Specific local ports, enter port 5986, and click Next.

  7. Select Allow the connection, and click Next.

  8. Select all the options for Profile and click Next.

  9. Enter a rule name and click Finish to complete the firewall configurations.

  10. To connect to the target host through an agent host, repeat step 1 to step 9 to configure the firewall for the agent host. Add an inbound rule for the listening port (example: port 54) of the agent by referring to step 4.
  11. (Optional) To meet higher security requirements, configure an IP address whitelist on the target host, instead of opening the preceding ports to all IP addresses.

    1. Choose Windows Firewall on the control panel of the Windows host.

    2. Click Advanced settings.

    3. Click Inbound Rules.

    4. Click New Rule.

    5. Set Rule Type to Custom and click Next.

    6. Set Program to All programs and click Next.
    7. Set Protocol type to TCP and Local port to Specific Ports, enter port 5986, and click Next.

    8. In the Scope area, select Any IP address for Which local IP addresses does this rule apply to? and These IP addresses for Which remote IP addresses does this rule apply to?, enter a whitelisted IP address, and click Next.

    9. Select Allow the connection, and click Next.

    10. Select all the options for Profile and click Next.

    11. Enter a rule name and click Finish to complete the IP address access whitelist setting for the target host.

    12. To connect to the target host through an agent host, repeat step 1 to step 11 to configure the IP address access whitelist on the agent host and add an inbound rule for the listening port of the agent host, for example, port 54.