一、實驗背景
從基于云的備份解決方案到高可用性內(nèi)容傳送網(wǎng)絡(luò)(CDN)衔肢,對象存儲已成為現(xiàn)代技術(shù)領(lǐng)域不可分割的一部分。 而且豁翎,由于其占地面積小角骤,界面簡單,與多個云存儲服務(wù)兼容心剥, Minio對象存儲服務(wù)器具有很大的沖擊力邦尊。
Minio是一種開源對象存儲服務(wù)器,
Minio 是一個基于Apache License v2.0開源協(xié)議的對象存儲服務(wù)优烧,可將非結(jié)構(gòu)化數(shù)據(jù)(如照片蝉揍,視頻,虛擬機(jī)映像畦娄,容器和日志文件)存儲為對象又沾。它兼容亞馬遜S3云存儲服務(wù)接口弊仪,非常適合于存儲大容量非結(jié)構(gòu)化的數(shù)據(jù),而一個對象文件可以是任意大小杖刷,從幾KB到最大5T不等撼短。
Minio是一個非常輕量的服務(wù),可以很簡單的和其他應(yīng)用的結(jié)合,類似 NodeJS, Redis 或者 MySQL挺勿。
在分布式模式下曲横,Minio提供了一個單一的對象存儲服務(wù)器,它可以跨多個服務(wù)器分布多個驅(qū)動器不瓶。
Minio由Go語言編寫禾嫉,附帶命令行客戶端和瀏覽器界面,并支持高級消息隊列協(xié)議(AMQP) 蚊丐, 彈性搜索 熙参, Redis , NATS和Postgres目標(biāo)的簡單排隊服務(wù)麦备。
在本教程中孽椰,我們將學(xué)習(xí):
1.在CentOS7服務(wù)器上安裝Minio服務(wù)器,并將其配置為systemd服務(wù)
2.使用“加密”設(shè)置SSL / TLS證書凛篙,以確保服務(wù)器和客戶端之間的通信安全
3.通過HTTPS訪問Minio的瀏覽器界面黍匾,以使用和管理服務(wù)器
二、實驗環(huán)境
操作系統(tǒng): CentOS7.5 Minmal
minioServer: 192.168.1.103
三呛梆、安裝minioSever
1.創(chuàng)建minio安裝相關(guān)目錄锐涯,做數(shù)據(jù)盤掛載
# mkdir? /usr/local/minio
# mkfs.xfs? -f /dev/sdb
# mount? /dev/sdb? /usr/local/minio
# blkid /dev/sdb
# echo? "$(blkid /dev/sdb | awk '{print $2}') /usr/local/minio xfs defaults? 0 0"? >>? /etc/fstab
# cat /etc/fstab
# mount? -a
# lsblk
# mkdir? /usr/local/minio/bin
# mkdir? /usr/local/minio/etc
# mkdir? /usr/local/minio/data
2. 創(chuàng)建minio運(yùn)行用戶
# groupadd? -g? 2019? minio
#? useradd? -r? -M? -u? 2019? -g 2019? -c "Minio User"? -s /sbin/nologin? minio
#? id? minio
# cat /etc/passwd
3.下載minio的二進(jìn)制文件
#? curl -O https://dl.minio.io/server/minio/release/linux-amd64/minio
# chmod? 750? minio
# ./minio? --help
# ./minio? version
# cp? minio? /usr/local/minio/bin
4. 創(chuàng)建minio配文件
#? vim /usr/local/minio/etc/minio.conf
##########################################################
MINIO_VOLUMES="/usr/local/minio/data"
MINIO_OPTS="-C /usr/local/minio/etc --address 192.168.1.103:9000"
##########################################################
# vim? /etc/systemd/system/minio.service?
####################################################################
[Unit]
Description=MinIO
Documentation=https://docs.min.io
Wants=network-online.target
After=network-online.target
AssertFileIsExecutable=/usr/local/minio/bin/minio
[Service]
# User and group
User=minio
Group=minio
EnvironmentFile=/usr/local/minio/etc/minio.conf
ExecStart=/usr/local/minio/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
####################################################################
5. 更改文件、目錄屬主屬組
#? chown? -R minio:minio? /usr/local/minio
6.啟動服務(wù)
#? systemctl daemon-reload
# systemctl enable minio.service
#? systemctl start? minio.service
#? systemctl status? minio.service
# ps aux | grep minio
# ss? -tan? |? grep 9000
7.設(shè)置防火墻填物,開放minio訪問端口
# firewall-cmd --zone=public --add-port=9000/tcp --permanent
# firewall-cmd --reload
8.訪問minio
http://192.18.1.103:9000
獲取AccessKey和SecretKey
#? ll? /usr/local/minio/
# ll? -R? /usr/local/minio/
#? ll? -R? /usr/local/minio/data/
# cat /usr/local/minio/data/.minio.sys/config/config.json
#? cat /usr/local/minio/data/.minio.sys/config/config.json? | head? -n 20
? ? ? ? ? ? "accessKey": "UQLPP1WIH28W806T9AY7"
"secretKey": "MMYyJkwNTDUVqBzn0TGsZkSL7entHsV5zcAOLAkq"
四纹腌、 配置minio的SSL/TLS
從上面可以看出,minio啟動后會在 etc目錄下生成證書文件目錄滞磺,在data目錄下生成隱藏文件夾升薯,里面有登錄相關(guān)配置
1.生成私鑰和自簽名證書
# yum? -y install openssl
# openssl req -x509 -nodes? \
-sha512? \
-newkey rsa:2048 \
-days 365 \
-subj "/C=CN/ST=Gunagdong/L=Shenzhen/O=Test/OU=Test/CN=www.example.com" \
-keyout private.key \
-out public.crt
查看證書內(nèi)容
# cat /usr/local/minio/etc/certs/private.key
# cat /usr/local/minio/etc/certs/public.crt
# openssl x509 -noout -text -in? /usr/local/minio/etc/certs/public.crt
2.拷貝證書到minio證書目錄
# mv private.key? /usr/local/minio/etc/certs
# mv? public.crt? /usr/local/minio/etc/certs
# find /usr/local/minio/etc/certs -type d -exec chmod 700 {} \;
# find? /usr/local/minio/etc/certs -type f -exec? chmod 400 {} \;
# chown? -R? minio:minio? /usr/local/minio
3.重啟minio服務(wù)
# systemctl? restart minio.service
# systemctl? status? minio.service
五、測試minio文件存儲
1.創(chuàng)建兩個bucket
2.文件上傳測試
3. 文件分享
4.查看后臺文件目錄狀態(tài)
# ll? -R? /usr/local/minio
關(guān)于minio自定義登錄用戶名密碼
# /usr/local/minio/bin/minio server --help
# /usr/local/minio/bin/minio? --help
編輯配置文件击困,定義環(huán)境變量
MINIO_ACCESS_KEY:用戶名涎劈,最少三個字符
MINIO_SECRET_KEY:密鑰,最少八個字符
#? vim /usr/local/minio/etc/minio.conf
#######################################################
MINIO_VOLUMES="/usr/local/minio/data"
MINIO_OPTS="-C /usr/local/minio/etc --address 192.168.1.103:9000"
MINIO_ACCESS_KEY="admin"
MINIO_SECRET_KEY="Admin@123"
########################################################
# systemctl? daemon-reload
# systemctl? restart? minio.service
# systemctl status minio.service
瀏覽器訪問:https://192.168.1.103:9000
六沛励、minio的卸載
# systemctl? stop? minio.service
# rm? -rf? /usr/local/minio
# rm -rf? /etc/systemd/system/minio.service
# systemctl? daemon-reload
# firewall-cmd --zone=public --remove-port=9000/tcp--permanent
# firewall-cmd --reload
七责语、參考
如何在Ubuntu 16.04上使用Minio設(shè)置對象存儲服務(wù)器
https://www.howtoing.com/how-to-set-up-an-object-storage-server-using-minio-on-ubuntu-16-04
How to Set Up an Object Storage Server Using Minio on Ubuntu 16.04
https://www.digitalocean.com/community/tutorials/how-to-set-up-an-object-storage-server-using-minio-on-ubuntu-16-04
存儲非結(jié)構(gòu)化數(shù)據(jù)之利器minio
https://blog.51cto.com/jiayimeng/2378552
Using https for minio server
https://stackoverflow.com/questions/50878454/using-https-for-minio-server
How to secure access to MinIO server with TLS
http://www.reibang.com/p/e01ba7356704
https://docs.min.io/docs/how-to-secure-access-to-minio-server-with-tls
systemd 中文手冊
http://www.jinbuguo.com/systemd/systemd.exec.html
How to non-interactively create selfsigned SSL key and certificate files with openssl?
http://www.reibang.com/p/6de78dc23b9a
Minio Server config.json (v18) 指南
https://blog.csdn.net/dingjs520/article/details/79111029