Deploy HDP
Prerequisites for Deployment
-
Create a MySQL database: MDHDP
-
Log in to MySQL:
/usr/local/mysq/bin/mysql -h 127.0.0.1 -P 3306 -uroot -p123456 -
Create the database:
MDHDPCREATE DATABASE IF NOT EXISTS MDHDP DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;
-
-
If MongoDB authentication is enabled, you need to manually create the
mdhdpdatabase. For details, refer to How to Create a MongoDB Database -
Please enable the aggregation table feature in advance. Refer to How to Enable the Aggregation Table Feature
-
Deploy the Flink service, refer to: Flink Deployment Guide
-
HDP functionality depends on the Flink service. Before enabling HDP features, ensure the Flink service has been successfully deployed.
-
If Flink was previously deployed for Data Integration or Aggregation Table functionality, upgrade Flink to 1.19.720.
Upgrade NoticeAfter upgrading the Flink version, the existing data integration sync tasks and aggregation tables must be manually restarted to resume operation.
- Flink cluster mode: Cross-Version Upgrade Guide
-
-
Download the HDP image
Download the HDP image on all nodes in the Kubernetes cluster where HAP microservices are running.
- Internet-accessible server
- Server without internet access
crictl pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-hdp:1.1.0Offline image download link. Download and upload to the deployment server after completion:
https://pdpublic.mingdao.com/private-deployment/offline/mingdaoyun-hdp-linux-amd64-1.1.0.tar.gzExtract the offline image on the server:
gunzip -d mingdaoyun-hdp-linux-amd64-1.1.0.tar.gzImport the extracted offline image:
ctr -n k8s.io image import mingdaoyun-hdp-linux-amd64-1.1.0.tar
Deploy HDP
-
In the directory where the microservices configuration files are stored, create a new file named
hdp.yamlwith the following content:apiVersion: apps/v1kind: Deploymentmetadata:name: hdpwwwnamespace: defaultspec:replicas: 1selector:matchLabels:app: hdpwwwtemplate:metadata:labels:app: hdpwwwannotations:md-update: "20240123163208"spec:containers:- name: hdpwwwimage: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-hdp:1.1.0env:- name: ENV_SERVERIDvalue: "single:hdpwww"resources:limits:cpu: "4"memory: 8096Mirequests:cpu: "0.01"memory: 64MireadinessProbe:tcpSocket:port: 8380initialDelaySeconds: 10periodSeconds: 10livenessProbe:tcpSocket:port: 8380initialDelaySeconds: 180periodSeconds: 10---apiVersion: v1kind: Servicemetadata:name: hdpwwwnamespace: defaultspec:selector:app: hdpwwwports:- name: http-hdpwwwport: 8380targetPort: 8380---apiVersion: apps/v1kind: Deploymentmetadata:name: hdpapinamespace: defaultspec:replicas: 1selector:matchLabels:app: hdpapitemplate:metadata:labels:app: hdpapiannotations:md-update: "20240123163208"spec:containers:- name: hdpapiimage: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-hdp:1.1.0env:- name: ENV_SERVERIDvalue: "single:hdpapi"resources:limits:cpu: "4"memory: 8096Mirequests:cpu: "0.01"memory: 64MireadinessProbe:tcpSocket:port: 8365initialDelaySeconds: 10periodSeconds: 10livenessProbe:tcpSocket:port: 8365initialDelaySeconds: 180periodSeconds: 10---apiVersion: v1kind: Servicemetadata:name: hdpapinamespace: defaultspec:selector:app: hdpapiports:- name: http-hdpapiport: 8365targetPort: 8365 -
Add the HDP startup command to the microservice startup script
start.sh:kubectl apply -f $baseDir/hdp.yamlThe modified
start.shscript is as follows:baseDir=$(dirname $0)kubectl apply -f $baseDir/config.yamlsleep 30kubectl apply -f $baseDir/service.yamlkubectl apply -f $baseDir/hdp.yaml # Added this linekubectl apply -f $baseDir/computinginstance.yamlsleep 180kubectl apply -f $baseDir/www.yaml -
Add the HDP stop command to the microservice stop script
stop.sh:kubectl delete -f $baseDir/hdp.yamlThe modified
stop.shscript is as follows:baseDir=$(dirname $0)kubectl delete -f $baseDir/www.yamlkubectl delete -f $baseDir/service.yamlkubectl delete -f $baseDir/hdp.yaml # Added this linekubectl delete -f $baseDir/computinginstance.yamlkubectl delete -f $baseDir/config.yaml -
Add the HDP restart command to the microservice restart script
restart.sh:sed -r -i "/md-update:/ s/([[:digit:]]+)/$RESTART_DATATIME/" $baseDir/hdp.yamlThe modified
restart.shscript is as follows:RESTART_DATATIME=$(date +%Y%m%d%H%M%S)baseDir=$(dirname $0)sed -r -i "/md-update:/ s/([[:digit:]]+)/$RESTART_DATATIME/" $baseDir/config.yamlsed -r -i "/md-update:/ s/([[:digit:]]+)/$RESTART_DATATIME/" $baseDir/service.yamlsed -r -i "/md-update:/ s/([[:digit:]]+)/$RESTART_DATATIME/" $baseDir/hdp.yaml # Added this linesed -r -i "/md-update:/ s/([[:digit:]]+)/$RESTART_DATATIME/" $baseDir/datapipeline.yamlsed -r -i "/md-update:/ s/([[:digit:]]+)/$RESTART_DATATIME/" $baseDir/wps.yaml# Commenting out the update of computinginstance.yaml# sed -r -i "/md-update:/ s/([[:digit:]]+)/$RESTART_DATATIME/" $baseDir/computinginstance.yamlsed -r -i "/md-update:/ s/([[:digit:]]+)/$RESTART_DATATIME/" $baseDir/www.yaml# Final message indicating a rolling restartecho "Performing rolling restart for all services..."/bin/bash $baseDir/start.sh -
Add the following environment variable to
config.yaml:ENV_HDP_ENABLE: "true"If MySQL is in MGR mode, add the following configuration
If MySQL is deployed in MGR mode, add the following environment variables to the HAP microservice
config.yamlfile to connect to the MySQL Router:ENV_HDP_MYSQL_HOST: "192.168.10.21"ENV_HDP_MYSQL_PORT: "6446"ENV_HDP_MYSQL_USERNAME: "root"ENV_HDP_MYSQL_PASSWORD: "123456"ENV_HDP_MYSQL_HOSTonly needs to be set to any Router IP address.ENV_HDP_MYSQL_PORTdefaults to6446(the Router read/write port), and the username and password should be replaced with the actual connection credentials. -
Restart the microservices for the changes to take effect.