首页 > 其他分享 >Harbor双主复制高可用部署

Harbor双主复制高可用部署

时间:2024-11-05 10:22:36浏览次数:3  
标签:kB layer Loading MB Harbor v2.9 harbor 复制 双主

环境信息:
主机名称 IP 备注
harbor01 192.168.61.56 harbor1服务器
harbor02 192.168.61.57 harbor2服务器
192.168.61.59 Nginx代理
192.168.61.56/57 两个节点分别部署docker-ce ,docker-compose,harbor-offline-installer-v2.9.1.tgz
  • 部署docker-ce docker-compose
wget -P /etc/yum.repos.d/ https://download.docker.com/linux/centos/docker-ce.repo
yum clean all && yum makecache fast
yum -y install docker-ce docker-compose
systemctl enable docker && systemctl start docker

  • 离线部署 harbor
# 下载离线部署包
wget https://github.com/goharbor/harbor/releases/download/v2.9.1/harbor-offline-installer-v2.9.1.tgz
tar -zxvf harbor-offline-installer-v2.9.1.tgz
cd harbor
# 修改配置

# The IP address or hostname to access admin UI and registry service.
# DO NOT use localhost or 127.0.0.1, because Harbor needs to be accessed by external clients.
hostname: 192.168.61.56  # 修改为当前主机IP地址

# http related config
http:
  # port for http, default is 80. If https enabled, this port will redirect to https port
  port: 80

# https related config
https:
  # https port for harbor, default is 443
  port: 443
  # The path of cert and key files for nginx
  certificate: /opt/key/server.crt   #配置https 证书,证书需要生成
  private_key: /opt/key/server.key

# # Uncomment following will enable tls communication between all harbor components
# internal_tls:
#   # set enabled to true means internal tls is enabled
#   enabled: true
#   # put your cert and key files on dir
#   dir: /etc/harbor/tls/internal
#   # enable strong ssl ciphers (default: false)
#   strong_ssl_ciphers: false

# Uncomment external_url if you want to enable external proxy
# And when it enabled the hostname will no longer used
external_url: https://192.168.61.56   # 配置访问地址

# The initial password of Harbor admin
# It only works in first time to install harbor
# Remember Change the admin password from UI after launching Harbor.
harbor_admin_password: Harbor12345     # 修改默认账户admin 的登录密码


# 其他配置可按需修改,完成以上配置后开始部署harbor
[root@harbor01 harbor]# ./install.sh 

[Step 0]: checking if docker is installed ...

Note: docker version: 24.0.7

[Step 1]: checking docker-compose is installed ...

Note: Docker Compose version v2.21.0

[Step 2]: loading Harbor images ...
4349dad1c75c: Loading layer [==================================================>]  10.89MB/10.89MB
b3619b11127a: Loading layer [==================================================>]  3.584kB/3.584kB
7b38a647487c: Loading layer [==================================================>]   2.56kB/2.56kB
af63cee918f4: Loading layer [==================================================>]  44.69MB/44.69MB
087e0e1d01ed: Loading layer [==================================================>]  45.48MB/45.48MB
Loaded image: goharbor/harbor-jobservice:v2.9.1
7a18cae000bb: Loading layer [==================================================>]  7.873MB/7.873MB
6e8443cb30ea: Loading layer [==================================================>]  4.096kB/4.096kB
7e6f1921b03b: Loading layer [==================================================>]   17.4MB/17.4MB
7ab103a3c9e9: Loading layer [==================================================>]  3.072kB/3.072kB
afdeb50007ba: Loading layer [==================================================>]  32.78MB/32.78MB
0838cfee6fc3: Loading layer [==================================================>]  50.97MB/50.97MB
Loaded image: goharbor/harbor-registryctl:v2.9.1
06a21a75ac76: Loading layer [==================================================>]  10.89MB/10.89MB
7ef38c74aa21: Loading layer [==================================================>]  3.584kB/3.584kB
78e12b1b294b: Loading layer [==================================================>]   2.56kB/2.56kB
7415bb76ee07: Loading layer [==================================================>]  58.23MB/58.23MB
c25cd46ee82a: Loading layer [==================================================>]  5.632kB/5.632kB
1a3de5a9a094: Loading layer [==================================================>]  122.4kB/122.4kB
2d2d193fbdcd: Loading layer [==================================================>]  80.38kB/80.38kB
ee47e7543fea: Loading layer [==================================================>]  59.23MB/59.23MB
6ebe4d7b431b: Loading layer [==================================================>]   2.56kB/2.56kB
Loaded image: goharbor/harbor-core:v2.9.1
7d9f76d29c1c: Loading layer [==================================================>]  124.4MB/124.4MB
50cb5ae20a44: Loading layer [==================================================>]  3.584kB/3.584kB
59a78c21122c: Loading layer [==================================================>]  3.072kB/3.072kB
6beb01cc5baa: Loading layer [==================================================>]   2.56kB/2.56kB
b09018e5a73f: Loading layer [==================================================>]  3.072kB/3.072kB
c1078fb9f5c7: Loading layer [==================================================>]  3.584kB/3.584kB
59dadef71b1b: Loading layer [==================================================>]  20.48kB/20.48kB
Loaded image: goharbor/harbor-log:v2.9.1
d1de629330a4: Loading layer [==================================================>]  60.48MB/60.48MB
3cb3537a6da7: Loading layer [==================================================>]  173.9MB/173.9MB
a327f18369ed: Loading layer [==================================================>]  25.46MB/25.46MB
3f5c8182a7a2: Loading layer [==================================================>]  63.37MB/63.37MB
a972da56e974: Loading layer [==================================================>]   5.12kB/5.12kB
2fa2fe9c942b: Loading layer [==================================================>]  6.144kB/6.144kB
53214b04b836: Loading layer [==================================================>]  3.072kB/3.072kB
7fde99a5b238: Loading layer [==================================================>]  2.048kB/2.048kB
b985c63bb4f0: Loading layer [==================================================>]   2.56kB/2.56kB
58e8be9a88e4: Loading layer [==================================================>]   7.68kB/7.68kB
Loaded image: goharbor/harbor-db:v2.9.1
64966afbcdad: Loading layer [==================================================>]  10.89MB/10.89MB
7ffad26c4cb7: Loading layer [==================================================>]  27.62MB/27.62MB
ce5f177604e5: Loading layer [==================================================>]  4.608kB/4.608kB
4c46c82379dc: Loading layer [==================================================>]  28.41MB/28.41MB
Loaded image: goharbor/harbor-exporter:v2.9.1
f2d51adf2664: Loading layer [==================================================>]  60.48MB/60.48MB
962114f3c6f4: Loading layer [==================================================>]  110.8MB/110.8MB
fa9bce70fee8: Loading layer [==================================================>]  3.072kB/3.072kB
034a19d4e2af: Loading layer [==================================================>]   59.9kB/59.9kB
ea8a227a5ce4: Loading layer [==================================================>]  61.95kB/61.95kB
Loaded image: goharbor/redis-photon:v2.9.1
b99018c986e9: Loading layer [==================================================>]  115.1MB/115.1MB
Loaded image: goharbor/nginx-photon:v2.9.1
7e85bea4f9eb: Loading layer [==================================================>]  7.873MB/7.873MB
2d7031c02133: Loading layer [==================================================>]  4.096kB/4.096kB
f2f29a057a0e: Loading layer [==================================================>]  3.072kB/3.072kB
c465d9ffbcae: Loading layer [==================================================>]   17.4MB/17.4MB
e8392e2d1c5c: Loading layer [==================================================>]  18.19MB/18.19MB
Loaded image: goharbor/registry-photon:v2.9.1
0ee5099becd4: Loading layer [==================================================>]  8.424MB/8.424MB
709c954772b5: Loading layer [==================================================>]  4.096kB/4.096kB
4b4592e67634: Loading layer [==================================================>]  3.072kB/3.072kB
db64864bc2d4: Loading layer [==================================================>]  196.4MB/196.4MB
b2e16fced657: Loading layer [==================================================>]  14.21MB/14.21MB
261777ce207b: Loading layer [==================================================>]  211.4MB/211.4MB
Loaded image: goharbor/trivy-adapter-photon:v2.9.1
Loaded image: goharbor/prepare:v2.9.1
d0dcb5740755: Loading layer [==================================================>]  115.1MB/115.1MB
a68394b34761: Loading layer [==================================================>]   6.46MB/6.46MB
e47863752870: Loading layer [==================================================>]  245.8kB/245.8kB
eb0d64571e29: Loading layer [==================================================>]  1.233MB/1.233MB
Loaded image: goharbor/harbor-portal:v2.9.1


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /root/harbor
Error happened in config validation...
ERROR:root:Please specify hostname
[root@harbor01 harbor]# docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@harbor01 harbor]# vi harbor.yml 
[root@harbor01 harbor]# vi harbor.yml 
[root@harbor01 harbor]# sh install.sh 

[Step 0]: checking if docker is installed ...

Note: docker version: 24.0.7

[Step 1]: checking docker-compose is installed ...

Note: Docker Compose version v2.21.0

[Step 2]: loading Harbor images ...
Loaded image: goharbor/harbor-jobservice:v2.9.1
Loaded image: goharbor/harbor-registryctl:v2.9.1
Loaded image: goharbor/harbor-core:v2.9.1
Loaded image: goharbor/harbor-log:v2.9.1
Loaded image: goharbor/harbor-db:v2.9.1
Loaded image: goharbor/harbor-exporter:v2.9.1
Loaded image: goharbor/redis-photon:v2.9.1
Loaded image: goharbor/nginx-photon:v2.9.1
Loaded image: goharbor/registry-photon:v2.9.1
Loaded image: goharbor/trivy-adapter-photon:v2.9.1
Loaded image: goharbor/prepare:v2.9.1
Loaded image: goharbor/harbor-portal:v2.9.1


[Step 3]: preparing environment ...

[Step 4]: preparing harbor configs ...
prepare base dir is set to /root/harbor
Generated configuration file: /config/portal/nginx.conf
Generated configuration file: /config/log/logrotate.conf
Generated configuration file: /config/log/rsyslog_docker.conf
Generated configuration file: /config/nginx/nginx.conf
Generated configuration file: /config/core/env
Generated configuration file: /config/core/app.conf
Generated configuration file: /config/registry/config.yml
Generated configuration file: /config/registryctl/env
Generated configuration file: /config/registryctl/config.yml
Generated configuration file: /config/db/env
Generated configuration file: /config/jobservice/env
Generated configuration file: /config/jobservice/config.yml
Generated and saved secret to file: /data/secret/keys/secretkey
Successfully called func: create_root_cert
Generated configuration file: /compose_location/docker-compose.yml
Clean up the input dir


Note: stopping existing Harbor instance ...


[Step 5]: starting Harbor ...
[+] Running 10/10
 ✔ Network harbor_harbor        Created                                                                                                                                                                                                  0.3s 
 ✔ Container harbor-log         Started                                                                                                                                                                                                  0.4s 
 ✔ Container registryctl        Started                                                                                                                                                                                                  0.5s 
 ✔ Container harbor-portal      Started                                                                                                                                                                                                  0.7s 
 ✔ Container redis              Started                                                                                                                                                                                                  0.6s 
 ✔ Container registry           Started                                                                                                                                                                                                  0.6s 
 ✔ Container harbor-db          Started                                                                                                                                                                                                  0.4s 
 ✔ Container harbor-core        Started                                                                                                                                                                                                  0.2s 
 ✔ Container nginx              Started                                                                                                                                                                                                  0.5s 
 ✔ Container harbor-jobservice  Started                                                                                                                                                                                                  0.3s 
✔ ----Harbor has been installed and started successfully.----





配置双主复制

测试推送镜像主机配置/etc/docker/daemon.json

cat /etc/docker/daemon.json

{

"insecure-registries": ["192.168.61.56","192.168.61.57"]

}
systemctl daemon-reload && systemctl restart docekr
两个节点创建项目 kubeflow项目

  • 在192.168.61.57 上配置,系统管理-仓库管理-新建目标

  • 在192.168.61.57 上配置,系统管理-复制管理-新建规则,也可以使用push-based 触发模式使用事件触发,这里演示使用pull-based

  • 在192.168.61.56 上配置,系统管理-仓库管理-新建目标

  • 在192.168.61.56 上配置,系统管理-复制管理-新建规则,也可以使用push-based 触发模式使用事件触发,这里演示使用pull-based

测试推送镜像 两节点同步情况

  • 推送镜像至192.168.61.57节点仓库

    192.168.61.56 节点查看

  • 推送镜像至192.168.61.56节点仓库

    192.168.61.57 节点查看

配置nginx 代理

标签:kB,layer,Loading,MB,Harbor,v2.9,harbor,复制,双主
From: https://www.cnblogs.com/shunzi115/p/17822379.html

相关文章

  • 这款Chrome 插件,帮助我们复制网页上不能复制的内容
    前言最近在上网查找博客时,经常遇到想要复制网页上的内容,但是,一点击复制,就会弹出来各种各样的弹框,导致复制不能继续,非常麻烦。这时,我想到了一个办法,那就是下载安装一个chrome插件,那今天就介绍给大家,让大家上网复制文本时可以任性。如何复制首先,我们需要安装一个插件,SimpleAllow......
  • harbor 使用https部署 与 docker 登录
    目录配置harbor证书1.生成证书颁发机构证书及私钥2.生成服务器私钥及证书签名请求(CSR)3.生成证书签名请求4.生成x509v3扩展文件。5.使用该v3.ext文件为Harbor服务器生成证书。6.将test.harbor.com.crt转换为test.harbor.com.cert,供Docker使用。Docker守护进程将.crt......
  • Docker部署MySQL双主双从,主主互备
     1. 双主双从主主互备MySQL的双主双从(主主互备)架构是一种高可用性和负载均衡的解决方案,它由两台主数据库服务器和两台从数据库服务器组成。每台主服务器同时充当另一台主服务器的从服务器,形成一个互为主从的关系。这种架构可以提供以下优势:高可用性:任何一台主服务器故障,......
  • 告别登录,这款插件直接复制CSDN内容,真棒!
    前言我们在开发过程中,肯定会遇到这样或者那样的问题,这时候,我们想到最多的就是用搜索引擎去搜索各种资料,查看各种博客。以前,查看博客是很方便的,不过后来,像CSDN的,就是必须要登录,关注博主才能继续往下看,或者复制文档内容了。这显然很不方便啊,今天就来介绍一个好用chrome的插件,帮助我......
  • 【MySql】 搭建主从复制
    一、概述 主从复制是指将主库的数据变更同步到从库,从而保证主库和从库数据一致,可用于数据备份、失败迁移、读写分离、降低单库读写压力等场景。对于面向大企业的B端产品而言,主从复制技术尤为重要。1.1什么是主从复制主从复制是指将主库的DDL和DML操作通过二进制日志传......
  • MySQL主从复制(docker环境)
    MySQL主从复制示例1创建master容器3307:dockerrun-d--namemysql-master\-p3307:3306\--privileged=true\-v/root/mysql-master/log:/var/log/mysql\-v/root/mysql-master/data:/var/lib/mysql\-v/root/mysql-master/conf:/etc/mysql/conf.d\-eMYSQL_ROO......
  • mysql 8.4 主从复制
    master节点my.cnfserver-id=1log-bin=mysql-binbinlog-do-db=repl#需要同步的数据库,如果没有本行表示同步所有的数据库binlog-ignore-db=mysql创建复制用户CREATEUSER'repluser'@'192.168.4.222'IDENTIFIEDWITHcaching_sha2_passwordBYRANDOMPASSWORD;+----—......
  • DBeaver如何插入一行新数据或者复制一行新数据,真方便
    前言我们在使用DBeaver时,经常是需要操作数据库表的,比如新加一行数据等。DBeaver给我们提供了快速的操作方法,今天就来介绍下。如何插入新数据首先,我们选中要插入数据的那个位置,就是要选中一行数据。然后,我们点击下面的这两个按钮,其中一个按钮是新增一行,一个按钮是复制一行。......
  • 根据swagger.yaml生成harbor私库api调用代码
    准备下载https://github.com/goharbor/harbor/blob/main/api/v2.0/swagger.yaml下载https://repo1.maven.org/maven2/io/swagger/swagger-codegen-cli/2.4.43/swagger-codegen-cli-2.4.43.jar生成调用代码swagger-codegen-cli是用java写的,但是支持生成多种语言的调用代码,......