OpsMx
Search…
How to Setup Replication for Minio Storage Service on Openshift

How to Setup Replication for Minio Storage Service on Openshift

In the previous document, we covered “How to Setup Minio Storage Service for Spinnaker on Openshift” for the primary site.
In this document, we would cover how to setup Minio storage service as pods on two different sites and how to use Minio Client (also as a pod) to replicate the data among the sites.
The Minio servers store the data into buckets. A bucket is an equivalent of a drive or mount point in filesystems and should not be treated as folders. Minio does not place any limits on the number of buckets created per user. On Amazon S3, each account is limited to 100 buckets.
Once, we have the Minio setup on either sites, we can create buckets and then replicate the buckets from site 1 to site 2 using Minio Client .
Minio Client (mc) provides a modern alternative to UNIX commands like ls, cat, cp, mirror, diff etc. It supports filesystems and Amazon S3 compatible cloud storage service (AWS Signature v2 and v4).
Minio Client can be installed locally or as docker containers from this link: https://docs.minio.io/docs/minio-client-complete-guide
However we are going to install it in the form of Pods where the bucket names, Minio server endpoints will supplied as secrets thereby can be used to replicate the pods. We have embedded a script which would replicate between site 1 and site 2 with the buckets as specified. The minio-client would be running from Site 1 to Site 2. Site 1 will act as the Primary and Site 2 would act as the Secondary

Prerequisites

Step 1: Setup the Minio Storage Service on the Primary and Secondary Sites.
Please follow the steps in the “How to Setup Minio Storage Service for Spinnaker on Openshift” document including setting up the service, deployment, Persistent Volume Claim (PVC) and secrets for both primary and secondary sites
If you have exposed a route/IP for the sites, it needs to be converted into base64 and provided to the minio-client as secret.
Step 2: Convert data into base64
We would be assuming that we need to transfer data between Bucket 1 of Primary site and the Bucket 2 of the Secondary site. The Primary site would have Minio server referred as minio1 and Secondary site would be referred to as minio2. The data would be accepted as a secret and would be named as the following
Primary Site
Secondary Site
EndPoint
minio1endpoint
minio2endpoint
UserName/AccessKey
minio1accesskey
minio2accesskey
Password/SecretAccessKey
minio1secretaccess
minio2secretaccess
Bucket Replication
Bucket1
Bucket2
Once these are converted to base64 we move on the next step of creating the secret, pvc and deployment.
Step 3: Creating Secret, Deployment and PVC Object.
The secret would be named as “mcclient”
1
#oc create -f minio-client-secret.yml
Copied!
1
apiVersion: v1
2
data:
3
bucket1: < base64-converted_openshift-spinnaker-bucket_name >
4
bucket2: < base64-converted_openshift-spinnaker-bucket_name >
5
minio1accesskey: < base64-converted_openshift-password >
6
minio1endpoint: < base64-endpoint_http://minio-service >
7
minio1secretaccess: < base64-converted_openshift-password >
8
minio2accesskey: < base64-converted_openshift-password >
9
minio2endpoint: < base64-endpoint_http://minio-service >
10
minio2secretaccess: < base64-converted_openshift-password >
11
kind: Secret
12
metadata:
13
name: mcclient
Copied!
The PVC would be named as “mc”. Ensure that you have the persistent volume for the PVC
1
# oc create -f minio-client-pvc.yml
Copied!
1
apiVersion: "v1"
2
kind: "PersistentVolumeClaim"
3
metadata:
4
name: "mc"
5
spec:
6
accessModes:
7
- "ReadWriteOnce"
8
resources:
9
requests:
10
storage: "10Gi"
Copied!
Finally, we will setup the deployment object. The deployment object would be accepting the secret and PVC and start replicating the data. In this setup, we have setup a script running inside the pod /data/replication.sh which is performing the work replication.
1
# oc create -f minio-client.yml
Copied!
1
apiVersion: extensions/v1beta1
2
kind: Deployment
3
metadata:
4
# This name uniquely identifies the Deployment
5
name: minio-client-deployment
6
spec:
7
strategy:
8
type: Recreate
9
template:
10
metadata:
11
labels:
12
# Label is used as selector in the service.
13
app: minio-client
14
spec:
15
containers:
16
- name: minio-client
17
image: docker.io/opsmx11/minio-client:demo
18
imagePullPolicy: Always
19
env:
20
- name: minio1Endpoint
21
valueFrom:
22
secretKeyRef:
23
name: mcclient
24
key: minio1endpoint
25
- name: minio1Accesskey
26
valueFrom:
27
secretKeyRef:
28
name: mcclient
29
key: minio1accesskey
30
- name: minio1Secretaccess
31
valueFrom:
32
secretKeyRef:
33
name: mcclient
34
key: minio1secretaccess
35
- name: minio2Endpoint
36
valueFrom:
37
secretKeyRef:
38
name: mcclient
39
key: minio2endpoint
40
- name: minio2Accesskey
41
valueFrom:
42
secretKeyRef:
43
name: mcclient
44
key: minio2accesskey
45
- name: minio2Secretaccess
46
valueFrom:
47
secretKeyRef:
48
name: mcclient
49
key: minio2secretaccess
50
- name: bucket1
51
valueFrom:
52
secretKeyRef:
53
name: mcclient
54
key: bucket1
55
- name: bucket2
56
valueFrom:
57
secretKeyRef:
58
name: mcclient
59
key: bucket2
60
command: [ "/bin/sh", "-c"]
61
args: [ "sh /data/replication.sh"]
62
volumeMounts:
63
- mountPath: /backup
64
name: mc-data
65
volumes:
66
- name: mc-data
67
persistentVolumeClaim:
68
claimName: mc
Copied!
That’s it. We are done. Once we were have all the objects configured and in once place, our script takes care of the replication from Site1 Minio storage to the Site2 Minio Storage is started.
Last modified 1yr ago