移除其他docker

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

设置仓库

sudo yum install -y yum-utils
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

如果出现rpmdb open failed

#首先清除掉缓存,之后再重建就可以了
rm -f /var/lib/rpm/__db*
rpm --rebuilddb

安装docker

sudo yum install docker-ce docker-ce-cli containerd.io

启动docker

 sudo systemctl start docker

登录专业版

sudo docker login --username=cjh-18888@1548042193362952 registry.cn-hangzhou.aliyuncs.com

密码qq2625112940

下载crawlab-pro镜像

docker pull registry.cn-hangzhou.aliyuncs.com/crawlab-team/crawlab-pro

root/crawlab-pro-docker文件夹下创建docker-compose.yml

主节点

version: '3.3'
services:
  master:
    image: registry.cn-hangzhou.aliyuncs.com/crawlab-team/crawlab-pro:latest
    container_name: crawlab_pro_master
    environment:
      CRAWLAB_SERVER_MASTER: "Y"  # whether to be master node 是否为主节点,主节点为 Y,工作节点为 N
      CRAWLAB_MONGO_HOST: "crawlab_db.zhuoyue360.com"  # MongoDB host address MongoDB 的地址,在 docker compose 网络中,直接引用服务名称
      CRAWLAB_MONGO_PORT: "27017"  # MongoDB port MongoDB 的端口
      CRAWLAB_MONGO_DB: "crawlab_pro"  # MongoDB database MongoDB 的数据库
      CRAWLAB_MONGO_USERNAME: "mongousername"  # MongoDB username MongoDB 的用户名
      CRAWLAB_MONGO_PASSWORD: "mongopassword"  # MongoDB password MongoDB 的密码
      CRAWLAB_MONGO_AUTHSOURCE: "admin"  # MongoDB auth source MongoDB 的验证源
      CRAWLAB_REDIS_ADDRESS: "crawlab_redis.zhuoyue360.com"  # Redis host address Redis 的地址,在 docker compose 网络中,直接引用服务名称
      CRAWLAB_REDIS_PORT: "6379"  # Redis port Redis 的端口
      CRAWLAB_REDIS_DATABASE: "1"  # Redis database Redis 的数据库
      CRAWLAB_REDIS_PASSWORD: "redispassword"  # Redis password Redis 的密码
      CRAWLAB_TASK_WORKERS: 16  # number of task executors 任务执行器个数(并行执行任务数)
      CRAWLAB_SERVER_REGISTER_TYPE: "ip"  # node register type 节点注册方式. 默认为 mac 地址,也可设置为 ip(防止 mac 地址冲突)
      CRAWLAB_SERVER_REGISTER_IP: "192.168.0.1"  # node register ip 节点注册IP. 节点唯一识别号,只有当 CRAWLAB_SERVER_REGISTER_TYPE 为 "ip" 时才生效
      CRAWLAB_SERVER_LANG_NODE: "Y"  # whether to pre-install Node.js 预安装 Node.js 语言环境
      CRAWLAB_SERVER_LANG_JAVA: "Y"  # whether to pre-install Java 预安装 Java 语言环境
      # CRAWLAB_SERVER_LANG_DOTNET: "Y"  # whether to pre-install .Net core 预安装 .Net Core 语言环境
      # CRAWLAB_SERVER_LANG_PHP: "Y"  # whether to pre-install PHP 预安装 PHP 语言环境
      # CRAWLAB_SETTING_ALLOWREGISTER: "N"  # whether to allow user registration 是否允许用户注册
      # CRAWLAB_SETTING_ENABLETUTORIAL: "N"  # whether to enable tutorial 是否启用教程
      # CRAWLAB_SETTING_RUNONMASTER: "N"  # whether to run on master node 是否在主节点上运行任务
      CRAWLAB_SETTING_DEMOSPIDERS: "Y"  # whether to init demo spiders 是否使用Demo爬虫
      # CRAWLAB_SETTING_DEMO: "Y"  # whether to init demo spiders 是否使用Demo爬虫
      # CRAWLAB_SETTING_CHECKSCRAPY: "Y"  # whether to automatically check if the spider is scrapy 是否自动检测爬虫为scrapy
      # CRAWLAB_NOTIFICATION_MAIL_SERVER: smtp.exmaple.com  # STMP server address STMP 服务器地址
      # CRAWLAB_NOTIFICATION_MAIL_PORT: 465  # STMP server port STMP 服务器端口
      # CRAWLAB_NOTIFICATION_MAIL_SENDEREMAIL: admin@exmaple.com  # sender email 发送者邮箱
      # CRAWLAB_NOTIFICATION_MAIL_SENDERIDENTITY: admin@exmaple.com  # sender ID 发送者 ID
      # CRAWLAB_NOTIFICATION_MAIL_SMTP_USER: username  # SMTP username SMTP 用户名
      # CRAWLAB_NOTIFICATION_MAIL_SMTP_PASSWORD: password  # SMTP password SMTP 密码
    ports:
      - "8080:8080" # frontend port mapping 前端端口映射
    depends_on:
      - mongo
      - redis
  mongo:
    image: mongo:latest
    container_name: crawlab_pro_mongo
    restart: always
    volumes:
      - "/opt/crawlab-pro/mongo/data/db:/data/db"  # make data persistent 持久化
    environment:
      MONGO_INITDB_ROOT_USERNAME: "mongousername"
      MONGO_INITDB_ROOT_PASSWORD: "mongopassword"
    ports:
      - "27017:27017"  # expose port to host machine 暴露接口到宿主机
  redis:
    image: redis:latest
    container_name: crawlab_pro_redis
    restart: always
    command: redis-server --requirepass "redispassword" # set redis password 设置 Redis 密码
    volumes:
      - "/opt/crawlab-pro/redis/data:/data"  # make data persistent 持久化
    ports:
      - "6379:6379"  # expose port to host machine 暴露接口到宿主机

工作节点

version: '3.3'
services:
  master:
    image: registry.cn-hangzhou.aliyuncs.com/crawlab-team/crawlab-pro:latest
    container_name: crawlab_pro_master
    environment:
      CRAWLAB_SERVER_MASTER: "N"  # whether to be master node 是否为主节点,主节点为 Y,工作节点为 N
      CRAWLAB_MONGO_HOST: "crawlab_db.zhuoyue360.com"  # MongoDB host address MongoDB 的地址,在 docker compose 网络中,直接引用服务名称
      CRAWLAB_MONGO_PORT: "27017"  # MongoDB port MongoDB 的端口
      CRAWLAB_MONGO_DB: "crawlab_pro"  # MongoDB database MongoDB 的数据库
      CRAWLAB_MONGO_USERNAME: "mongousername"  # MongoDB username MongoDB 的用户名
      CRAWLAB_MONGO_PASSWORD: "mongopassword"  # MongoDB password MongoDB 的密码
      CRAWLAB_MONGO_AUTHSOURCE: "admin"  # MongoDB auth source MongoDB 的验证源
      CRAWLAB_REDIS_ADDRESS: "crawlab_redis.zhuoyue360.com"  # Redis host address Redis 的地址,在 docker compose 网络中,直接引用服务名称
      CRAWLAB_REDIS_PORT: "6379"  # Redis port Redis 的端口
      CRAWLAB_REDIS_DATABASE: "1"  # Redis database Redis 的数据库
      CRAWLAB_REDIS_PASSWORD: "redispassword"  # Redis password Redis 的密码
      CRAWLAB_TASK_WORKERS: 16  # number of task executors 任务执行器个数(并行执行任务数)
      CRAWLAB_SERVER_REGISTER_TYPE: "ip"  # node register type 节点注册方式. 默认为 mac 地址,也可设置为 ip(防止 mac 地址冲突)
      CRAWLAB_SERVER_REGISTER_IP: "192.168.0.1"  # node register ip 节点注册IP. 节点唯一识别号,只有当 CRAWLAB_SERVER_REGISTER_TYPE 为 "ip" 时才生效
      CRAWLAB_SERVER_LANG_NODE: "Y"  # whether to pre-install Node.js 预安装 Node.js 语言环境
      CRAWLAB_SERVER_LANG_JAVA: "Y"  # whether to pre-install Java 预安装 Java 语言环境
      # CRAWLAB_SERVER_LANG_DOTNET: "Y"  # whether to pre-install .Net core 预安装 .Net Core 语言环境
      # CRAWLAB_SERVER_LANG_PHP: "Y"  # whether to pre-install PHP 预安装 PHP 语言环境
      # CRAWLAB_SETTING_ALLOWREGISTER: "N"  # whether to allow user registration 是否允许用户注册
      # CRAWLAB_SETTING_ENABLETUTORIAL: "N"  # whether to enable tutorial 是否启用教程
      # CRAWLAB_SETTING_RUNONMASTER: "N"  # whether to run on master node 是否在主节点上运行任务
      CRAWLAB_SETTING_DEMOSPIDERS: "Y"  # whether to init demo spiders 是否使用Demo爬虫
      # CRAWLAB_SETTING_DEMO: "Y"  # whether to init demo spiders 是否使用Demo爬虫
      # CRAWLAB_SETTING_CHECKSCRAPY: "Y"  # whether to automatically check if the spider is scrapy 是否自动检测爬虫为scrapy
      # CRAWLAB_NOTIFICATION_MAIL_SERVER: smtp.exmaple.com  # STMP server address STMP 服务器地址
      # CRAWLAB_NOTIFICATION_MAIL_PORT: 465  # STMP server port STMP 服务器端口
      # CRAWLAB_NOTIFICATION_MAIL_SENDEREMAIL: admin@exmaple.com  # sender email 发送者邮箱
      # CRAWLAB_NOTIFICATION_MAIL_SENDERIDENTITY: admin@exmaple.com  # sender ID 发送者 ID
      # CRAWLAB_NOTIFICATION_MAIL_SMTP_USER: username  # SMTP username SMTP 用户名
      # CRAWLAB_NOTIFICATION_MAIL_SMTP_PASSWORD: password  # SMTP password SMTP 密码
      
    

docker-compuse

sudo yum -y install epel-release

sudo yum install python-pip

docker-compose version

cd /usr/local/bin/

wget https://github.com/docker/compose/releases/download/1.14.0-rc2/docker-compose-Linux-x86_64

rename docker-compose-Linux-x86_64 docker-compose docker-compose-Linux-x86_64

chmod +x /usr/local/bin/docker-compose

docker-compose version

cd ~/crawlab-pro-docker/

如果yum有问题

mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak
vim /etc/yum.repos.d/epel.repo

输入下面内容

[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=1

编辑/etc/resolv.conf , 追加

nameserver 144.144.144.144

启动

docker-compose up -d