51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

harbor高可用案例(共享存储目录)方案1

harbor高可用案例(共享存储目录)方案1 : keepalive 高可用案例。 data 目录需要备份

harbor高可用方案2 :两台 数据相互 复制 来同步(主从复制) :连接

1.两个节点安装harbor

[root@centos201 softwares]# pwd
/baimei/softwares

[root@centos201 softwares]# scp -r harbor 10.0.0.202:`pwd`

[root@centos201 softwares]# scp -r /data 10.0.0.202:/

2.所有节点安装nfs服务

[root@centos201 ~]# yum -y install nfs-utils
[root@centos202 ~]# yum -y install nfs-utils
[root@centos203 ~]# yum -y install nfs-utils

3.配置nfs共享

[root@centos203 ~]# mkdir -pv /baimei/harbor

[root@centos203 ~]# cat > /etc/exports <<'EOF'
/baimei/harbor *(rw,no_root_squash)
EOF

4.配置nfs服务开机自启动

[root@centos203 ~]# systemctl enable --now nfs

5.服务端检查NFS暴露信息

exportfs  #  

https://www.baimeidashu.com/10902.html

6.客户端节点手动挂载测试,完成数据的拷贝

mount -t nfs 10.0.0.203:/baimei/harbor /mnt/

 scp -r /data/* /mnt/

echo "mount -t nfs 10.0.0.203:/baimei/harbor /mnt/" >> /etc/rc.local 

chmod +x /etc/rc.d/rc.local

[root@centos202 ~]# mount -t nfs 10.0.0.203:/baimei/harbor /mnt/
[root@centos202 ~]# 
[root@centos202 ~]# echo "mount -t nfs 10.0.0.203:/baimei/harbor /mnt/" >> /etc/rc.local 
[root@centos202 ~]# 
[root@centos202 ~]# chmod +x /etc/rc.d/rc.local 

7.harbor服务器修改harbor的配置文件 的 data 目录

vim harbor.yml

data_volume: /mnt

8.安装keepalived

[root@centos201 ~]# yum -y install keepalived
[root@centos202 ~]# yum -y install keepalived

9.配置keepalived,实现VIP漂移

201:

 cat > /etc/keepalived/keepalived.conf <<EOF
global_defs {
    router_id 201
}

vrrp_instance VI_1 {
    state MASTER
    interface ens33
    virtual_router_id 50
    priority 150
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        10.0.0.250
    }
}
EOF

systemctl enable --now keepalived

202:

cat > /etc/keepalived/keepalived.conf <<EOF
global_defs {
    router_id 202
}

vrrp_instance VI_1 {
    state BACKUP
    interface ens33
    virtual_router_id 50
    priority 100
    advert_int 1
    authentication {
        auth_type PASS
        auth_pass 1111
    }
    virtual_ipaddress {
        10.0.0.250
    }
}
EOF

systemctl enable --now keepalived

10.各节点验证vip是否漂移

systemctl stop keepalived

验证ip 是否 自动漂移

11.修改解析

10.0.0.250 harbor.baimei.com

赞(1)
未经允许不得转载:工具盒子 » harbor高可用案例(共享存储目录)方案1