CENTOS 分布式对象存储服务minio的部署和配置

时间:2024-03-07 12:03:58

1.服务端部署

wget https://dl.minio.io/server/minio/release/linux-amd64/minio
chmod +x minio
# 启动后会打印出AccessKey和SecretKey等信息
./minio server /data/minio_oss_srv 
# 后台运行
nohup ./minio server /data/minio_oss_srv > /data/logs/minio/minio.log 2>&1 &
#开放9000端口
firewall-cmd --zone=public --add-port=9000/tcp --permanent
firewall-cmd --reload
#自定义端口号
./minio server --address 101.121.115.159:9001 /data/minio_oss_srv

2.客户端部署

wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
./mc --help

3.配置MySQL发布minio事件

#mc配置本地minio服务
$ ./mc config host add myminio http://127.0.0.1:9000 yourAccessKey yourSecretKey
$ ./mc admin config get myminio/ notify_mysql notify_mysql table="" database="" format="namespace" password="" port="" queue_dir="" queue_limit="0" username="" dsn_string="" host="" $ ./mc admin config set myminio notify_mysql table="minio_images" format="namespace" queue_limit="0" dsn_string="user:password@tcp(localhost:3306)/dbname" # Add notification configuration on the `images` bucket using the MySQL ARN. $ ./mc event add myminio/images arn:minio:sqs::_:mysql
#重启minio,控制台会打印 SQS ARNs: arn:minio:sqs::_:mysql
$ ./mc admin service restart myminio

4.配置minio启用压缩

#查看压缩配置
$ ./mc admin config get myminio compression
compression extensions=".txt,.log,.csv,.json,.tar,.xml,.bin" mime_types="text/*,application/json,application/xml"
#通过环境变量启用配置
export MINIO_COMPRESS="on"
export MINIO_COMPRESS_EXTENSIONS=".pdf,.doc"
export MINIO_COMPRESS_MIME_TYPES="application/pdf"