【分布式系统】MinIO之Multi-Node Multi-Drive架构分析

news/2024/4/27 6:04:52/文章来源:https://blog.csdn.net/lzx5290/article/details/129119927

文章目录

  • 架构分析
  • 节点资源
  • 硬盘资源
  • 服务安装
    • 安装步骤
    • 创建系统服务
    • 新建用户和用户组
    • 创建环境变量
    • 启动服务
    • 负载均衡
  • 代码集成
  • 注意

最近打算使用MinIO替代原来使用的FastDFS,所以一直在学习MinIO的知识。这篇文章是基于MinIO多节点多驱动的部署进行研究。

架构分析

在这里插入图片描述

节点资源

IP环境类型作用驱动器
192.168.89.1宿主机nginx服务
192.168.89.71虚拟机minio存储节点1四块硬盘
192.168.89.72虚拟机minio存储节点2四块硬盘

因为我的虚拟机采用的Host-Only加共享方式配置的网络,所以我在宿主机的C:\Windows\System32\drivers\etc\hosts文件中添加了域名的设置,文件内容如下:

# minio
192.168.89.71 minio1.example.com
192.168.89.72 minio2.example.com
192.168.89.1  minio.example.com

这样设置之后,不管在宿主机还是任何一个虚拟机(虚拟机中配置的DNS是192.168.89.1),都可以正常解析域名了。

硬盘资源

磁盘挂载位置格式化
sdb/mnt/disk1xfs
sdc/mnt/disk2xfs
sdd/mnt/disk3xfs
sde/mnt/disk4xfs

VirtualBox虚拟磁盘设置请参考VirtualBox添加虚拟磁盘,两个虚拟机节点都需要同样的配置。

服务安装

采用二进制程序安装方式,具体可参考官网。
两个存储节点都需要安装,且环境保持一致。

安装步骤

[root@lizx src]# wget https://dl.min.io/server/minio/release/linux-amd64/minio
[root@lizx src]# chmod +x minio
[root@lizx src]# mv minio /usr/local/bin/

创建系统服务

二进制方式安装需要手动创建服务。

[root@lizx src]# vi /etc/systemd/system/minio.service

文件写入如下内容:

[Unit]
Description=MinIO
Documentation=https://min.io/docs/minio/linux/index.html
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/bin/minio[Service]
WorkingDirectory=/usr/localUser=minio-user
Group=minio-user
ProtectProc=invisibleEnvironmentFile=-/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# Specifies the maximum number of threads this process can create
TasksMax=infinity# 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})

新建用户和用户组

[root@lizx src]# groupadd -r minio-user
[root@lizx src]# useradd -M -r -g minio-user minio-user
[root@lizx src]# chown minio-user:minio-user /mnt/disk1 /mnt/disk2 /mnt/disk3 /mnt/disk4

创建环境变量

服务启动依赖环境变量文件:/etc/default/minio,包含主机域名和硬盘的配置。创建服务时,此EnvironmentFile配置项指定的该文件。
内容如下:

# Set the hosts and volumes MinIO uses at startup
# The command uses MinIO expansion notation {x...y} to denote a
# sequential series.
#
# The following example covers four MinIO hosts
# with 4 drives each at the specified hostname and drive locations.
# The command includes the port that each MinIO server listens on
# (default 9000)MINIO_VOLUMES="http://minio{1...2}.example.com:9000/mnt/disk{1...4}/minio"# Set all MinIO server options
#
# The following explicitly sets the MinIO Console listen address to
# port 9001 on all network interfaces. The default behavior is dynamic
# port selection.MINIO_OPTS="--console-address :9001"# Set the root username. This user has unrestricted permissions to
# perform S3 and administrative API operations on any resource in the
# deployment.
#
# Defer to your organizations requirements for superadmin user name.MINIO_ROOT_USER=minioadmin# Set the root password
#
# Use a long, random, unique string that meets your organizations
# requirements for passwords.MINIO_ROOT_PASSWORD=minioadmin# Set to the URL of the load balancer for the MinIO deployment
# This value *must* match across all MinIO servers. If you do
# not have a load balancer, set this value to to any *one* of the
# MinIO hosts in the deployment as a temporary measure.
MINIO_SERVER_URL="http://minio.example.com:19000"

启动服务

在每一个节点服务器上按照如下命令启动minio 服务:

systemctl start minio.service

负载均衡

在宿主机上配置一个nginx,配置如下:

    upstream minio_api {server 192.168.89.71:9000;server 192.168.89.72:9000;}upstream minio_console {server 192.168.89.71:9001;server 192.168.89.72:9001;}
   server{listen       19000;server_name  minio.example.com;ignore_invalid_headers off;client_max_body_size 0;proxy_buffering off;location / {proxy_set_header   X-Forwarded-Proto $scheme;proxy_set_header   Host              $http_host;proxy_set_header   X-Real-IP         $remote_addr;proxy_set_header   Upgrade           $http_upgrade;proxy_set_header   Connection        "upgrade";proxy_connect_timeout 300;proxy_http_version 1.1;chunked_transfer_encoding off;proxy_ignore_client_abort on;proxy_pass http://minio_api;}}server{listen       19001;server_name  minio.example.com;ignore_invalid_headers off;client_max_body_size 0;proxy_buffering off;location / {proxy_set_header   X-Forwarded-Proto $scheme;proxy_set_header   Host              $http_host;proxy_set_header   X-Real-IP         $remote_addr;proxy_set_header   Upgrade           $http_upgrade;proxy_set_header   Connection        "upgrade";proxy_connect_timeout 300;proxy_http_version 1.1;chunked_transfer_encoding off;proxy_ignore_client_abort on;proxy_pass http://minio_console;}}

测试时进入控制台报错,是因为websocket没配置,在location中加上如下配置就好了。

   proxy_set_header   Upgrade           $http_upgrade;proxy_set_header   Connection        "upgrade";

代码集成

在程序中进行配置:

# Minio配置
minio:url: http://minio.example.com:19000accessKey: minioadminsecretKey: minioadminbucketName: first-test

bucketName需要提前在控制台进行创建,否则程序报错。

注意

做好nginx负载均衡后,发现使用19000端口无法访问,比如我的一个图片访问链接是:http://minio.example.com:19000/first-test/2023/02/23/loginBtn_20230223143747A003.jpg,浏览器提示"Access denied",我以为是虚拟机时间戳的问题,时间同步后还是存在这个问题,最后发现是bucket的Access 策略设置为private导致的,我改为如下图所示的public策略就可以了。

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_74663.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SpringBoot配置文件(properties yml)

查看官网更多系统配置项:https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html#application-properties 1.配置⽂件作⽤ 整个项⽬中所有重要的数据都是在配置⽂件中配置的,⽐如:数据库的连接信息&am…

怎么把音乐传到苹果手机上?如何将铃声导入iphone

很多人肯定都有这样的经验—比起电脑,使用iPhone和iPad播放音乐能获得更好的声音体验。 因此,现在有越来越多的用户将音乐传输到iPhone/iPad上播放。怎么把音乐传到苹果手机上?把音乐导入苹果手机,主要有2种方法:一种是…

vue中的百度地图的搜索定位功能

效果图 申请百度地图AK 前往 百度地图开放平台控制台 ,登录百度账号,创建应用即得。 封装loadBMap.js文件 /*** 动态加载百度地图api函数* param {String} ak 百度地图AK,必传*/ export default function loadBMap(ak) {return new Promise…

Python曲线肘部点检测-膝部点自动检测

文章目录一. 术语解释二. 拐点检测肘部法则是经常使用的法则。很多时候,可以凭人工经验去找最优拐点,但有时需要自动寻找拐点。最近解决了一下这个问题,希望对各位有用。一. 术语解释 **肘形曲线(elbow curve)**类似人胳膊状的曲线&#xff…

【ArcGIS Pro二次开发】(10):属性表字段(field)的修改

在ArcGIS Pro中,经常会遇到用字段计算器对要素的属性表进行计算。下面以一个例子演示如何在ArcGIS Pro SDK二次开发中实现。 一、要实现的功能 如上图所示的要素图层,要实现如下功能: 当字段【市级行政区】的值为【泉州市】时,将…

服务网格领域的百花齐放

服务网格是一种技术架构,它用于管理微服务系统中各个服务之间的通信,旨在处理微服务间的流量(也称为东西向流量)。 ​ 在云原生应用中,一个应用的背后可能存在着成百上千个服务,各个服务可能又有着若干个实…

【论文速递】EMNLP 2020 - 将事件抽取作为机器阅读理解任务

【论文速递】EMNLP 2020 - 将事件抽取作为机器阅读理解任务 【论文原文】:Event Extraction as Machine Reading Comprehension 【作者信息】:Jian Liu and Yubo Chen and Kang Liu and Wei Bi and Xiaojiang Liu 论文:https://aclantholo…

[音视频] wav 格式

wav 格式结构 WAV文件遵循RIFF规则,其内容以区块(chunk)为最小单位进行存储。WAV文件一般由3个区块组成:RIFF chunk、Format chunk和Data chunk。另外,文件中还可能包含一些可选的区块,如:Fact…

算法leetcode|38. 外观数列(多语言实现)

文章目录38. 外观数列:样例 1:样例 2:提示:分析:题解:rustgocpythonjava38. 外观数列: 给定一个正整数 n ,输出外观数列的第 n 项。 「外观数列」是一个整数序列,从数字…

异步交互的关键——Ajax

文章目录1,Ajax 概述1.1 作用1.2 同步和异步1.3 案例1.3.1 分析1.3.2 后端实现1.3.3 前端实现2,axios2.1 基本使用2.2 快速入门2.2.1 后端实现2.2.2 前端实现2.3 请求方法别名最后说一句1,Ajax 概述 AJAX (Asynchronous JavaScript And XML):异步的 Jav…

C语言--指针进阶2

目录前言函数指针函数指针数组指向函数指针数组的指针回调函数前言 本篇文章我们将继续学习指针进阶的有关内容 函数指针 我们依然用类比的方法1来理解函数指针这一全新的概念,如图1 我们用一段代码来验证一下: int Add(int x, int y) {return xy;…

少走弯路,来自HR自动化实践者5条忠告 | RPA铺第4期

安东尼与巴克利共同撰写的《“无人力”的人力资源?自动化、人工智能及机器学习时代的产业演变》一书中指出,到2030年,全球8.5%的制造业劳动力(约2000万工人)将会被自动化机器人取代。 因自动化、人工智能、机器学习带…

大数据之Phoenix基本介绍

文章目录前言一、Phoenix简介二、Phoenix入门(一)创建表语法(二)查看表信息(三)删除表(四)大小写问题前言 #博学谷IT学习技术支持# 上篇文章介绍了Phoenix环境搭建,点击…

【C语言进阶】指针与数组、转移表详解

前言 大家好我是程序猿爱打拳,我们在学习完指针的基本概念后知道了指针就是地址,我们可以通过这个地址并对它进行解引用从而改变一些数据。但只学习指针的基础是完全不够的,因此学习完指针的基础后我们可以学习关于指针的进阶,其中…

计算机网络高频知识点(一)

目录 一、http状态码 二、浏览器怎么数据缓存 三、强缓存与协商缓存 1、强缓存 2、协商缓存 四、简单请求与复杂请求 五、PUT 请求类型 六、GET请求类型 七、GET 和 POST 的区别 八、跨域 1、什么时候会跨域 2、解决方式 九、计算机网络的七层协议与五层协议分别指…

线上研讨会报名 | Perforce、中手游、星思半导体专家邀您一起畅聊如何通过数字资产管理与版本控制赋能大规模研发

全球领先的数字资产管理与DevSecOps工具厂商Perforce联合中国授权合作伙伴龙智举办的Perforce on Tour网络研讨会将于2月28日下午2:00举行。 本次研讨会以“赋能‘大’研发,助力‘快’交付”为主题,龙智董事长何明、Perforce高级顾问Robert Cowham&…

Spring中的FactoryBean 和 BeanFactory、BeanPostProcessor 和BeanFactoryPostProcessor解析

文章目录FactoryBean 和 BeanFactory后置处理器BeanPostProcessor 和 BeanFactoryPostProcessorBeanPostProcessorBeanFactoryPostProcessorFactoryBean 和 BeanFactory BeanFactory接⼝是容器的顶级接⼝,定义了容器的⼀些基础⾏为,负责⽣产和管理Bean的…

2.26selenium常用api

一.等待1.线程强制等待Thread.sleep()2.隐式等待driver.manage().timeouts().implicitlyWait(Duration.ofSeconds())3.显式等待WebDriverWait foo new WebDriverWait(driver,Duration.ofSeconds(10));foo.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector()…

Spring Boot整合Kaptcha实现验证码功能

目录一、前言1.Kaptcha 简介2.Kaptcha 详细配置表二、实现1.整合kaptcha,创建kaptcha的工具类1.1 添加依赖1.2 创建KaptchaConfig工具类2 编写接口,在接口中使用 kaptcha 工具类来生成验证码图片(验证码信息)并返回3 登录时从sess…

特斯拉4D雷达方案首次曝光!高阶智驾市场比拼安全冗余

随着L2级智能驾驶进入普及阶段,L3/L4级赛道正在成为各家车企的下一个竞争焦点。背后的最大难题,就是如何在成本可控的前提下,保证足够的安全。 高工智能汽车研究院监测数据显示,2022年度中国市场(不含进出口&#xff…