Standalone Installation and Startup
This article describes the process of installing HENGSHI SENSE in a standalone environment.
Before installation, please confirm your network environment. If you are in an isolated environment and cannot connect to the Internet, please first follow the instructions in Install Dependencies in Offline Environment to install the required dependencies, and then continue with the steps in this article. If your network environment can connect to the Internet, please proceed directly with the installation as guided in this article.
Preparation
Please refer to the Installation Environment document to prepare your machine configuration.
Configure User and Installation Directory
The installation program must be executed by a non-root user, and passwordless sudo permission is temporarily required during installation and initialization. After this, sudo privileges can be revoked for running the service.
Do not use the root user for installation. It is recommended to create a user with sudo privileges to install and run HENGSHI SENSE.
In this example, we use the hengshi user, with the installation path set to /opt/hengshi. Below is an example of how to create the hengshi user and set up the installation directory and permissions.shellsudo -n -l # If the output is sudo: a password is required, it means passwordless sudo permission is missing. Please authorize and verify again. grep hengshi /etc/passwd > /dev/null || sudo useradd -m hengshi # Create the hengshi user sudo mkdir -p /opt/hengshi && sudo chown hengshi:hengshi /opt/hengshi # Set up the installation directory and permissions
Server-side sshd listening on a non-22 port (skip this step if sshd uses port 22)
In the following two scenarios, you need to configure the actual port for each host in the deployment user's ~/.ssh/config:- If the SSH port of the machine deploying hengshi is not the default port 22
- If the machines deploying the engine segments are not the same as the hengshi service machine, and their SSH ports are not the default port 22
For example: If the local machine is configured with hostname localhost, and HS_ENGINE_SEGMENTS=(Node-A), both listening on port 122. The .ssh/config file on each machine should include the following configuration:
shellHost localhost Port 122 Host Node-A Port 122
Install HENGSHI SENSE
Follow the steps below to complete the installation.
- Switch to the user who will perform the installation. In this example, the username is hengshi.
sudo su - hengshi
- Navigate to the target directory where the installation package has been extracted.
cd ~/pkgs/hengshi-sense-[version]
- Run the installation command.
./hs_install -p /opt/hengshi
Tip
If you have replaced the HENGSHI metadb while using the service, make sure the value of the variable export HS_PG_IF_EXTERNAL=false
is set to true. You can change this in the configuration file conf/hengshi-sense-env.sh. This way, you will not be required to stop the service during the upgrade process.
- When the installation is successful, the following message will be displayed.
SUCCESSED! installed to xxxxx
Configure the System
Before starting the service, please read the Configuration File to set the relevant configurations. If the built-in engine type is required to be Doris, please refer to Doris Engine Configuration.
Starting the Service
Please follow the steps below to start the service.
- Switch to the user that will start the service. In the example, the username is hengshi.
sudo su - hengshi
- Navigate to the installation directory.
cd /opt/hengshi
- Initialize the OS. Before executing, please ensure the user has sudo privileges.
bin/hengshi-sense-bin init-os all
Tip
For offline environments, use bin/hengshi-sense-bin init-os all-offline to skip online dependency updates.
- Initialize HENGSHI SENSE.
bin/hengshi-sense-bin init all
- Start the HENGSHI SENSE service.
bin/hengshi-sense-bin start all
- When the service starts successfully, the following information will be displayed, and the status of each module will be IS ACTIVE.
IS ACTIVE! : [metadb] @127.0.0.1:5301/hengshi
IS ACTIVE! : [engine] @localhost:5302/hengshi
IS ACTIVE! : [minio] minio server /opt/hengshi/minio-data
IS ACTIVE! : [redis] 127.0.0.1@5307
IS ACTIVE! : [syslog] syslog-ng --no-caps --module-path=/opt/hengshi/lib/syslog-ng/lib/syslog-ng -f /opt/hengshi/conf/syslog-ng.conf -p /opt/hengshi/logs/syslog-ng.pid -R /opt/hengshi/logs/syslog-ng.persist -c /opt/hengshi/logs/syslog-ng.ctl
IS ACTIVE! : [apmserver] /opt/hengshi/lib/apm-server/apm-server -c /opt/hengshi/conf/apm-server.yaml
IS ACTIVE! : [hengshi] jar /opt/hengshi/lib/bootstrap-6.0.0.jar
IS ACTIVE! : [monit] /opt/hengshi/lib/monit/bin/monit -c /opt/hengshi/conf/monitrc
Access the service via your browser. The default address is:
http://localhost:8080
to use the HENGSHI SENSE service. If you cannot access it, please check whether the service port HS_HENGSHI_PORT is open to the public in the configuration file conf/hengshi-sense-env.sh.If you need to configure nginx, please refer to: Installation and Startup FAQ section 1.1.3 How to run the service on ports 80 and 443.
Operations After Starting the Service
When the HENGSHI SENSE service is running, it is necessary to regularly back up data to prevent data loss and to promptly clean up unnecessary logs to free up storage space.
Regular Data Backup
It is recommended to back up the metadb database daily. Backups can be stored on local devices or remote devices. Scheduled backups should be performed during off-peak business hours, such as midnight, to avoid affecting user access to the service. The following example is a command to back up data to a remote device at midnight every day. For detailed parameter descriptions, please refer to Data Backup.
shell0 0 * * * /opt/hengshi/bin/dbbackup.sh -m metadb -l /BACKUP/PATH -h $REMOTE_IP -r /BACKUP/PATH
Regular Log Cleanup
During operation, HENGSHI SENSE generates operation logs, which need to be cleaned up regularly to free up storage space. The following examples are commands to regularly clean up the rolling logs of the internal database every day.
shell0 0 * * * /opt/hengshi/bin/clean_engine.sh -t -r >& /opt/hengshi/logs/clean_engine.log 0 0,12 * * * /opt/hengshi/bin/clean_engine.sh -c -g -p */5 * * * * /opt/hengshi/bin/clean_engine.sh -l
Tip
Do not expose the HENGSHI SENSE service port directly to the public network. It is recommended to provide external access through nginx and a domain name. This helps prevent attacks caused by component vulnerabilities.
Stop the Service
Stop the service by executing the following commands.
sudo su - hengshi
cd /opt/hengshi
bin/hengshi-sense-bin stop all
After the service is successfully stopped, the following message will be displayed, and the module status will be "NOT ACTIVE".
NOT ACTIVE! : [metadb] @127.0.0.1:5501/hengshi
NOT ACTIVE! : [engine] @localhost:5502/hengshi
NOT ACTIVE! : [minio] minio server /opt/hengshi/minio-data
NOT ACTIVE! : [redis] 127.0.0.1@5507
NOT ACTIVE! : [syslog] syslog-ng --no-caps --module-path=/opt/hengshi/lib/syslog-ng/lib/syslog-ng -f /opt/hengshi/conf/syslog-ng.conf -p /opt/hengshi/logs/syslog-ng.pid -R /opt/hengshi/logs/syslog-ng.persist -c /opt/hengshi/logs/syslog-ng.ctl
NOT ACTIVE! : [apmserver] /opt/hengshi/lib/apm-server/apm-server -c /opt/hengshi/conf/apm-server.yaml
NOT ACTIVE! : [hengshi] jar /opt/hengshi/lib/bootstrap-6.0-SNAPSHOT.jar
NOT ACTIVE! : [monit] /opt/hengshi/lib/monit/bin/monit -c /opt/hengshi/conf/monitrc
Check Service Status
During service operation, you can check the program status by executing the following commands.
sudo su - hengshi
cd /opt/hengshi
bin/hengshi-sense-bin health all
The first column displays the module status information:
- Healthy highlighted indicates the corresponding module is running
- Stopped highlighted indicates the corresponding module has stopped
- Starting highlighted indicates the corresponding module is starting up
[Stopped Starting **Healthy**]: [metadb] hengshi@127.0.0.1:5301/hengshi
[Stopped Starting **Healthy**]: [engine] hengshi@localhost:5302/hengshi
[Stopped Starting **Healthy**]: [minio] minio server /opt/hengshi/minio-data
[Stopped Starting **Healthy**]: [redis] redis-server .*:5307
[Stopped Starting **Healthy**]: [syslog] syslog-ng --no-caps --module-path=/opt/hengshi/lib/syslog-ng/lib/syslog-ng -f /opt/hengshi/conf/syslog-ng.conf -p /opt/hengshi/logs/syslog-ng.pid -R /opt/hengshi/logs/syslog-ng.persist -c /opt/hengshi/logs/syslog-ng.ctl
[Stopped Starting **Healthy**]: [apmserver] /opt/hengshi/lib/apm-server/apm-server -c /opt/hengshi/conf/apm-server.yaml
[Stopped Starting **Healthy**]: [hengshi] jar /opt/hengshi/lib/bootstrap-5.4.5.jar
[Stopped Starting **Healthy**]: [monit] /opt/hengshi/lib/monit/bin/monit -c /opt/hengshi/conf/monitrc