一.安装docker
下载地址
链接:https://pan.baidu.com/s/1_ys-xI-tM83eGZ8YpJoSYw
提取码:rj5z
1.将离线包上传到/home/docker目录,(复制以下内容保存为 docker.service 文件,一定是要全部!!!)
touch docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
2.安装,命令如下
# 进入安装文件存放目录
cd /home/docker
# 解压 docker 到当前目录
tar -xvf docker-20.10.9.tgz
# 将 docker 文件移动到 /usr/bin 目录下
cp -p docker/* /usr/bin
# 将 docker.service 移到 /etc/systemd/system/ 目录
cp docker.service /etc/systemd/system/
# 设置 docker.service 文件权限
chmod +x /etc/systemd/system/docker.service
# 重新加载配置文件
systemctl daemon-reload
# 启动docker
systemctl start docker
# 设置 docker 开机自启
systemctl enable docker.service
3.验证安装是否成功
[root@ArmServer bin]# docker -v
Docker version 20.10.7, build f0df350
二.分布式存储minio集群安装
1.环境信息
华为云上的arm架构服务器,操作系统版本:CentOS Linux release 7.6.1810 (AltArch)
集群部署至少需要2台服务器,4个目录,下面按3台服务器,6个目录配置。
192.168.0.109 | minio-1 |
---|---|
192.168.0.114 | minio-2 |
192.168.0.133 | minio-3 |
2.离线包下载地址
链接:https://pan.baidu.com/s/1-RZlwy4nOIKBFfK9Cf5viA
提取码:ezcm
3.时钟同步
#同步时钟服务器,举例:
yum install ntp
ntpdate 10.73.92.44
clock -w
4.配置本地hosts解析(所有Minio节点都需要执行)
vim /etc/hosts
192.168.0.109 minio-1
192.168.0.114 minio-2
192.168.0.133 minio-3
5. 创建minio本地存储路径(所有Minio节点都需要执行)
mkdir -p /data/minio/data1
mkdir -p /data/minio/data2
6.创建minio容器(各个节点执行各个节点的命令)
docker run -d --name minio-01 --restart=always --net=host \
-e "MINIO_ROOT_USER=admin" \
-e "MINIO_ROOT_PASSWORD=admin123" \
-v /data/minio/data1:/data1 \
-v /data/minio/data2:/data2 \
minio/minio:latest server \
--address 192.168.0.109:9000 \
--console-address '0.0.0.0:9999' http://minio-{1...3}/data{1...2}
docker run -d --name minio-01 --restart=always --net=host \
-e "MINIO_ROOT_USER=admin" \
-e "MINIO_ROOT_PASSWORD=admin123" \
-v /data/minio/data1:/data1 \
-v /data/minio/data2:/data2 \
minio/minio:latest server \
--address 192.168.0.114:9000 \
--console-address '0.0.0.0:9999' http://minio-{1...3}/data{1...2}
docker run -d --name minio-01 --restart=always --net=host \
-e "MINIO_ROOT_USER=admin" \
-e "MINIO_ROOT_PASSWORD=admin123" \
-v /data/minio/data1:/data1 \
-v /data/minio/data2:/data2 \
minio/minio:latest server \
--address 192.168.0.133:9000 \
--console-address '0.0.0.0:9999' http://minio-{1...3}/data{1...2}
7.查看docker运行容器运行命令(所有节点都可以执行)
docker logs -f minio-1
8.访问任意节点IP:9999 访问 账号/密码:admin/admin123
9.使用Minio-Nginx作为统一入口文件和负载均衡
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#Minio代理,设置文件上传上限
client_max_body_size 1000m;
#Minio 服务负载均衡
upstream minio-server {
server 192.168.0.109:9000 weight=25 max_fails=2 fail_timeout=30s;
server 192.168.0.114:9000 weight=25 max_fails=2 fail_timeout=30s;
server 192.168.0.133:9000 weight=25 max_fails=2 fail_timeout=30s;
}
#控制台负载均衡
upstream minio-console {
server 192.168.0.109:9999 weight=25 max_fails=2 fail_timeout=30s;
server 192.168.0.114:9999 weight=25 max_fails=2 fail_timeout=30s;
server 192.168.0.133:9999 weight=25 max_fails=2 fail_timeout=30s;
}
#Minio服务
server {
listen 9030;
server_name minio-server;
# 允许在标头中使用特殊字符
ignore_invalid_headers off;
# 允许任何大小的文件上传。
# 设置为1000m等值;将文件大小限制为特定值
client_max_body_size 1000m;
# 禁用缓冲
proxy_buffering off;
location / {
root html;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_connect_timeout 300;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_pass http://minio-server;
}
}
#Minio控制台
server {
listen 9040;
server_name minio-console;
# 允许在标头中使用特殊字符
ignore_invalid_headers off;
# 允许任何大小的文件上传。
# 设置为1000m等值;将文件大小限制为特定值
client_max_body_size 1000m;
# 禁用缓冲
proxy_buffering off;
location / {
root html;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
proxy_connect_timeout 300;
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
proxy_http_version 1.1;
proxy_set_header Connection "";
chunked_transfer_encoding off;
proxy_pass http://minio-console;
}
}
}
10.访问Ip:9040 查看是否成功
安装成功。