Skip to main content

微服务

加载镜像

kubernetes 集群中微服务各节点服务器上都需要操作

crictl pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-community:6.0.0
crictl pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-doc:1.2.0
crictl pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-command:node1018-python36

部署安装管理器

默认仅在 kubernetes master 第一台服务器上操作

  1. 下载管理器

    wget https://pdpublic.mingdao.com/private-deployment/6.0.0/mingdaoyun_private_deployment_captain_linux_amd64.tar.gz
  2. 创建目录,并解压管理器到新创建的目录下

    mkdir /usr/local/MDPrivateDeployment/
    tar -zxvf mingdaoyun_private_deployment_captain_linux_amd64.tar.gz -C /usr/local/MDPrivateDeployment/

部署微服务

在 kubernetes master 服务器上操作

  1. 生成初始配置文件并启动安装管理器

    cd /usr/local/MDPrivateDeployment/
    bash ./service.sh install http://mdy.domain.com:80
    bash ./service.sh start
    • 后续需将 cd /usr/local/MDPrivateDeployment/ && bash service.sh start 命令写入开机自启动脚本中
  2. 配置 config.yaml 文件中 ConfigMap 信息

    • config.yaml 默认在 /data/mingdao/script/kubernetes/ 目录下

    执行 vim config.yaml 编辑文件,将下面的变量值修改为实际部署环境的信息

    apiVersion: v1
    kind: ConfigMap
    metadata:
    name: env-list
    namespace: default
    data:
    ENV_APP_VERSION: "6.0.0"
    ENV_MYSQL_HOST: "192.168.10.2"
    ENV_MYSQL_PORT: "3306"
    ENV_MYSQL_USERNAME: "root"
    ENV_MYSQL_PASSWORD: "123456"
    ENV_MONGODB_URI: "mongodb://mingdao:123456@192.168.10.4:27017,192.168.10.5:27017,192.168.10.6:27017"
    ENV_MONGODB_OPTIONS: "?maxIdleTimeMS=600000&maxLifeTimeMS=1800000"
    ENV_REDIS_HOST: "192.168.10.13"
    ENV_REDIS_PORT: "6379"
    ENV_REDIS_PASSWORD: "123456"
    ENV_KAFKA_ENDPOINTS: "192.168.10.7:9092,192.168.10.8:9092,192.168.10.9:9092"
    ENV_ELASTICSEARCH_ENDPOINTS: "http://192.168.10.10:9200,http://192.168.10.11:9200,http://192.168.10.12:9200"
    ENV_ELASTICSEARCH_PASSWORD: "elastic:123456"
    ENV_FILE_ENDPOINTS: "192.168.10.16:9001,192.168.10.17:9002,192.168.10.18:9003,192.168.10.19:9004"
    ENV_FILE_ACCESSKEY: "storage"
    ENV_FILE_SECRETKEY: "123456"
    ENV_MINGDAO_INTRANET_ENDPOINT: "www:8880"
    ENV_ADDRESS_MAIN: "http://mdy.domain.com:80"
    ENV_ADDRESS_ALLOWLIST: ""
    ENV_CAPTAIN_ENDPOINT: "http://192.168.10.20:38880"
    ENV_HEALTHCHECK: "off"
    ENV_API_TOKEN: "9yVRrRXYquOfsHlV9evsDqFKUUJ1kWVAg7v6oGcTKRNG9fHD"
    ENV_SERVICE_CONFIG_TIMEZONE_GMT8: "L2V0Yy9sb2NhbHRpbWU=:VFppZjIAAAAAAAAAAAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAAAAQAAAAQAAHCAAAArMDgAAABUWmlmMgAAAAAAAAAAAAAAAAAAAAAAAAEAAAABAAAAAAAAAAAAAAABAAAABAAAcIAAACswOAAAAAo8KzA4Pi04Cg=="
    • 将默认示例的存储组件连接地址、账号密码改成实际部署环境的信息
    • ENV_ADDRESS_MAIN 变量值改成实际的系统访问地址
    • ENV_CAPTAIN_ENDPOINT 变量值改成实际部署安装管理器的服务器IP
  3. 启动服务

    cd /data/mingdao/script/kubernetes/
    bash update.sh update community 6.0.0
  4. 初始化数据

    进入 config 容器

    kubectl exec -it `kubectl get pod |  grep config | awk '{print $1}'` bash

    执行初始化脚本

    source /entrypoint-cluster.sh && clusterInit
  5. 待 nginx 做好访问地址的代理后,即可通过配置的地址访问系统