admin avatar

重新整理了一下兼容S3的開源存儲Minio安裝教程(非docker安裝)

🕚 by admin





重新整理了一下兼容S3的開源存儲Minio安裝教程(非docker安裝)

docker真的非常方便和實用,能夠節省好多時間,但是有個潔癖,能不用docker就不用

畢竟docker也是需要消耗系統資源的,本文介紹非docker安裝兼容S3的開源存儲Minio

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
mv minio /usr/local/bin
useradd -r minio-user -s /sbin/nologin
chown minio-user:minio-user /usr/local/bin/minio
mkdir -p  /home/minio
chown minio-user:minio-user /home/minio
mkdir /etc/minio
chown minio-user:minio-user /etc/minio
vi /etc/default/minio
# Volume to be used for MinIO server.
MINIO_VOLUMES="/home/minio/"
# Use if you want to run MinIO on a custom port.
MINIO_OPTS="--address :9000 --console-address :9001"
# Root user for the server.
MINIO_ROOT_USER=usename
# Root secret for the server.
MINIO_ROOT_PASSWORD=password

curl -O https://raw.githubusercontent.com/minio/minio-service/master/linux-systemd/minio.service

vi minio.service

[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=nobody
Group=nogroup 
ProtectProc=invisible

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=1048576

# 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})

mv minio.service /etc/systemd/system/minio.service
systemctl daemon-reload
systemctl enable minio
systemctl start minio
systemctl status minio
journalctl -fu minio.service. //這個是關鍵,如果minio啟動失敗,可以非常方便的排錯

如果沒什麼問題就可以使用兼容S3的客戶端登陸minio了,這裏以開源的Upic為例, 常見的兼容S3客戶端還有Cyberduck

注意域名後面的demo一定要寫上否則會出現Acces deny了,

Minio mc客戶端的常用命令

wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc 
mv mc /usr/local/bin
mc alias list //列出存儲節點等同於mc config host ls
mc mirror -w --remove  /var/www/s3/demo/ s3/demo//等同於持續完整鏡像本地文件夾到遠程minio存儲節點下
mc policy set public local/demo //要向能夠在瀏覽器訪問,這個必須設置好,設置本地minio存儲目錄下的demo為公開訪問。

注意,使用S3客戶端時,默認的MINIO region是 us-east-1 (美國東區1), 一般默認不建議修改( region 描述的是服務器的物理位置),這也是亞馬遜S3的默認區域。你可以通過 MINIO_REGION 環境變量進行修改。

更多Minio文檔參考官網

https://docs.min.io/minio/baremetal/




💘 相关文章

写一条评论

Based on Golang + fastHTTP + sdb | go1.18.3 Processed in 2ms