将老版本的harbor1.1.2无损升级到最新版本harbor2.5.0, 后面有条件可以随版本更新
harbor-offline-installer-v1.1.2.tgz
harbor-offline-installer-v1.2.0.tgz
harbor-offline-installer-v1.5.0.tgz
harbor-offline-installer-v1.6.0.tgz
harbor-offline-installer-v1.8.0.tgz
harbor-offline-installer-v1.10.0.tgz
harbor-offline-installer-v2.1.0.tgz
harbor-offline-installer-v2.5.0.tgz
harbor-offline-installer-v2.7.0.tgz
harbor-offline-installer-v2.9.1.tgz
cd /usr/src/harbor
docker-compose down
cd /usr/src/
mv harbor harbor1.1.2.bak
tar xf harbor-offline-installer-v1.2.0.tgz
mv harbor /usr/src
cd /usr/src/harbor
docker load -i harbor.v1.2.0.tar.gz
docker pull goharbor/harbor-db-migrator:1.2
db_pwd=root123
harbor_db_path="/data/database"
harbor_cfg="/usr/src/harbor1.1.2.bak/harbor.cfg"
backup_path="/data/backup/1.1.2"
docker run -it --rm -e DB_USR=root -e DB_PWD=${db_pwd} -v ${harbor_db_path}:/var/lib/mysql -v ${harbor_cfg}:/harbor-migration/harbor-cfg/harbor.cfg -v ${backup_path}:/harbor-migration/backup goharbor/harbor-db-migrator:1.2 backup
docker run -it --rm -e DB_USR=root -e DB_PWD=${db_pwd} -v ${harbor_db_path}:/var/lib/mysql -v ${harbor_cfg}:/harbor-migration/harbor-cfg/harbor.cfg goharbor/harbor-db-migrator:1.2 up
cp $harbor_cfg /usr/src/harbor
cd /usr/src/harbor
./install.sh
cd /usr/src/harbor
docker-compose down
cd /usr/src/
mv harbor harbor1.2.0.bak
tar xf harbor-offline-installer-v1.5.0.tgz
mv harbor /usr/src
cd /usr/src/harbor
docker load -i harbor.v1.5.0.tar.gz
docker pull goharbor/harbor-migrator:v1.5.0
db_pwd=root123
harbor_db_path="/data/database"
harbor_cfg="/usr/src/harbor1.2.0.bak/harbor.cfg"
backup_path="/data/backup/1.2.0"
docker run -it --rm -e DB_USR=root -e DB_PWD=${db_pwd} -v ${harbor_db_path}:/var/lib/mysql -v ${harbor_cfg}:/harbor-migration/harbor-cfg/harbor.cfg -v ${backup_path}:/harbor-migration/backup goharbor/harbor-migrator:v1.5.0 backup
docker run -it --rm -e DB_USR=root -e DB_PWD=${db_pwd} -v ${harbor_db_path}:/var/lib/mysql -v ${harbor_cfg}:/harbor-migration/harbor-cfg/harbor.cfg goharbor/harbor-migrator:v1.5.0 up
cp $harbor_cfg /usr/src/harbor
cd /usr/src/harbor
./install.sh
(1)harbor数据库在v1.6版本做了很大的升级。数据库从原来的MySQL升级为postgresql数据库。根据官方文档的解释,旧版本的harbor升级到最新的v1.9,需先将harbor升级到v1.6,再升级到更高的版本。 (2)从v1.8.0开始,Harbor的配置已更改为.yml文件,迁移器将配置文件从harbor.cfg转换为harbor.yml。 (3)从v1.6.0开始,Harbor会在启动时自动尝试迁移数据库,因此如果从v1.6.0或更高版本升级,则无需调用迁移器工具来迁移数据库,只需要更新cfg文件即可。 (4)从v1.7.0开始,支持Helm Chart部署。
cd /usr/src/harbor
docker-compose down
cd /usr/src/
mv harbor harbor1.5.0.bak
tar xf harbor-offline-installer-v1.6.0.tgz
mv harbor /usr/src
cd /usr/src/harbor
docker load -i harbor.v1.6.0.tar.gz
docker pull goharbor/harbor-migrator:v1.6.0
db_pwd=root123
harbor_db_path="/data/database"
harbor_cfg="/usr/src/harbor1.5.0.bak/harbor.cfg"
backup_path="/data/backup/1.5.0"
docker run -it --rm -e DB_USR=root -e DB_PWD=${db_pwd} -v ${harbor_db_path}:/var/lib/mysql -v ${harbor_cfg}:/harbor-migration/harbor-cfg/harbor.cfg -v ${backup_path}:/harbor-migration/backup goharbor/harbor-migrator:v1.6.0 backup
docker run -it --rm -e DB_USR=root -e DB_PWD=${db_pwd} -v ${harbor_db_path}:/var/lib/mysql -v ${harbor_cfg}:/harbor-migration/harbor-cfg/harbor.cfg goharbor/harbor-migrator:v1.6.0 up
cp $harbor_cfg /usr/src/harbor
cd /usr/src/harbor
./install.sh
cd /usr/src/harbor
docker-compose down
cd /usr/src/
mv harbor harbor1.6.0.bak
tar xf harbor-offline-installer-v1.8.0.tgz
mv harbor /usr/src
cd /usr/src/harbor
docker load -i harbor.v1.8.0.tar.gz
docker run -it --rm -v /usr/src/harbor1.6.0.bak/harbor.cfg:/harbor-migration/harbor-cfg/harbor.cfg -v /usr/src/harbor/harbor.yml:/harbor-migration/harbor-cfg-out/harbor.yml goharbor/harbor-migrator:v1.8.0 --cfg up
cd /usr/src/harbor
./install.sh
cd /usr/src/harbor
docker-compose down
cd /usr/src/
mv harbor harbor1.8.0.bak
tar xf harbor-offline-installer-v1.10.tgz
mv harbor /usr/src
cd /usr/src/harbor
docker load -i harbor.v1.10.0.tar.gz
docker run -it --rm -v /usr/src/harbor1.8.0.bak/harbor.cfg:/harbor-migration/harbor-cfg/harbor.cfg -v /usr/src/harbor/harbor.yml:/harbor-migration/harbor-cfg-out/harbor.yml goharbor/harbor-migrator:v1.10.0 --cfg up
cp /usr/src/harbor1.8.0.bak/harbor.yml /usr/src/harbor/
cd /usr/src/harbor
./install.sh
cd /usr/src/harbor
docker-compose down
cd /usr/src/
mv harbor harbor1.10.0.bak
tar xf harbor-offline-installer-v2.1.0.tgz
mv harbor /usr/src
cd /usr/src/harbor
docker load -i harbor.v2.1.0.tar.gz
docker run -it --rm -v /:/hostfs goharbor/prepare:v2.1.0 migrate -i /usr/src/harbor1.10.0.bak/harbor.yml -o /usr/src/harbor/harbor.yml -t 2.1.0
cp /usr/src/harbor1.10.0.bak/harbor.yml /usr/src/harbor/
cd /usr/src/harbor
./install.sh
cd /usr/src/harbor
docker-compose down
cd /usr/src/
mv harbor harbor2.1.0.bak
tar xf harbor-offline-installer-v2.5.0.tgz
mv harbor /usr/src
cd /usr/src/harbor
docker load -i harbor.v2.5.0.tar.gz
docker run -it --rm -v /:/hostfs goharbor/prepare:v2.5.0 migrate -i /usr/src/harbor2.1.0.bak/harbor.yml -o /usr/src/harbor/harbor.yml -t 2.5.0
cp /usr/src/harbor2.1.0.bak/harbor.yml /usr/src/harbor/
cd /usr/src/harbor
./install.sh --with-trivy