部署指南

建议搭建前先了解 集群部署模式 ,下面将以标准版集群部署模式(192.168.1.1~192.168.1.16,16台服务器)为例,除代理服务器外,其他服务器均需提前安装好 Docker 环境。MySQLMongoDBRedisKafkaElasticsearch 的搭建可自行查资料完成,都是标准安装方式,无特殊注意事项,另外实际使用组件实例数与服务器数量可自行调整。

搭建 MySQL 集群(v5.7.x keepalived + 主从模式)

:sparkles: 完成搭建后得到类似如下连接地址:

主:192.168.1.6:3306
从:192.168.1.7:3306

最终提供到 VIP(虚拟IP)地址,如:192.168.2.1:3306

搭建 MongoDB 集群(v3.4.x 副本集模式)

:sparkles: 完成搭建后得到类似如下连接地址:

mongodb://192.168.1.6:27017,192.168.1.7:27017,192.168.1.8:27017

搭建 Redis 集群(v3.2.x keepalived + 主从模式)

:sparkles: 完成搭建后得到类似如下连接地址:

主:192.168.1.9:6379
从:192.168.1.10:6379

最终提供到 VIP(虚拟IP) 地址,如:192.168.3.1:6379

搭建 Kafka 集群(v1.1.x)

:sparkles: 完成搭建后得到类似如下连接地址:

192.168.1.11:9092,192.168.1.12:9092,192.168.1.13:9092

搭建 Elasticsearch 集群(v6.6.x)

需安装对应版本的 elasticsearch-analysis-ik 分词器

:sparkles: 完成搭建后得到类似如下连接地址:

192.168.1.11:9200,192.168.1.12:9200,192.168.1.13:9200

搭建文件存储服务集群

:sparkles: 单实例

  1. 创建数据挂载目录

    mkdir -p /data/file/volume/{cache,data,fetchtmp,multitmp,tmp}
    
  2. 创建 docker-compose.yaml 文件,内容如下:

    version: '3.3'
    
    services:
      app:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file:1.1.0
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume:/data/storage 
        ports:
          - "9001:9000"
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file               # ${明道云访问地址}/file,带端口不带协议
          TLS: "false"                                       # 如果明道云使用 https 访问,则设置为 true,否则为 false
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"         # 配置后将开启缩略图缓存,如需密码连接,则如:redis://:123456@10.10.10.10:6379
        command: ["./main", "server", "/data/storage/data"]
    version: '3.3'
    
    services:
      app:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file-arm64:1.1.0
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume:/data/storage 
        ports:
          - "9001:9000"
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file               # ${明道云访问地址}/file,带端口不带协议
          TLS: "false"                                       # 如果明道云使用 https 访问,则设置为 true,否则为 false
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"         # 配置后将开启缩略图缓存,如需密码连接,则如:redis://:123456@10.10.10.10:6379
        command: ["./main", "server", "/data/storage/data"]

  3. 启动服务 docker-compose up -d

  4. 完成搭建后得到类似如下服务地址:

    192.168.1.11:9001
    

:sparkles: 单台服务器多个实例

  1. 创建数据挂载目录

    mkdir -p /data/file/volume1/{cache,data,fetchtmp,multitmp,tmp}
    mkdir -p /data/file/volume2/{cache,data,fetchtmp,multitmp,tmp}
    mkdir -p /data/file/volume3/{cache,data,fetchtmp,multitmp,tmp}
    mkdir -p /data/file/volume4/{cache,data,fetchtmp,multitmp,tmp}
    
  2. 创建 docker-compose.yaml 文件,内容如下:

    version: '3.3'
    
    services:
      file1:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file:1.1.0
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume1:/data/storage     # 磁盘1
        ports:
          - "9001:9000"
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file          # ${明道云访问地址}/file,带端口不带协议
          TLS: "false"                                  # 如果明道云使用 https 访问,则设置为 true,否则为 false
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"   # 配置后将开启缩略图缓存,如需密码连接,则如:redis://:123456@10.10.10.10:6379
        command: ./main server http://file{1...4}/data/storage/data
    
      file2:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file:1.1.0
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume2:/data/storage     # 磁盘2
        ports:
          - "9002:9000"
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file
          TLS: "false"
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"
        command: ./main server http://file{1...4}/data/storage/data
    
      file3:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file:1.1.0
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume3:/data/storage     # 磁盘3
        ports:
          - "9003:9000"
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file
          TLS: "false"
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"
        command: ./main server http://file{1...4}/data/storage/data
    
      file4:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file:1.1.0
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume4:/data/storage     # 磁盘4
        ports:
          - "9004:9000"
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file
          TLS: "false"
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"
        command: ./main server http://file{1...4}/data/storage/data
    version: '3.3'
    
    services:
      file1:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file-arm64:1.1.0
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume1:/data/storage     # 磁盘1
        ports:
          - "9001:9000"
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file          # ${明道云访问地址}/file,带端口不带协议
          TLS: "false"                                  # 如果明道云使用 https 访问,则设置为 true,否则为 false
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"   # 配置后将开启缩略图缓存,如需密码连接,则如:redis://:123456@10.10.10.10:6379
        command: ./main server http://file{1...4}/data/storage/data
    
      file2:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file-arm64:1.1.0
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume2:/data/storage     # 磁盘2
        ports:
          - "9002:9000"
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file
          TLS: "false"
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"
        command: ./main server http://file{1...4}/data/storage/data
    
      file3:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file-arm64:1.1.0
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume3:/data/storage     # 磁盘3
        ports:
          - "9003:9000"
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file
          TLS: "false"
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"
        command: ./main server http://file{1...4}/data/storage/data
    
      file4:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file-arm64:1.1.0
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume4:/data/storage     # 磁盘4
        ports:
          - "9004:9000"
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file
          TLS: "false"
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"
        command: ./main server http://file{1...4}/data/storage/data

  3. 启动服务 docker-compose up -d

  4. 完成搭建后得到类似如下服务地址:

    192.168.1.11:9001,192.168.1.11:9002,192.168.1.11:9003,192.168.1.11:9004
    

:sparkles: 多台服务器,每台服务器单实例

注意事项:

  1. 使用的磁盘必须是干净的,里面没有数据。

  2. 各节点时间差不能超过3秒,你可以使用 NTP 来保证时间一致。

  3. 若需要搭建分布式集群,至少需要4个硬盘,只要有 N/2 硬盘在线,你的数据就是安全的。不过你需要至少有 N/2+1 个硬盘来创建新的对象。

在部署文件存储服务的每台服务器上进行如下操作:

  1. 拉取文件存储服务镜像

    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file:1.1.0
    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file-arm64:1.1.0

  2. 创建数据挂载目录

    mkdir -p /data/file/volume/{cache,data,fetchtmp,multitmp,tmp}
    
  3. 创建 docker-compose.yaml 文件,内容如下:

    version: '3'
    
    services:
      app:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file:1.1.0
        command: ["./main", "server", "http://file-00{1...4}/data/storage/data"]     
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file         # ${明道云访问地址}/file,带端口不带协议
          TLS: "false"                                 # 如果明道云使用 https 访问,则设置为 true,否则为 false
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"   # 配置后将开启缩略图缓存,如需密码连接,则如:redis://:123456@10.10.10.10:6379
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume:/data/storage
        extra_hosts:
          - "file-001: 192.168.1.11"
          - "file-002: 192.168.1.12"
          - "file-003: 192.168.1.13"
          - "file-004: 192.168.1.14"
        ports:
          - "9000:9000"                                # 主机监听端口 9000 不可修改 
    version: '3'
    
    services:
      app:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-file-arm64:1.1.0
        command: ["./main", "server", "http://file-00{1...4}/data/storage/data"]     
        environment:
          MINIO_ACCESS_KEY: storage
          MINIO_SECRET_KEY: storage@123
          MINIO_DOMAIN: mdy.domain.com:80/file         # ${明道云访问地址}/file,带端口不带协议
          TLS: "false"                                 # 如果明道云使用 https 访问,则设置为 true,否则为 false
          ENV_FILE_CACHE: "redis://10.10.10.10:6379"   # 配置后将开启缩略图缓存,如需密码连接,则如:redis://:123456@10.10.10.10:6379
        volumes:
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - /data/file/volume:/data/storage
        extra_hosts:
          - "file-001: 192.168.1.11"
          - "file-002: 192.168.1.12"
          - "file-003: 192.168.1.13"
          - "file-004: 192.168.1.14"
        ports:
          - "9000:9000"                                # 主机监听端口 9000 不可修改 

    注:其中 http://file-00{1...4} 表示集群中启动的节点名(共起4个实例)

  4. 启动服务 docker-compose up -d

完成搭建后得到类似如下服务地址:

192.168.1.11:9000,192.168.1.12:9000,192.168.1.13:9000,192.168.1.14:9000

搭建文档预览服务集群

在部署文档预览服务的每台服务器上进行如下操作:

  1. 拉取文档预览镜像

    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-doc:1.2.0
    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-doc-arm64:1.2.0

  2. 创建 docker-compose.yaml 文件,内容如下:

    version: '3'
    
    services:
      app:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-doc:1.2.0
        ports:
          - 8000:8000
    version: '3'
    
    services:
      app:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-doc-arm64:1.2.0
        ports:
          - 8000:8000

  3. 启动服务 docker-compose up -d

完成搭建后得到类似如下服务地址:

192.168.1.15:8000
192.168.1.16:8000

搭建微服务应用集群

在部署微服务应用集群的每台服务器上进行如下操作:

  1. 拉取微服务应用镜像

    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-community:2.8.1
    docker pull registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-community-arm64:2.8.1

  2. 下载安装管理器

    wget https://pdpublic.mingdao.com/private-deployment/2.8.1/mingdaoyun_private_deployment_captain_linux_amd64.tar.gz
    wget https://pdpublic.mingdao.com/private-deployment/2.8.1/mingdaoyun_private_deployment_captain_linux_arm64.tar.gz

  3. 解压安装管理器

    tar -zxvf mingdaoyun_private_deployment_captain_linux_amd64.tar.gz
    tar -zxvf mingdaoyun_private_deployment_captain_linux_arm64.tar.gz

  4. 安装管理器根目录下执行 bash ./service.sh start,生成预置文件;

  5. 在浏览器中通过 http://{服务器IP}:38881 进行访问,到初始化完成即可,无需进行密钥绑定及之后的步骤

  6. 修改 docker-compose.yaml(默认在 /data/mingdao/script/ 目录下),删除文件内的 doc 字段,完整配置如下(注意不同实例需要设置不同的 ENV_SERVERID,从1开始),各环境变量含义请参考说明

    version: '3'
    
    services:
      app:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-community:2.8.1
        environment:
          COMPlus_ThreadPool_ForceMinWorkerThreads: 100
          COMPlus_ThreadPool_ForceMaxWorkerThreads: 500
          ENV_SERVERID: "1"
          ENV_MINGDAO_PROTO: "http"
          ENV_MINGDAO_HOST: "mdy.domain.com"
          ENV_MINGDAO_PORT: "80"
          ENV_MINGDAO_INTRANET_ENDPOINT: "192.168.1.3:8880"
          ENV_DOCPREVIRE_ENDPOINTS: "192.168.1.15:8000,192.168.1.16:8000"
          ENV_MONGODB_URI: "mongodb://192.168.1.6:27017,192.168.1.7:27017,192.168.1.8:27017"
          ENV_MYSQL_HOST: "192.168.2.1"
          ENV_MYSQL_PORT: "3306"
          ENV_MYSQL_USERNAME: "root"
          ENV_MYSQL_PASSWORD: "123456"
          ENV_REDIS_HOST: "192.168.3.1"
          ENV_REDIS_PORT: "6379"
          ENV_REDIS_PASSWORD: "123456"
          ENV_KAFKA_ENDPOINTS: "192.168.1.11:9092,192.168.1.12:9092,192.168.1.13:9092"
          ENV_ELASTICSEARCH_ENDPOINTS: "192.168.1.11:9200,192.168.1.12:9200,192.168.1.13:9200"
          ENV_ELASTICSEARCH_PASSWORD: "123456"
          ENV_FILE_ENDPOINTS: "192.168.1.11:9000,192.168.1.12:9000,192.168.1.13:9000,192.168.1.14:9000"
          ENV_FILE_ACCESSKEY: "storage"
          ENV_FILE_SECRETKEY: "storage@123"
        ports:
          - 8880:8880
        volumes:
          - ./volume/data/:/data/
          - ./volume/tmp/:/usr/local/MDPrivateDeployment/wwwapi/tmp/
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - ../data:/data/mingdao/data
    version: '3'
    
    services:
      app:
        image: registry.cn-hangzhou.aliyuncs.com/mdpublic/mingdaoyun-community-arm64:2.8.1
        environment:
          COMPlus_ThreadPool_ForceMinWorkerThreads: 100
          COMPlus_ThreadPool_ForceMaxWorkerThreads: 500
          ENV_SERVERID: "1"
          ENV_MINGDAO_PROTO: "http"
          ENV_MINGDAO_HOST: "mdy.domain.com"
          ENV_MINGDAO_PORT: "80"
          ENV_MINGDAO_INTRANET_ENDPOINT: "192.168.1.3:8880"
          ENV_DOCPREVIRE_ENDPOINTS: "192.168.1.15:8000,192.168.1.16:8000"
          ENV_MONGODB_URI: "mongodb://192.168.1.6:27017,192.168.1.7:27017,192.168.1.8:27017"
          ENV_MYSQL_HOST: "192.168.2.1"
          ENV_MYSQL_PORT: "3306"
          ENV_MYSQL_USERNAME: "root"
          ENV_MYSQL_PASSWORD: "123456"
          ENV_REDIS_HOST: "192.168.3.1"
          ENV_REDIS_PORT: "6379"
          ENV_REDIS_PASSWORD: "123456"
          ENV_KAFKA_ENDPOINTS: "192.168.1.11:9092,192.168.1.12:9092,192.168.1.13:9092"
          ENV_ELASTICSEARCH_ENDPOINTS: "192.168.1.11:9200,192.168.1.12:9200,192.168.1.13:9200"
          ENV_ELASTICSEARCH_PASSWORD: "123456"
          ENV_FILE_ENDPOINTS: "192.168.1.11:9000,192.168.1.12:9000,192.168.1.13:9000,192.168.1.14:9000"
          ENV_FILE_ACCESSKEY: "storage"
          ENV_FILE_SECRETKEY: "storage@123"
        ports:
          - 8880:8880
        volumes:
          - ./volume/data/:/data/
          - ./volume/tmp/:/usr/local/MDPrivateDeployment/wwwapi/tmp/
          - /usr/share/zoneinfo/Etc/GMT-8:/etc/localtime
          - ../data:/data/mingdao/data

  7. 安装管理器根目录下执行 bash ./service.sh restartall,启动明道云

进入微服务应用集群中的 master 容器节点,执行脚本初始化预置数据

# 进入容器:
docker exec -it $(docker ps | grep mingdaoyun-community | awk '{print $1}') bash

# 执行初始化命令:
source /entrypoint-cluster.sh && clusterInit

完成以上操作后可访问 http://mdy.domain.com 进行许可证秘钥绑定并使用

代理设置

明道云服务

如将 http://mdy.domain.com 代理到后端的多个微服务应用:

nginx 示例如下:

upstream mdy {
    server 192.168.1.3:8880;
    server 192.168.1.4:8880;
    server 192.168.1.5:8880;
}

有关代理设置的详细说明请 参考这里

results matching ""

    No results matching ""