前言
上集说到,MinIO 的基本情况,详情请戳:
环境准备
IP | 主机名 | 数据盘 |
---|---|---|
192.168.2.10 | host1 | 四块 100G 数据盘 |
192.168.2.11 | host2 | 四块 100G 数据盘 |
192.168.2.12 | host3 | 四块 100G 数据盘 |
192.168.2.13 | host4 | 四块 100G 数据盘 |
192.168.2.14 | minio-lvs | 无数据盘,安装 Nginx |
- 前四个节点,安装 MinIO,四个数据盘分别挂载至/data1、/data2、/data3、/data4
- 第五个节点安装 Nginx,做负载均衡
- 五个节点均关闭防火墙:
systemctl stop firewalld systemctl disable firewalld
部署
准备配置文件 (四个节点均添加)
- 准备 minio 配置文件至/etc/default/minio,内容如下
# AK/SK 自定义即可 MINIO_ACCESS_KEY="xxx" MINIO_SECRET_KEY="xxx" MINIO_VOLUMES=http://host{1...4}/data{1...4} MINIO_OPTS="--address :9000"
准备 minio 二进制文件 (四个节点均执行)
- 下载 minio 的二进制文件,移动至节点的/usr/local/bin/目录下
http://dl.minio.org.cn/server/minio/release/linux-amd64/minio
- 准备 systemd 托管 services 文件,内容如下
[Unit] Description=MinIO Documentation=https://docs.min.io Wants=network-online.target After=network-online.target AssertFileIsExecutable=/usr/local/bin/minio [Service] WorkingDirectory=/usr/local/ User=root Group=root EnvironmentFile=/etc/default/minio ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/default/minio\"; exit 1; fi" ExecStart=/usr/local/bin/minio server $MINIO_OPTS $MINIO_VOLUMES # Let systemd restart this service always Restart=always # Specifies the maximum file descriptor number that can be opened by this process LimitNOFILE=65536 # Disable timeout logic and wait until process is stopped TimeoutStopSec=infinity SendSIGKILL=no [Install] WantedBy=multi-user.target # Built for ${project.name}-${project.version} (${project.name})
执行启动程序 (四个节点均执行)
systemctl daemon-load systemctl start minio systemctl enable minio
验证启动是否成功
- 四个节点查看是否监听 9000 端口 (或者修改过启动端口,可以看相应的端口)
ss -anlp | grep 9000 --- tcp LISTEN 0 128 :::9000 :::* users:(("minio",pid=15697,fd=7))
- 浏览器访问 http://IP:9000,IP 分别使用四个节点的 IP 都访问一下,Access Key 以及 Secret Key 为配置文件中设置的
Nginx 负载均衡
安装 Nginx
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm yum install -y nginx systemctl start nginx systemctl enable nginx
services 配置文件 (minio.conf) 准备
- 将配置文件放置/etc/nginx/conf.d/目录下
upstream minio { server 192.168.2.10:9000 weight=10 max_fails=2 fail_timeout=30s; server 192.168.2.11:9000 weight=10 max_fails=2 fail_timeout=30s; server 192.168.2.12:9000 weight=10 max_fails=2 fail_timeout=30s; server 192.168.2.13:9000 weight=10 max_fails=2 fail_timeout=30s; } server { listen 9000; server_name 192.168.2.14; charset utf-8; default_type text/html; location / { proxy_set_header Host $http_host; proxy_set_header X-Forwarded-For $remote_addr; client_body_buffer_size 10M; client_max_body_size 100G; proxy_buffers 1024 4k; proxy_read_timeout 300; proxy_next_upstream error timeout http_404; proxy_pass http://minio; } }
生效负载均衡配置
systemctl daemon-reload systemctl restart nginx
访问
- 使用 http://lvs-ip:9000 来访问即可
客户端工具
- 下载:http://dl.minio.org.cn/client/mc/release/linux-amd64/mc,赋予执行权限
- 与服务端关联
mc config host add minio http://192.168.2.14:90000 <AK> <SK>
本文作者为 olei,转载请注明。
感谢分享,好
学习了赞一个
文章不错非常喜欢