记录一下搭建minio的过程
单机安装
下载安装minio服务端
github地址
1
2
3
|
$ wget https://dl.min.io/server/minio/release/linux-amd64/minio
$ chmod +x minio
$ mv minio /usr/local/bin/
|
设置启动管理并启动
minio提供了在各种Linux和BSD发行版上使用MinIO的init/service脚本。github地址
这里使用centos7对应的systemd文件,做一些修改(注意:systemd文件还有个是对应分布式的,我这里下载的是单点的。有分布式安装的在github中找对应的systemd文件)
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
|
$ cd /etc/systemd/system/; curl -O https://raw.githubusercontent.com/minio/minio-service/master/linux-systemd/minio.service
$ vim 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=minio-user
#Group=minio-user
EnvironmentFile=/etc/systemd/system/minio #这里是配置文件,在github文档中就有,对应改动一下就行 默认是/etc/default/minio,我这里放在和systemd文件一个目录下了,记得如果这里修改,下面一行中的路径也得修改
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/systemd/system/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})
$ vim /etc/systemd/system/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"
# Root user for the server.
MINIO_ROOT_USER=admin
# Root secret for the server.
MINIO_ROOT_PASSWORD=admin000
# 域名
#MINIO_DOMAIN=minio.your_domain.com
$ systemctl daemon-reload
$ systemctl start minio
$ systemctl enable minio.service
|
访问:http://<server_ip:9000>
安装minio客户端
1
2
3
|
$ wget https://dl.min.io/client/mc/release/linux-amd64/mc
$ chmod +x mc
$ mc alias set myminio/ http://MINIO-SERVER MYUSER MYPASSWORD
|
集群安装
集群安装就启动的配置文件不一样, 其他的配置都一样。每个节点都需要相同的设置。
minio至少需要4个节点,这里我使用2个服务器4个盘,符合最少要求。(注意:生产环境建议最少4节点)
下载安装minio服务端
github地址
1
2
3
|
$ wget https://dl.min.io/server/minio/release/linux-amd64/minio
$ chmod +x minio
$ mv minio /usr/local/bin/
|
设置启动管理并启动
minio提供了在各种Linux和BSD发行版上使用MinIO的init/service脚本。github地址
这里使用centos7对应的systemd文件,注意这里用的是分布式的systemd文件,不过和单机的没有啥区别,单机和分布式的区别在于配置文件中
以下的配置需要在所有集群机器上操作。
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
|
$ cd /etc/systemd/system/; curl -O https://raw.githubusercontent.com/minio/minio-service/master/linux-systemd/distributed/minio.service
$ vim 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=minio-user
#Group=minio-user
EnvironmentFile=/etc/systemd/system/minio #这里是配置文件,在github文档中就有,对应改动一下就行 默认是/etc/default/minio,我这里放在和systemd文件一个目录下了,记得如果这里修改,下面一行中的路径也得修改
ExecStartPre=/bin/bash -c "if [ -z \"${MINIO_VOLUMES}\" ]; then echo \"Variable MINIO_VOLUMES not set in /etc/systemd/system/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})
#注意,这里和单机版的内容不一样
$ vim /etc/systemd/system/minio
# Volume to be used for MinIO server.
#MINIO_VOLUMES=http://node{1...6}/export{1...32}
MINIO_VOLUMES="http://172.16.77.01/home/test/minio1 http://172.16.77.01/home/test/minio2 http://172.16.77.02/home/test/minio1 http://172.16.77.02/home/test/minio2"
# Use if you want to run MinIO on a custom port.
MINIO_OPTS="--address :9000"
# Root user for the server.
MINIO_ROOT_USER=admin
# Root secret for the server.
MINIO_ROOT_PASSWORD=admin000
# 域名
#MINIO_DOMAIN=minio.your_domain.com
$ systemctl daemon-reload
$ systemctl start minio
$ systemctl enable minio.service
|
访问:http://<server_ip:9000>,有兴趣的可以使用nginx进行代理,这里不做赘述
安装minio客户端
1
2
3
|
$ wget https://dl.min.io/client/mc/release/linux-amd64/mc
$ chmod +x mc
$ mc alias set myminio/ http://MINIO-SERVER MYUSER MYPASSWORD
|
Author
dylan
LastMod
2020-10-14
License
如需转载请注明文章作者和出处。谢谢!