Centos: minio对象存储服务器

1, Centos安装minio对象存储服务

https://min.io/download#/linux
https://docs.min.io/docs/minio-quickstart-guide.html

a, 二进制安装

###################  下载二进制文件,启动服务##################  
wget https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x minio
mv minio /usr/bin
#手动设置登陆帐号密码:
#export MINIO_ACCESS_KEY=admin
#export MINIO_SECRET_KEY=password
mkdir /mnt/minio-data ;  minio server --address 0.0.0.0:9001  /mnt/minio-data

[root@node1 ~]# ./minio server /mnt/minio-data
Endpoint:  http://192.168.56.191:9000  http://10.0.2.15:9000  http://172.17.0.1:9000  http://127.0.0.1:9000      
AccessKey: ERU6G5G6B020DJFJ5IQU 
SecretKey: h3q+AbEQPR0i2i1+p+PUz8OGA7yU2cvvVuhP85iB 

Browser Access:
   http://192.168.56.191:9000  http://10.0.2.15:9000  http://172.17.0.1:9000  http://127.0.0.1:9000      
Command-line Access: https://docs.min.io/docs/minio-client-quickstart-guide
   $ mc config host add myminio http://192.168.56.191:9000 ERU6G5G6B020DJFJ5IQU h3q+AbEQPR0i2i1+p+PUz8OGA7yU2cvvVuhP85iB
^Z
#按ctl z ,中断该程序, 然后使用bg命令后台运行
[1]+  已停止               ./minio server /mnt/minio-data
[root@node1 ~]# bg 1
[1]+ ./minio server /mnt/minio-data &
[root@node1 ~]# ss -nltp |grep 9000
LISTEN     0      128         :::9000                    :::*                   users:(("minio",pid=22359,fd=7))

b, docker安装

##################  2,安装方式2: docker安装 ##################  
docker run -d  --name=minio \
--net=host \
--restart=always \
-v minio-data:/data \
minio/minio server /data

[root@docker ~]# docker logs minio
Endpoint:  http://192.168.56.201:9000  http://10.0.2.15:9000  http://172.17.0.1:9000  http://172.18.0.1:9000  http://172.19.0.1:9000  http://172.20.0.1:9000  http://172.21.0.1:9000  http://127.0.0.1:9000                          

Browser Access:
   http://192.168.56.201:9000  http://10.0.2.15:9000  http://172.17.0.1:9000  http://172.18.0.1:9000  http://172.19.0.1:9000  http://172.20.0.1:9000  http://172.21.0.1:9000  http://127.0.0.1:9000                          

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
#获取登陆口令:
[root@docker ~]# head /var/lib/docker/volumes/minio-data/_data/.minio.sys/config/config.json 
{
	"version": "33",
	"credential": {
		"accessKey": "WNV6U9NJ8DBDW3BXA7VQ",
		"secretKey": "GP6hd2OeNXjLzkOlJIxV8ieYy6blTEE9SvK0cMaP",
		"expiration": "1970-01-01T00:00:00Z",
		"status": "enabled"
	},

登陆minio的web页面: create bucket --> 上传文件(minio上传文件的方式有两种)

  • web ui 界面
  • 找到该bucket的存储路径,cp 文件 到该目录刷新web页面即可显示
    Centos: minio对象存储服务器_第1张图片

2, minio命令行:上传下载

https://docs.min.io/docs/minio-client-quickstart-guide.html

# 1, 下载客户端
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
mv mc /usr/bin
mc --help

# 2, 配置命令补全, minio远程主机:  mc config host add 主机别名  http://192.168.1.51 帐号 密码
[root@cent6_server ~]# mc config host add minio http://docker:9000 WNV6U9NJ8DBDW3BXA7VQ GP6hd2OeNXjLzkOlJIxV8ieYy6blTEE9SvK0cMaP
Added `minio` successfully.
[root@cent6_server ~]# mc --autocompletion
mc: enabled autocompletion in '$SHELLRC'. Please restart your shell.

# 3, 测试连接: mc ls 主机名
[root@cent6_server ~]# mc config host add minio http://docker:9000 WNV6U9NJ8DBDW3BXA7VQ GP6hd2OeNXjLzkOlJIxV8ieYy6blTEE9SvK0cMaP
Added `minio` successfully.
[root@cent6_server ~]# mc ls minio
[2019-11-01 13:48:26 CST]      0B aaa/
[root@cent6_server ~]# mc ls minio/aaa
[2019-11-01 13:48:24 CST]  1.5KiB OriginFilter.java
[2019-11-01 13:07:38 CST]   34KiB a.png
[2019-11-01 13:45:02 CST]    984B id.txt
[2019-11-01 12:58:53 CST]  1.0KiB ks.cfg
[2019-11-01 13:48:26 CST]  553KiB single_disease_names.csv

# 4, 创建bucker:相当于文件夹
[root@cent6_server ~]# mc mb minio/dir1
Bucket created successfully `minio/dir1`.

[root@cent6_server ~]# mc ls minio
[2019-11-01 13:48:26 CST]      0B aaa/
[2019-11-01 14:40:33 CST]      0B dir1/

# 5, 上传文件到bucket
[root@cent6_server ~]# ls
anaconda-ks.cfg  class-deploy.sh                          txt               公共的          文档
You have new mail in /var/spool/mail/root

[root@cent6_server ~]# mc cp a.txt minio/dir1
a.txt:                    353 B / 353 B ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00% 12.03 KiB/s 0s [root@cent6_server ~]# ░░░░░░░░░░░┃   0.00%  

[root@cent6_server ~]# mc ls minio/dir1/
[2019-11-01 14:40:53 CST]    353B a.txt

# 6,下载文件
[root@eadage txt]# mc cp minio/aaa/OriginFilter.java  .
...aa/OriginFilter.java:  1.50 KiB / 1.50 KiB ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00% 164.36 KiB/s 0s[root@eadage txt]# ░░░░░░┃   0.00%  
[root@eadage txt]# cat OriginFilter.java 
package com.utils;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
..........

#7, 查看文件内容
[root@cent6_server ~]# echo "123-mc" >1.txt
[root@cent6_server ~]# mc cp 1.txt minio/aaa/
minio/aaa/a.png                     minio/aaa/OriginFilter.java         
minio/aaa/ks.cfg                    minio/aaa/single_disease_names.csv  
[root@cent6_server ~]# mc cp 1.txt minio/aaa/
1.txt:                    7 B / 7 B ┃▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓┃ 100.00% 259 B/s 0s You have mail in /var/spool/mail/root.00%  
[root@cent6_server ~]# mc cat minio/aaa/1.txt 
123-mc

3, minio多用户管理

https://docs.min.io/docs/minio-multi-user-quickstart-guide.html

# 1, 添加用户: mc admin user add    <用户名>  <密码>
[root@cent6_server ~]# mc admin user add  minio user1-access user1-secrt
Added user `user1-access` successfully.
[root@cent6_server ~]# mc admin user add  minio user2-access user2-secrt
Added user `user2-access` successfully.

#2, 查看所有用户
[root@cent6_server ~]# mc admin user list minio
enabled    user2-access                              
enabled    user1-access        

#3, 配置用户权限: mc admin policy set      <权限名>  <用户名>
[root@cent6_server ~]#  mc admin policy list minio 
readonly            
readwrite           
writeonly       

[root@cent6_server ~]# mc admin policy set  minio readonly user=user2-access
Policy readonly is set on user `user2-access`

# 4, 创建组,    设置组权限,添加组用户
[root@cent6_server ~]# mc admin group add minio group1 user2-access
Added members {user2-access} to group group1 successfully.
[root@cent6_server ~]# mc admin policy set minio readonly group=group1
Policy readonly is set on group `group1`
[root@cent6_server ~]#  mc admin group  add minio   group1  user1-access     
Added members {user1-access} to group group1 successfully.

你可能感兴趣的:(Centos: minio对象存储服务器)