Table of Contents generated with DocToc

Initial Installation

The installation path can be decided by yourself. Below we take /opt/hengshi as an example, the download path is ~/pkgs, and the preparation file is introduced in the section Installation - Preparation File.

System Dependencies

  1. Ensure that the sudo command is installed on each machine.
  2. Create a runtime user on each machine, and they can ssh login to each other without a password (hengshi is used as an example below).
  3. Configure password-less sudo permissions for the runtime user.
  4. Ensure that each machine has a different hostname.
  5. Ensure the firewall port restrictions between machines are open for internal network communication.
  6. Make sure the current machine executing the cluster installation has Ansible installed.

Please have the client execute the above dependencies according to their own company’s IT processes. If you need to operate manually, you can refer to Manual Operation Reference for System Dependencies.

Preparation

Configure User and Installation Directory (sudo/root privileges required)

The deployment directory is exemplified as /opt/hengshi, and the machines are exemplified as three nodes Node-A, Node-B, Node-C.

for x in Node-A Node-B Node-C; do
    ssh $x "grep hengshi /etc/passwd > /dev/null || sudo useradd -m hengshi"
    ssh $x "sudo mkdir -p /opt/hengshi && sudo chown hengshi:hengshi /opt/hengshi"  #Establish henghsi user, set installation directory and permissions
done

Non-standard ssh Port

If the machines involved in the installation (the local machine and the machines configured in HS_ENGINE_SEGMENTS) are listening on ports other than the ssh standard 22, you need to configure the actual ports for each host in the deployment user’s ~/.ssh/config.

The local machine needs to configure the ports for localhost and the domain name returned by the hostname command.

Example: The local machine is configured with hostname as localhost, and HS_ENGINE_SEGMENTS=(Node-A Node-B Node-C), they all listen on port 122.

Therefore, the .ssh/config configuration needs to include the following settings, and be synchronized to each machine’s same path file (.ssh/config):

Host localhost
  Port 122
Host Node-A
  Port 122
Host Node-B
  Port 122
Host Node-C
  Port 122

Set Cluster Information

  • Establish a cluster configuration directory, parallel to the extraction directory, to facilitate reuse of the configuration when upgrading. The installation package extraction directory is exemplified as the hengshi-sense-[version] directory.
mkdir hengshi-sense-[version]/../cluster-conf
cd hengshi-sense-[version]
cp ansible/hosts.sample ../cluster-conf/hosts
cp ansible/vars.yml.sample ../cluster-conf/vars.yml
  • Configure hosts
# Nodes can be configured after the following
# ansible_port=xxx for non-standard port 22
# ansible_user=hengshi if not logged in with the current execution user

[metadb] #Internal meta database
Node-A

[engine] #Acceleration engine #One machine must be designated as master
Node-A master=true
Node-B
Node-C

[gateway] #Cluster gateway
Node-A

[zookeeper] #Internal zookeeper #Ensure that zkid is different for each machine
Node-A zkid=1
Node-B zkid=2
Node-C zkid=3

[hengshi] #HENGSHI services
Node-B
Node-C
  • Configure vars.yaml
---
temp_work_dir_root: "/tmp"   #Temporary directory, generally doesn't need to be changed
install_path: "/opt/hengshi"  #Installation target directory
gateway_port: 8080
hengshi_sense_port: 8081
metadb_port: 8082
zookeeper_client_port: 2181
engine_master_port: 8100
engine_segment_base_port: 8200

Installation

The following command can be added to the environment variable to get detailed execution information.

ANSIBLE_PLAYBOOK="ansible-playbook -v"
$ sudo su - hengshi
$ cd ~/pkgs/hengshi-sense-[version]           #Switch to the extraction target directory
$ ./hs_install -m cluster -c ../cluster-conf    #Execute cluster installation

If the installation program outputs the following information, with all node statuses [unreachable=0,failed=0], it indicates a successful installation:

PLAY RECAP ****************************************************************
Node-A : ok=18   changed=3    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0
Node-B : ok=18   changed=3    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0
Node-C : ok=18   changed=3    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0 

Initialize OS

The executing user needs to have sudo privileges on each machine for this step. After successful execution, you can disable sudo privileges (the program does not need sudo privileges for daily operation).

$ sudo su - hengshi
$ cd /opt/hengshi
$ bin/hengshi-sense-bin init-os all  #Initialize OS

The final return information of the initialization program, with all node statuses [unreachable=0,failed=0], indicates successful OS initialization:

TASK [deploy : init-os kernel] ********************************************************************************************************************************************************************************************************************************
changed: [Node-A]
changed: [Node-B]
changed: [Node-C]

TASK [deploy : init-os deps] **********************************************************************************************************************************************************************************************************************************
changed: [Node-A]
changed: [Node-B]
changed: [Node-C]

PLAY RECAP ****************************************************************************************************************************************************************************************************************************************************
Node-A              : ok=5    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
Node-B              : ok=5    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
Node-C              : ok=5    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Initialize HENGSHI

$ sudo su - hengshi
$ cd /opt/hengshi
$ bin/hengshi-sense-bin init all   #Initialize HENGSHI system

The final return information of the initialization program, with all node statuses [unreachable=0,failed=0], indicates successful HENGSHI system initialization:

TASK [operations : metadb init] *******************************************************************************************************************************************************************************************************************************
skipping: [Node-A]
skipping: [Node-B]
skipping: [Node-C]

TASK [operations : engine init] *******************************************************************************************************************************************************************************************************************************
skipping: [Node-A]
skipping: [Node-B]
skipping: [Node-C]

PLAY RECAP ****************************************************************************************************************************************************************************************************************************************************
Node-A              : ok=1    changed=0    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0   
Node-B              : ok=1    changed=0    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0   
Node-C              : ok=2    changed=1    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0

Start

After executing, confirm the operation and service status in sequence.

$ sudo su - hengshi
$ cd /opt/hengshi                 #Enter the installation target directory
$ bin/hengshi-sense-bin start all    #Start HENGSHI services
  1. The prompt below indicates a successful operation: (each machine unreachable=0,failed=0)
PLAY RECAP ***********************************************************************
Node-A              : ok=4    changed=3    unreachable=0    failed=0    skipped=2    rescued=0    ignored=0
Node-B              : ok=3    changed=2    unreachable=0    failed=0    skipped=3    rescued=0    ignored=0
Node-C              : ok=3    changed=2    unreachable=0    failed=0    skipped=3    rescued=0    ignored=0
  1. Run the check command to view the "ACTIVE"/"NOT ACTIVE" status of the services, refer to Operation - Check Status