前言
上集说到,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,转载请注明。
感谢分享,好
学习了赞一个
文章不错非常喜欢