yaml部署方式

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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# minio-statefulset.yaml
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: minio
namespace: minio
spec:
serviceName: minio
replicas: 4
selector:
matchLabels:
app: minio
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
env:
- name: MINIO_ROOT_USER
value: "admin"
- name: MINIO_ROOT_PASSWORD
value: "root123456"
image: 192.168.129.33:5000/minio/minio:latest
imagePullPolicy: IfNotPresent
command:
- /bin/sh
- -c
- minio server --console-address ":9001" http://minio-{0...3}.minio.minio.svc.cluster.local/data
ports:
- name: data
containerPort: 9000
protocol: "TCP"
- name: console
containerPort: 9001
protocol: "TCP"
volumeMounts:
- name: minio-data
mountPath: /data
- name: date-config
mountPath: /etc/localtime
volumes:
- name: date-config
hostPath:
path: /usr/share/zoneinfo/Asia/Shanghai
volumeClaimTemplates:
- metadata:
name: minio-data
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 10Gi
storageClassName: managed-nfs-storage


---
apiVersion: v1
kind: Service
metadata:
name: minio
namespace: minio
labels:
app: minio
spec:
clusterIP: None
ports:
- port: 9000
name: data
- port: 9001
name: console
selector:
app: minio
---
apiVersion: v1
kind: Service
metadata:
name: minio-service-svc
namespace: minio
spec:
type: NodePort
ports:
- name: data
port: 9000
targetPort: 9000
protocol: TCP
nodePort: 30025
- name: console
port: 9001
targetPort: 9001
protocol: TCP
nodePort: 30023
selector:
app: minio

利用 mc迁移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
# 参考文档:http://wiki.sqlfans.cn/minio/minio-migr-mc.html

源头minio节点:https://minio.xxxxx.com
user:syncer
password:xxxxxx
bucket:test-public、test-private
目标minio节点:https://oss.xxxx.com
user:admin
password:xxxxxx

# 1.源节点:下载最新版的 mc客户端
curl -sL https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/bin/mc
chmod +x /usr/bin/mc

# 2.源节点:针对2个minio节点,创建2个别名
mc alias set minio1 https://minio.xxxx.com syncer xxxx --api s3v4
mc alias set minio2 https://oss.xxxx.com admin xxxx --api s3v4
mc alias list

# 3.源节点:模拟源节点(minio1)某bucket已存在文件,示例 bucket111
#mc mb minio1/test-public
#mc cp /etc/hosts minio1/test-public
#mc cp /etc/sysconfig minio1/test-public --recursive

# 4.源节点:为目标节点(minio2)创建bucket,并利用cp命令实现一次数据同步
mc mb minio2/test-public
mc mb minio2/test-private
mc cp --recursive minio1/test-public minio2
mc cp --recursive minio1/test-private minio2

minio授权用户及创建bucket

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
# bucket要求:
sams-private:Anonymous Access为默认
sams-public:Anonymous Access为{"Prefix": "*", "Access": "readonly"}

1. 创建账号密码
shaixxx xxx@P2023 # 生产环境,readwrite, Secret Key
2. Policies-->readwrite-->Raw Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:DeleteObject",
"s3:GetBucketLocation",
"s3:GetObject",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::sams-*"
]
}
]
}

3. 访问
$ mc alias set shancha https://oss.xxxx.com shaicha xxxx@P2023 --api s3v4
Added `shancha` successfully.
$ mc alias list
shancha
URL : https://oss.xxxx.com
AccessKey : shaicha
SecretKey : xxxx@P2023
API : s3v4
Path : auto