400 028 6601

建站动态

根据您的个性需求进行定制 先人一步 抢占小程序红利时代

Docker编排工具之Rancher-Server集群部署

部署环境:

目前成都创新互联公司已为1000+的企业提供了网站建设、域名、网页空间、网站托管、服务器托管、企业网站设计、罗湖网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

  1. 操作系统:CentOS 7

    安装iptables,禁用firewall,清空iptables规则并保存

    关闭SELinux

    升级内核yum -y update

  2. Docker版本:17.03.1-ce

    Docker其它版本下载源   

      支持的Docker版本

在开始部署Rancher之前需要确定以上环境没有问题

开始部署:

创建库

CREATE DATABASE IF NOT EXISTS cattle COLLATE = 'utf8_general_ci' CHARACTER SET = 'utf8';

创建数据库授权

GRANT ALL ON cattle.* TO 'cattle'@'%' IDENTIFIED BY 'cattle';
GRANT ALL ON cattle.* TO 'cattle'@'localhost' IDENTIFIED BY 'cattle';

部署Rancher-Server(部署集群模式)

在A服务器上面执行

sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server --db-host myhost.example.com --db-port 3306 --db-user username --db-pass password --db-name cattle

--db-host    指定MySQL服务器的连接地址

--db-port    连接端口

--db-user    连接用户

--db-pass    连接密码

--db-name    连接库名

在B服务器上面执行(与A服务器一样,如果还有其它服务器同样操作)

    编辑/etc/nginx/conf.d/rancher.conf

注意:location里面配置不可更改,其它根据自己实际环境更改

upstream rancher {
    server 192.168.1.31:8080;
    server 192.168.1.32:8080;
}

server {
    listen 80;
    server_name rancher.aek.com;

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Port $server_port;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://rancher;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        # This allows the ability for the execute shell window to remain open for up to 15 minutes. Without this parameter, the default is 1 minute and will automatically close.
        proxy_read_timeout 900s;
    }
}

本文名称:Docker编排工具之Rancher-Server集群部署
网站网址:http://www.bluegullmedia.com/article/pooepi.html

其他资讯

让你的专属顾问为你服务

0.0364s