通过minio快速创建分布式对象存储

时间:2024-03-07 12:06:11

关键词:对象存储、minio、分布式、集群

官方示例

example1

# 32个node,每个node启动32个driver
export MINIO_ACCESS_KEY=<ACCESS_KEY>
export MINIO_SECRET_KEY=<SECRET_KEY>
minio server http://host{1...32}/export{1...32}

实践配置

# windows环境下
# 使用两个node,每个node启动4个driver
# 定义access_key和secret_key环境变量,如没有minio自动生成
set MINIO_ACCESS_KEY=admin123
set MINIO_SECRET_KEY=admin@123
# 每个节点启动命令都要指定所有节点地址+存储目录
# {1...4} 表示连续的目录data1到data4
minio server http://192.168.198.23/d:/minio/data{1...4} http://192.168.198.100/d:/minio/data{1...4}

启动后日志

Waiting for a minimum of 4 disks to come online (elapsed 2s)

Waiting for a minimum of 4 disks to come online (elapsed 4s)

Waiting for a minimum of 4 disks to come online (elapsed 7s)

Waiting for all other servers to be online to format the disks.
Status:         8 Online, 0 Offline.
Endpoint:  http://169.254.232.69:9000  http://169.254.63.46:9000  http://192.168.198.23:9000  http://192.168.199.23:9000  http://192.168.137.1:9000  http://10.99.10.1:9000  http://10.99.20.1:9000  http://127.0.0.1:9000
AccessKey: admin123
SecretKey: admin@123

Browser Access:
   http://169.254.232.69:9000  http://169.254.63.46:9000  http://192.168.198.23:9000  http://192.168.199.23:9000  http://192.168.137.1:9000  http://10.99.10.1:9000  http://10.99.20.1:9000  http://127.0.0.1:9000

Command-line Access: https://docs.min.io/docs/minio-client-quickstart-guide
   $ mc.exe config host add myminio http://169.254.232.69:9000 admin123 admin@123

Object API (Amazon S3 compatible):
   Go:         https://docs.min.io/docs/golang-client-quickstart-guide
   Java:       https://docs.min.io/docs/java-client-quickstart-guide
   Python:     https://docs.min.io/docs/python-client-quickstart-guide
   JavaScript: https://docs.min.io/docs/javascript-client-quickstart-guide
   .NET:       https://docs.min.io/docs/dotnet-client-quickstart-guide

# 启动后,首先检查其它节点上driver是否上线,并等待
# 集群所有driver都上线后,打印出本节点Endpoint监听的所有地址、key、web地址、
# 客户端使用方法以及各语言API使用方法网络地址

访问web,输入key登录

web

linux下启动方法也是这么个情况

export MINIO_ACCESS_KEY=admin123
export MINIO_SECRET_KEY=admin@123
/usr/bin/minio server --config-dir /etc/minio \
http://192.168.1.211/minio{1...8} \
http://192.168.1.212/minio{1...8} \
http://192.168.1.213/minio{1...8} \
http://192.168.1.209/minio{1...8} \
http://192.168.1.210/minio{1...8}
# 这里加了个--config-dir参数,指定生成的配置目录,默认配置会生成到~/.minio下