1. helm部署

本文介绍如何在Kubernetes上通过helm部署HENGSHI SENSE,以及部署后如何进行版本升级和数据备份。

1.1. 部署前准备

helm版本 下载文件
v3.x helm-v3.13.3-linux-amd64.tar.gz

说明:
将helm二进制包下载到部署机器,拷贝到/usr/bin 目录下, 执行helm version 输出version.BuildInfo{Version:"v3.13.3", 字样说明安装完成

  1. 添加helm源

    helm repo add hengshi-charts https://hs-chart-repo.s3.cn-north-1.amazonaws.com.cn/charts/
    
  2. 更新helm源

    helm repo update 
     helm search repo hengshi-charts # -l 列出所有版本
    
  3. 导入离线镜像

    wget https://download.hengshi.com/releases/hengshi-sense-xxx.tar.gz
     docker load -i hengshi-sense-xxx.tar.gz
    

说明:
k8s/helm环境需要将镜像推送到集群所使用的镜像仓库,如registry、harbor、阿里云镜像仓库、腾讯云镜像仓库

1.2. 集群部署

k8s/helm部署默认均为集群模式。

1.自定义配置文件

  • 根据license调整衡石实例数

    说明:
    初次部署时 将hengshi副本数置为1. 即下文自定义配置文件参数中的hengshi_replicas: 1
    在拿到license文件并导入后,开始扩容pod数量 --replicas= 请与license的实例数限制保持一致

    kubectl -n [namespace] scale deployment/hengshi-sense --replicas=3
    
  • 部署所需要的必要参数, 将其保存到本地文件中
    hengshi_replicas: 3 # hengshi节点数默认3,请根据获取到的license数量限制保持一致
    gpdb_seg_replicas: 3
    gpdb_segments:
    - segment-0
    - segment-1
    - segment-2
    image: # 修改您的镜像tag
    hengshi: "registry.hengshi.org/hengshi-sense:4.0.4-dp-a3d11d"
    gpdb: "registry.hengshi.org/gpdb:6.18.2.0"
    stroage_name:
    gpdb_master_size: 50Gi
    gpdb_segment_size: 50Gi  
    metadb_size: 50Gi  
    minio_size: 50Gi
    redis_size: 10Gi
    flink_size: 10Gi
    ClassName: longhorn
    accessModes: ['ReadWriteOnce']
    

说明:
将ClassName修改为当前集群的存储类, 云上架构请注意磁盘大小最小限制。 eg. 阿里云ssd磁盘最低20Gi

2.安装Charts

# 获取当前chart最新版本 -l 参数查看所有版本
helm search repo hengshi-charts
NAME                            CHART VERSION    APP VERSION    DESCRIPTION  
hengshi-charts/hengshi-sense    1.2.2            4.2            HENGSHI SENSE
helm install -f hs-config.yaml hengshi-sense hengshi-charts/hengshi-sense --version [chart_version] -n [namespace] # chart_version 为helm search repo hengshi-charts 列出的可用版本

3.修改configmap (如需修改帐号密码等自定义配置,请执行此项,否则忽略)

kubectl edit configmap [configmap_name] -n [namespace] # 可修改的configmap名称: hengshi-sense greenplum metadb

配置内容参考

4.初始化engine(已替换hengshi内置引擎 此步可跳过无需初始化)

kubectl -n [namespace] exec -it master-0 -- /entrypoint.sh -m initsystem
kubectl -n [namespace] exec -it master-0 -- /entrypoint.sh -m startsystem

1.3. 单机部署

1.自定义配置文件

  • 部署所需要的必要参数
cluster_enable: false
image: # 修改您的镜像tag
  hengshi: "registry.hengshi.org/hengshi-sense:4.0.4-dp-a3d11d"
  gpdb: "registry.hengshi.org/gpdb:6.18.2.0"
stroage_name:
  gpdb_master_size: 50Gi
  gpdb_segment_size: 50Gi
  metadb_size: 50Gi
  minio_size: 50Gi
  redis_size: 10Gi
  flink_size: 10Gi
  ClassName: longhorn # 修改为您本地的存储类
  accessModes: ['ReadWriteOnce']

2.安装Charts

# 获取当前chart最新版本 -l 参数查看所有版本
helm search repo hengshi-charts
NAME                            CHART VERSION    APP VERSION    DESCRIPTION  
hengshi-charts/hengshi-sense    1.2.2            4.2            HENGSHI SENSE
helm install -f hs-config.yaml hengshi-sense hengshi-charts/hengshi-sense --version 1.1.2 -n [namespace] # 使用自定义配置安装一个:"HengshiSense" 的指定版本应用

3.修改configmap (如需修改帐号密码等自定义配置,请执行此项,否则忽略)

kubectl edit configmap [configmap_name] -n [namespace] # 可修改的configmap名称: hengshi-sense greenplum metadb

配置内容参考

4.初始化engine

kubectl -n [namespace] exec -it master-0 -- /entrypoint.sh -m initsystem
kubectl -n [namespace] exec -it master-0 -- /entrypoint.sh -m startsystem

稍等几分钟查看hengshi-sense服务启动完成,即可通过k8s任意节点NODE_IP:PORT访问, 如需自行配置Nginx转发可查看当前Service8080端口暴露的NodePort端口转发即可。

kubectl -n [namespace] get svc
NAME            TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)                                                         AGE
hengshi-sense   NodePort    10.0.0.146           8080:31204/TCP,54320:30524/TCP,15432:31062/TCP,5005:32465/TCP   286d

1.4. 替换或关闭衡石组件

参考以下示例配置关闭或开启。

# 以下任一组件将其置为false, 安装后则不会启动
    metadb_enabled: false
    gpdb_enabled: false
    redis_enabled: false
    minio_enabled: false
    flink_enabled: false

    # 示例:使用AnalyticDB MySQL替换hengshi内置greenplum引擎
      1. gpdb_enabled 参数在自定义配置文件中将其置为false
      2. 参考 安装与启动 > 系统配置 > 引擎高级配置 中的示例配置添加到 "配置项(configmap)"
      HS_ENGINE_TYPE: "mysql"
      IS_ENGINE_EMBEDDED: false
      SYSTEM_ENGINE_URL: "jdbc:mysql://192.168.211.4:3306/testdb?user=root&password=Test123@"
      INTERNAL_ENGINE_DATASET_PATH: "enginedb"
      INTERNAL_ENGINE_TMP_PATH: "enginetmp"
      INTERNAL_ENGINE_OUTPUT_PATH: "enginecommon"

      # 去掉默认的引擎变量
       HS_ENGINE_TYPE: greenplum
       HS_ENGINE_HOST: "master-0.gp-hs"
       HS_ENGINE_PORT: "15432"
       HS_ENGINE_DB: hengshi
       HS_ENGINE_USR: hengshi
       HS_ENGINE_PWD: hengshi202020
    # 示例:使用RDS PostgreSQL替换hengshi内置metadb
       1. metadb_enabled 参数在自定义配置文件中将其置为false                  
       2. 参考 安装与启动 > 系统配置 > 替代衡石metadb 中的示例配置添加到 "配置项(configmap)", 并在云上数据库创建相应的帐号和权限   
       HS_PG_HOST=xxx
       HS_PG_PORT=5432
       HS_PG_DB="hengshi"
       HS_PG_USR=hengshi
       HS_PG_PWD="hengshi"  
       INTERNAL_STORAGE_DB_NAME="hengshi_sense_internal_storage"
       HS_SYSLOG_HOST=xxxx    
       HS_SYSLOG_PORT=5432
       HS_SYSLOG_DB=syslog
       HS_SYSLOG_USR=syslog
       HS_SYSLOG_PWD=syslog

1.5. 自定义配置文件完整示例

参考下方完整示例。

cluster_enable: true
  hengshi_replicas: 3 # hengshi节点数默认3,请根据获取到的license数量限制保持一致
  enable_hengshi_share_storage: false
  node_selector:
    ns_enable: false
    node_selector_kv: "diskType: ssd"


  # metadb configmap
  metadb_enabled: true
  metadb_slave_enabled: false

  # gpdb configmap
  gpdb_enabled: true
  gpdb_seg_replicas: 1
  gpdb_master: master-0
  gpdb_segments: 
    - segment-0
  # redis configmap
  redis_enabled: true

  # minio configmap
  minio_enabled: true

  # flink configmap
  flink_enabled: true

  # service
  service:
    web_port: 8080
    apm_port: 5005
    metadb_port: 54320
    metadb_slave_port: 54321
    greenplum_port: 15432
    minio_port: 9001
    flink_rest_port: 8082
    flink_job_rpc_port: 6123

  # storage
  stroage_name:
    gpdb_master_size: 50Gi
    gpdb_segment_size: 50Gi
    metadb_size: 50Gi
    metadb_slave_size: 50Gi
    minio_size: 50Gi
    redis_size: 10Gi
    flink_size: 10Gi
    ClassName: longhorn
    accessModes: ['ReadWriteOnce']

  # image
  image:
    hengshi: "registry.hengshi.org/hengshi-sense:4.0.4-dp-a3d11d"
    pullPolicy: Always
    dnsPolicy: ClusterFirst
    # Overrides the image tag whose default is the chart appVersion.
    gpdb: "registry.hengshi.org/gpdb:6.18.2.0"
    secret: false
    secret_name: secret-name

  # ingress 默认未启用
  ingress:
    enabled: false
    className: "nginx"
    annotations:
      ingress.kubernetes.io/force-ssl-redirect: "false"
      nginx.ingress.kubernetes.io/proxy-connect-timeout: "600"
      nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
      nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
      nginx.ingress.kubernetes.io/proxy-body-size: "500M"
    hosts:
      - host: helm.hengshi.org
        paths:
          - path: /
            pathType: Prefix
    tls: []
    #  - secretName: hengshi-org-tls
    #    hosts:
    #      - helm.hengshi.org

1.6. 升级/备份

  1. 容器部署升级

  2. k8s环境备份与恢复

results matching ""

    No results matching ""

    k8s部署 离线环境依赖包安装