首页 > 其他分享 >BI迁移K8S

BI迁移K8S

时间:2024-01-08 10:35:08浏览次数:31  
标签:hibernate yaml BI dev bi finebi mysql 迁移 K8S

下載檔案 將charts目錄放置path

如/opt/yaml/finebi-dev/ 之中

  1. 注意namespace
  2. nodeport設定

一、測試區安裝

mysql

path: /opt/yaml/finebi-dev/charts/mysql

先建pvc

kubectl apply -f mysql_pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data-mysql-0
  namespace: finebi-dev
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi
  storageClassName: nfs-client

helm install mysql -n finebi-dev -f myvalues.yaml . (建立)

helm upgrade mysql -n finebi-dev -f myvalues.yaml . (更新)

helm delete mysql -n finebi-dev (刪除)

global:
  imagePullSecrets: []
  storageClass: "openebs-hostpath"
image:
  registry: "harbor.flexium.com.tw/flexium-bi"
  repository: mysql
  tag: v20.2.4-5.7.42
auth:
  rootPassword: mysql
  database: finedb

primary:
  resources:
    requests:
      cpu: "1000m"
      memory: "2Gi"
    limits:
      cpu: "1000m"
      memory: "3Gi"

redis

path: /opt/yaml/finebi-dev/charts/redis

先建pvc

kubectl apply -f redis_pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: data-mysql-0
  namespace: finebi-dev
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi
  storageClassName: nfs-client

helm install redis -n finebi-dev -f myvalues.yaml . (建立)

helm upgrade redis -n finebi-dev -f myvalues.yaml . (更新)

helm delete redis -n finebi-dev (刪除)

global:
  imagePullSecrets: []
  storageClass: "nfs-client"
  redis:
    password: redis
image:
  registry: "harbor.flexium.com.tw/flexium-bi"
  repository: redis
  tag: v20.1.2-6.2.11
master:
  resources:
    requests:
      cpu: "1000m"
      memory: "2Gi"
    limits:
      cpu: "1000m"
      memory: "3Gi"

elasticSearch

注意 使用 apply -f 安裝時候必須加上-n namespace (使用helm安裝可以忽略此點)

path: /opt/yaml/finebi-dev/charts/elasticSearch

先建pvc

kubectl apply -f elasticSearch_pvc.yaml

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: elasticsearch-master-elasticsearch-master-0
  namespace: finebi-dev
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 200Gi
  storageClassName: nfs-client

helm install elasticsearch -n finebi-dev -f myvalues.yaml . (建立)

helm upgrade elasticsearch -n finebi-dev -f myvalues.yaml . (更新)

helm delete elasticsearch -n finebi-dev (刪除)

image: harbor.flexium.com.tw/flexium-bi/elasticsearch
imageTag: v20.1.4-8.4.1
imagePullSecrets: []

secret:
  password: "elastic"

volumeClaimTemplate:
  storageClassName: "nfs-client"
  resources:
    requests:
      storage: 200Gi

resources:
  requests:
    cpu: "1000m"
    memory: "2Gi"
  limits:
    cpu: "1000m"
    memory: "3Gi"
  • frbi (BI)
    path: /opt/yaml/finebi-dev/charts/frbi
    先建pvc
    kubectl apply -f frbi_pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: bi-pvc
  namespace: finebi-dev
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 200Gi #注意需求
  storageClassName: nfs-client

helm install bi -n finebi-dev -f myvalues.yaml . (建立)

helm upgrade bi -n finebi-dev -f myvalues.yaml . (更新)

helm delete bi -n finebi-dev (刪除)

image: "harbor.flexium.com.tw/flexium-bi/biengine"
imageTag: "3.0final"
imagePullSecrets: []

nameOverride: ""
fullnameOverride: "bi"

# fr/bi
appType: bi

ingress:
   enabled: false
   className: ""
jvmOpts:
   xmx: 8g
extraEnvs:
   - name: BI_CLUSTER_CONTAINER
     value: bi

persistence:
   #
   logs:
      filebeat:
         sidecar: false
         image: harbor.flexium.com.tw/flexium-bi/filebeat
         imageTag: v20.0.6-8.3.3
         elasticSearch:
            host: elasticsearch-master-headless
            port: 9200
            username: elastic
            password: elastic
            protocol: http
   data:
     volumeClaimTemplates:
        enabled: false
     volumeClaim:
        # apply if volumeClaimTemplates.enabled is false
        enabled: true
        claimName: bi-pvc
   shared:
      enabled: true
      claimName: bi-pvc
   resources:
      # limits:
         # cpu: 100m
         # memory: 128Mi
      # requests:
         # cpu: 100m
         # memory: 128Mi
  • bi-engine
    path: /opt/yaml/finebi-dev/charts/bi-engine
    先建pvc
    kubectl apply -f bi-engine_pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: polars-pvc
  namespace: finebi-dev
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 200Gi #注意需求
  storageClassName: nfs-client

helm install bi-engine -n finebi-dev -f myvalues.yaml . (建立)

helm upgrade bi-engine -n finebi-dev -f myvalues.yaml . (更新)

helm delete bi-engine -n finebi-dev (刪除)

image: harbor.flexium.com.tw/flexium-bi/biengine
imageTag: 3.0final
imagePullPolicy: "IfNotPresent"
imagePullSecrets: []

logs:
  filebeat:
    sidecar: true
    image: harbor.flexium.com.tw/flexium-bi/filebeat
    imageTag: v20.0.6-8.3.3
    resources:
      limits:
        cpu: '1'
        memory: 200Mi
      requests:
        cpu: 100m
        memory: 100Mi

elasticSearch:
  host: elasticsearch-master-headless
  port: 9200
  username: elastic
  password: elastic
  protocol: http

persistence:
  data:
    volumeClaimTemplates:
      enabled: true
      storageClass: "nfs-client"
      storage: 30Gi
    volumeClaim:
      enabled: false
      claimName: polars-pvc
    share:
      enabled: true
claimName: polars-pvc

opsUrl: "http://ops-headless:8080/ops/decision"

master:
  env:
    MASTER_EXTRA_VM_OPTIONS: ''
  resources:
   limits:
     cpu: '8'
     memory: 16Gi
   requests:
     cpu: '8'
     memory: 16Gi

worker:
  env:
    WORKER_EXTRA_VM_OPTIONS: '-Xmx11g -XX:MaxDirectMemorySize=3g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m'
  resources:
   limits:
     cpu: '8'
     memory: 16Gi
   requests:
     cpu: '8'
     memory: 16Gi
  • ops
    path: /opt/yaml/finebi-dev/charts/ops
    先建pvc
    kubectl apply -f ops_pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ops-data-ops-0
  namespace: finebi-dev
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi
  storageClassName: nfs-client

helm install ops -n finebi-dev -f myvalues.yaml . (建立)

helm upgrade ops -n finebi-dev -f myvalues.yaml . (更新)

helm delete ops -n finebi-dev (刪除)

image: harbor.flexium.com.tw/flexium-bi/ops
imageTag: v1.13.0.25-102580
imagePullSecrets: []

persistence:
  storageClass: "nfs-client"
  size: 100Gi

elasticSearch:
  enabled: true
  host: elasticsearch-master-headless
  port: 9200
  username: elastic
  password: elastic


ingress:
  enabled: false
  className: "nginx"

resources:
  limits:
    cpu: 2000m
    memory: 4Gi
  requests:
    cpu: 2000m
    memory: 3Gi
  • 建立bi nodeport (frbi (BI))
    path: /opt/yaml/finebi-dev/charts/frbi/
    kubectl apply -f bi_nodeport.yaml (此檔案注意nodeport)
apiVersion: v1
kind: Service
metadata:
  namespace: finebi-dev
  name: bi-service-nodeport
spec:
  type: NodePort
  ports:
    - port: 8080
      targetPort: 8080
      protocol: TCP
      name: port1
      nodePort: 32081
  selector:
      app.kubernetes.io/instance: bi
      app.kubernetes.io/name: fr

redis 連接

BI迁移K8S_bi k8s

redis-master.finebi-dev.svc.cluster.local (服務名稱).(namespace).svc.cluster.local

port: 6379 password: redis

BI迁移K8S_bi k8s_02

mysql連接

BI迁移K8S_bi k8s_03

BI迁移K8S_bi k8s_04

mysql.finebi-dev.svc.cluster.local

資料庫名稱:finedb 帳號:root 密碼:mysql

BI迁移K8S_bi k8s_05

  • 檔案伺服器設定
  • 設定下面
    共享外部目錄
    /data/webroot/WEB-INF

BI迁移K8S_bi k8s_06

BI迁移K8S_bi k8s_07

  • 設定bi ConfigMap
    進入fr容器
    kubectl exec -it bi-0 -c fr -n=finebi-dev -- /bin/bash
    顯示db.properties
    cat /usr/local/tomcat/webapps/webroot/WEB-INF/config/db.properties
root@bi-0:/# cat /usr/local/tomcat/webapps/webroot/WEB-INF/config/db.properties
#Hibernate configure properties
#Fri Dec 29 12:14:30 CST 2023
hibernate.connection.password=AYksTpWVrGatDWJ4co1Jj2HvL1+BakgDH6HZv1Pya8N67ohG5oolTMsjogpUsQlKVMx7zUybxkEJ\nnIsejESoQX+GWgcTx2tjhZwKgHtZZ8NK+UKyClhXXfq8+SClhsp+Oa19uKINPqzSTfPpjfWpYxUO\nGshNvVO/b28hrcxjx1+CVqEjd6wzupEv6fvvW1Ee2eqF63Dz8eX3SHc86ZlWdQ3CyTzwuPGW6kGW\nU/LAUgypkAEAGdDql20pqWziTkDYZ3bXWUHkLCjuoi/6/wFj91Tc5+o4Yd8D4VRn8l3b3rDJl0gE\nrne/OEvecTHY4oP1OeNV8JknFjIdrHpGVC35JA\=\=
hibernate.maxWait=500000
hibernate.minEvictableIdleTimeMillis=1800000
hibernate.hbm2ddl.auto=update
hibernate.initialSize=0
hibernate.default_schema=
hibernate.validationQuery=
hibernate.testWhileIdle=false
hibernate.connection.username=root
hibernate.connection.isolation=4
hibernate.connection.driver_class=com.mysql.jdbc.Driver
hibernate.timeBetweenEvictionRunsMillis=60000
hibernate.connection.provider_class=com.fr.config.FineDBDruidConnectionProvider
hibernate.testOnBorrow=true
hibernate.testOnReturn=false
hibernate.dialect=com.fr.third.org.hibernate.dialect.MySQL5Dialect
hibernate.numTestsPerEvictionRun=3
hibernate.connection.url=jdbc\:mysql\://mysql.finebi-dev.svc.cluster.local\:3306/finedb?useUnicode\=true&characterEncoding\=UTF-8
hibernate.maxActive=50
hibernate.minIdle=0

之後上面顯示的加入bi的configmap

kubectl edit configmap bi -n=finebi-dev (新增橘色跟紅色,紅色跟上面紅色一樣)

# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
data:
  db.properties: |
    hibernate.connection.password=AYksTpWVrGatDWJ4co1Jj2HvL1+BakgDH6HZv1Pya8N67ohG5oolTMsjogpUsQlKVMx7zUybxkEJ\nnIsejESoQX+GWgcTx2tjhZwKgHtZZ8NK+UKyClhXXfq8+SClhsp+Oa19uKINPqzSTfPpjfWpYxUO\nGshNvVO/b28hrcxjx1+CVqEjd6wzupEv6fvvW1Ee2eqF63Dz8eX3SHc86ZlWdQ3CyTzwuPGW6kGW\nU/LAUgypkAEAGdDql20pqWziTkDYZ3bXWUHkLCjuoi/6/wFj91Tc5+o4Yd8D4VRn8l3b3rDJl0gE\nrne/OEvecTHY4oP1OeNV8JknFjIdrHpGVC35JA\=\=
    hibernate.maxWait=500000
    hibernate.minEvictableIdleTimeMillis=1800000
    hibernate.hbm2ddl.auto=update
    hibernate.initialSize=0
    hibernate.default_schema=
    hibernate.validationQuery=
    hibernate.testWhileIdle=false
    hibernate.connection.username=root
    hibernate.connection.isolation=4
    hibernate.connection.driver_class=com.mysql.jdbc.Driver
    hibernate.timeBetweenEvictionRunsMillis=60000
    hibernate.connection.provider_class=com.fr.config.FineDBDruidConnectionProvider
    hibernate.testOnBorrow=true
    hibernate.testOnReturn=false
    hibernate.dialect=com.fr.third.org.hibernate.dialect.MySQL5Dialect
    hibernate.numTestsPerEvictionRun=3
    hibernate.connection.url=jdbc\:mysql\://mysql.finebi-dev.svc.cluster.local\:3306/finedb?useUnicode\=true&characterEncoding\=UTF-8
    hibernate.maxActive=50
    hibernate.minIdle=0


修改configmap后,1.先在BI网页点击开启集群

BI迁移K8S_bi k8s_08

2.刪除bi-0讓configmap的設定可以重新套用

kubectl delete pod bi-0 -n=finebi-dev (重要)

3. BI web页面打开有此集群信息就是正常的

BI迁移K8S_bi k8s_09

  • OPS接入(健康巡檢)
    API密鑰隨意輸入:Flex6269

BI迁移K8S_bi k8s_10

  • OPS接入(維運平台)
    設定nodeport
    kubectl apply -f opsservice.yaml (此檔案注意nodeport)
# service.yaml nodeport
apiVersion: v1
kind: Service
metadata:
  name: ops
  namespace: "finebi-dev"
  labels:
    helm.sh/chart: ops-1
    app.kubernetes.io/name: ops
    app.kubernetes.io/instance: ops
    app.kubernetes.io/version: "1.6.0"
    app.kubernetes.io/managed-by: Helm
spec:
  type: NodePort
  ports:
  - port: 8080
    targetPort: 8080
    nodePort: 32082  # 可以为 NodePort 指定 30080
    protocol: TCP
    name: http
  selector:
    app.kubernetes.io/name: ops
    app.kubernetes.io/instance: ops

登入 http://10.1.6.224:32082/ops/decision/

設定帳密: admin Flex@6269

設定接入專案

專案伺服器地址 http://10.1.6.224:32081/webroot/decision

維運API鍵 Flex6269

BI迁移K8S_bi k8s_11

标签:hibernate,yaml,BI,dev,bi,finebi,mysql,迁移,K8S
From: https://blog.51cto.com/u_13963804/9139720

相关文章

  • 无涯教程-Redis - SETBIT命令函数
    RedisSETBIT命令用于将键值(key/value)存储在字符串值中的偏移量处设置位值。SETBIT-返回值整数,存储在偏移量处的位值。SETBIT-语法以下是RedisSETBIT命令的基本语法。redis127.0.0.1:6379>SETBITKEY_NAMEOFFSETSETBIT-示例redis127.0.0.1:6379>SETBIT......
  • 无涯教程-Redis - GETBIT 命令函数
    RedisGETBIT命令用于获取存储在键(key)处的字符串值中偏移量的位值。GETBIT-返回值整数,存储在偏移量处的位值。GETBIT-语法以下是RedisGETBIT命令的基本语法。redis127.0.0.1:6379>GETBITKEY_NAMEOFFSETGETBIT-示例redis127.0.0.1:6379>SETBITmykey7......
  • k8s 安全
    认证k8s的请求有两种模式:非安全模式(insecure-port)该模式下所有请求都不会经过认证,不建议开启。安全模式(secure-port)该模式下开启TLS时,所有请求都需要经过认证。k8s支持多种认证机制,并支持同时开启多个认证插件(只要有一个认证通过即可)。如果认证成功,则用户的username会传入授......
  • k8s_Helm组件以及其他功能
    helm通过打包的方式,支持发布的版本管理和控制,很大程度上简化了Kubernetes应用的部署和管理Helm本质就是让K8s的应用管理(Deployment,Service等)可配置,能动态生成。通过动态生成K8s资源清单文件(deployment.yaml,service.yaml)。然后调用Kubectl自动执行K8s资源部署Helm......
  • k8s_高可用
    一、高可用原理配置一台新的master节点,然后在每台node节点上安装nginx,nginx通过内部的负载均衡将node节点上需要通过访问master,kube-apiserver组件的请求,反代到两台k8s-master节点上,这样就可以实现master节点的高可用,当任意一台master节点宕机后,也可以通过nginx负载均衡放文档另一......
  • k8s 调度
    k8s调度Scheduler是kubernetes的调度器,主要的任务是把定义的pod分配到集群的节点上。听起来非常简单,但有很多要考虑的问题:公平:如何保证每个节点都能被分配资源资源高效利用:集群所有资源最大化被使用效率:调度的性能要好,能够尽快地对大批量的pod完成调度工作灵活:允许用户根据......
  • Linux Debian12系统gnome桌面环境默认截屏截图工具gnome-screenshot
    一、简介:在Debian12中系统gnome桌面环境默认提供一个截图捕获工具screenshot,可以自定义区域截图、屏幕截图、窗口截图和录制视频,截图默认保存在“~/图片/截图”路径下。可以在应用程序中搜索screenshot,如下图:也可以在桌面右上角找到screenshot截图工具,如下图:二、快捷键截......
  • K8s 学习_组件说明
    1.k8s的组件分类主要分为mater组件,(apiserver,etcd,ControllerManager,schedule)2.Node组件Node主要负责容器的各种依赖环境,并接受Master管理,每个Node的构成:Kubelete,ContainerRuntime,Kube-pxoxy.3.核心组件k8s还依赖于一组的附件组件,通常是由第三方的提供的特定的应用程序。......
  • K8s_pod
    Pod:Pod是K8S的最小资源单位,经过yaml语法来来将docker镜像转化为Poddocker生命周期:1.启动initC 2.启动前执行Start3.同时启动readliness(就绪检测)和liveness(存活检测)4.关闭前执行Stop参考资料:http://www.noobyard.com/article/p-nqajybzb-da.html......
  • k8s_资源清单
    在k8s中,一般使用yaml格式的文件来创建符合我们预期期望的pod,这样的yaml文件我们一般称为资源清单。2.资源清单格式:apiVersion:group/apiversion#如果没有给定group名称,那么默认为core,可以使用kubectlapi-versions#获取当前k8s版本上所有的apiVersion版本信息(每个......