1. 主机配置
主机地址 | 主机配置 | 主机角色 | 软件版本 |
---|---|---|---|
192.168.1.60 | CPU:4C MEM:4GB Disk: 100GB | Harbor+Keepalived | Harbor 2.1.3 Keepalived 2.2.1 Docker 19.03.9 VIP:192.168.1.156 |
192.168.1.61 | CPU:4C MEM:4GB Disk: 100GB | Harbor+Keepalived | Harbor 2.1.3 Keepalived 2.2.1 Docker 19.03.9 VIP:192.168.1.156 |
192.168.1.62 | CPU:4C MEM:8GB Disk: 500GB | Postgres+Redis+NFS | Docker 19.03.9 |
2. 基础安装配置(前置工作可跳过)
2.1 Docker 安装教程
2.1.1 安装存储驱动
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
2.1.2 添加 Docker-ce 安装仓库
sudo yum-config-manager --add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
2.1.3 查看与安装所需版本
yum list docker-ce --showduplicates | sort -r
yum -y install docker-ce-19.03.9 docker-ce-cli-19.03.9 containerd.io
2.1.4 配置国内仓库
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn","https://hub-mirror.c.163.com"],
"max-concurrent-downloads": 20,
"live-restore": true,
"max-concurrent-uploads": 10,
"debug": true,
"data-root": "/data/docker_data",
"exec-root": "/data/docker_exec",
"log-opts": {
"max-size": "100m",
"max-file": "5"
}
}
2.1.5 启动 Docker
systemctl start docker && systemctl enable docker
2.1.6 安装 docker-compose
sudo wget https://github.com/docker/compose/releases/download/1.28.4/docker-compose-Linux-x86_64
sudo mv docker-compose-Linux-x86_64 /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
3. 安装postgres+redis服务
3.1 docker-compose.yml
version: '3.1'
services:
db:
image: goharbor/harbor-db:v2.10.0
container_name: harbor-postgres
restart: always
cap_drop:
- ALL
cap_add:
- CHOWN
- DAC_OVERRIDE
- SETGID
- SETUID
environment:
POSTGRES_PASSWORD: root123
volumes:
- /mnt/data/harbor_db/database:/var/lib/postgresql/data
ports:
- 5432:5432
redis:
image: goharbor/redis-photon:v2.10.0
container_name: harbor-redis
restart: always
cap_drop:
- ALL
cap_add:
- SETGID
- SETUID
environment:
- TZ=Asia/Shanghai
- LANG=en_US.UTF-8
volumes:
- /mnt/data/harbor_db/redis:/var/lib/redis
ports:
- 6379:6379
3.2 安装postgres+redis
docker-compose up -d
4. 安装Harbor
4.1 修改harbor.yml
以下仅为需要修改的配置
hostname: fairmarket.casdc.cn
http:
port: 30080
https:
port: 30443
certificate: /mnt/gpfs/liuhuan/cert/10932648_fairmarket.casdc.cn_nginx/fairmarket.casdc.cn.pem
private_key: /mnt/gpfs/liuhuan/cert/10932648_fairmarket.casdc.cn_nginx/fairmarket.casdc.cn.key
external_url: https://fairmarket.casdc.cn
harbor_admin_password: 9w1kVh$OVJfat*jBExCJsy5g%BonmC$5gR#7lkbN9Jr1XlzewQI6YRqb#j@YfGtcuXeApkTsB4CmdW2*^DJE$9o4DuOeewQGZWE
data_volume: /mnt/gpfs/liuhuan/harbor_data
log:
level: info
local:
rotate_count: 50
rotate_size: 200M
location: /mnt/gpfs/liuhuan/var/log/harbor
external_database:
harbor:
host: 10.238.68.107
port: 5432
db_name: registry
username: postgres
password: root123
ssl_mode: disable
max_idle_conns: 2
max_open_conns: 0
notary_signer:
host: 10.238.68.107
port: 5432
db_name: notarysigner
username: postgres
password: root123
ssl_mode: disable
notary_server:
host: 10.238.68.107
port: 5432
db_name: notaryserver
username: postgres
password: root123
ssl_mode: disable
external_redis:
host: 10.238.68.107:6379
password:
4.2 安装harbor
./install.sh
标签:compose,后端,Harbor,redis,harbor,2.1,共享,data,docker
From: https://www.cnblogs.com/lliuhuan/p/18460092