多harbor实例共享后段存储
一、环境准备
软件名称 | 软件版本 |
---|---|
harbor | 1.5 |
mysql | 5.7 |
keepalived | 2.0.8 |
redis | 3 |
docker | 18.0.9 |
harbor下载https://github.com/goharbor/harbor/releases
keepalive下载https://www.keepalived.org/download.html
机器用途
节点 | IP | 用途 | VIP |
---|---|---|---|
harbor1 | 192.168.109.20 | harbor1+keepalived主 | 192.168.109.30 |
harbor2 | 192.168.109.21 | harbor2+keepalived备 | |
harbor3 | 192.168.109.22 | mysql+redis+nfs |
nfs挂载
所有机器安装nfs
使用阿里云镜像源,这里不做描述
# yum -y install nfs-utils*
在harbor3上创建共享路径
# mkdir /data #用于存放镜像仓库
# mkdir /db #用于存放mysql及redis数据
将目录共享出来,并重启nfs
# vim /etc/exports
/data *(rw,no_root_squash)
/db *(rw,no_root_squash)
# systemctl restart nfs-server
在harbor1和harbor2上挂载共享路径
# mkdir /data
# vim /etc/fstab
192.168.109.22:/data /data nfs defaults,_netdev 0 0
# mount -a
二、安装mysql及redis
在harbor3上创建docker-compose.yml
# vim /root/docker-compose.yml
version: '3'
services:
mysql-server:
hostname: mysql-server
restart: always
container_name: mysql-server
image: mysql:5.7
volumes:
- /db/mysql:/var/lib/mysql
command: --character-set-server=utf8
ports:
- '3306:3306'
environme