Doc: Fixed screenshot path for modified docs. (#2390)
parent
82cd38e959
commit
0dc5662f9b
@ -1,116 +1,116 @@ |
|||||||
# How to use ``mc mirror`` to setup replication between two sites running Minio. [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/minio/minio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
# How to use ``mc mirror`` to setup replication between two sites running Minio. [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/minio/minio?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
||||||
|
|
||||||
![minio_MIRROR](https://raw.githubusercontent.com/minio/blob/master/docs/screenshots/miniomirror.jpeg?raw=true) |
![minio_MIRROR](https://github.com/minio/minio/blob/master/docs/screenshots/miniomirror.jpeg?raw=true) |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
In this document we will illustrate how to set up replication between two Minio servers, `minio1` and `minio2` running on ``192.168.1.11`` and ``192.168.1.12`` respectively. We will mirror the data directory on `minio1` to the bucket on `minio2`. |
In this document we will illustrate how to set up replication between two Minio servers, `minio1` and `minio2` running on ``192.168.1.11`` and ``192.168.1.12`` respectively. We will mirror the data directory on `minio1` to the bucket on `minio2`. |
||||||
|
|
||||||
|
|
||||||
## 1. Prerequisites |
## 1. Prerequisites |
||||||
|
|
||||||
* Download Minio server from [here](https://docs.minio.io/docs/minio) |
* Download Minio server from [here](https://docs.minio.io/docs/minio) |
||||||
* Download & Install mc from [here](https://docs.minio.io/docs/minio-client-quickstart-guide) |
* Download & Install mc from [here](https://docs.minio.io/docs/minio-client-quickstart-guide) |
||||||
* Familiarity with [``mc mirror``](https://docs.minio.io/docs/minio-client-complete-guide#mirror) |
* Familiarity with [``mc mirror``](https://docs.minio.io/docs/minio-client-complete-guide#mirror) |
||||||
|
|
||||||
## 2. Install and Configure Minio Server |
## 2. Install and Configure Minio Server |
||||||
|
|
||||||
### Setup minio1 |
### Setup minio1 |
||||||
|
|
||||||
```sh |
```sh |
||||||
$ ./minio server minio1-data/ |
$ ./minio server minio1-data/ |
||||||
|
|
||||||
Endpoint: http://127.0.0.1:9000 http://192.168.1.11:9000 |
Endpoint: http://127.0.0.1:9000 http://192.168.1.11:9000 |
||||||
AccessKey: MURIVYBYNPTYE7O8I779 |
AccessKey: MURIVYBYNPTYE7O8I779 |
||||||
SecretKey: lVbZmz4CvGkBl7JKw5icuL7RCcSvpBJTkAJTFQwz |
SecretKey: lVbZmz4CvGkBl7JKw5icuL7RCcSvpBJTkAJTFQwz |
||||||
Region: us-east-1 |
Region: us-east-1 |
||||||
``` |
``` |
||||||
**mc alias** |
**mc alias** |
||||||
|
|
||||||
Alias is a short name to your cloud storage service for ``Minio client``. End-point, access and secret keys are supplied by your cloud storage provider. API signature is an optional argument. By default, it is set to ``S3v4``. |
Alias is a short name to your cloud storage service for ``Minio client``. End-point, access and secret keys are supplied by your cloud storage provider. API signature is an optional argument. By default, it is set to ``S3v4``. |
||||||
|
|
||||||
```sh |
```sh |
||||||
$ ./mc config host add minio1 http://192.168.1.11:9000 MURIVYBYNPTYE7O8I779 lVbZmz4CvGkBl7JKw5icuL7RCcSvpBJTkAJTFQwz |
$ ./mc config host add minio1 http://192.168.1.11:9000 MURIVYBYNPTYE7O8I779 lVbZmz4CvGkBl7JKw5icuL7RCcSvpBJTkAJTFQwz |
||||||
``` |
``` |
||||||
|
|
||||||
**Create buckets and add objects** |
**Create buckets and add objects** |
||||||
|
|
||||||
We have created few buckets using [``mc mb``](https://docs.minio.io/docs/minio-client-complete-guide#mb) and added objects to it using [``mc cp``](https://docs.minio.io/docs/minio-client-complete-guide#cp) Minio client commands. |
We have created few buckets using [``mc mb``](https://docs.minio.io/docs/minio-client-complete-guide#mb) and added objects to it using [``mc cp``](https://docs.minio.io/docs/minio-client-complete-guide#cp) Minio client commands. |
||||||
|
|
||||||
```sh |
```sh |
||||||
$ ./mc mb minio1/mybucket |
$ ./mc mb minio1/mybucket |
||||||
$ ./mc cp myfile.txt minio1/bucket1 |
$ ./mc cp myfile.txt minio1/bucket1 |
||||||
$ ./mc ls minio1 |
$ ./mc ls minio1 |
||||||
[2016-07-31 10:26:55 PDT] 0B bucket1/ |
[2016-07-31 10:26:55 PDT] 0B bucket1/ |
||||||
[2016-07-31 09:36:17 PDT] 0B bucket2/ |
[2016-07-31 09:36:17 PDT] 0B bucket2/ |
||||||
[2016-07-31 09:38:08 PDT] 0B bucket3/ |
[2016-07-31 09:38:08 PDT] 0B bucket3/ |
||||||
``` |
``` |
||||||
|
|
||||||
### Setup minio2 |
### Setup minio2 |
||||||
|
|
||||||
```sh |
```sh |
||||||
$ ./minio server minio2-data/ |
$ ./minio server minio2-data/ |
||||||
|
|
||||||
Endpoint: http://127.0.0.1:9000 http://192.168.1.12:9000 |
Endpoint: http://127.0.0.1:9000 http://192.168.1.12:9000 |
||||||
AccessKey: YRDRWWQLEWS9OBJ31GZ2 |
AccessKey: YRDRWWQLEWS9OBJ31GZ2 |
||||||
SecretKey: y2sSWzx5ytwvkELcxOuSaQ8n3doNqoIilRpb5Kjj |
SecretKey: y2sSWzx5ytwvkELcxOuSaQ8n3doNqoIilRpb5Kjj |
||||||
Region: us-east-1 |
Region: us-east-1 |
||||||
``` |
``` |
||||||
|
|
||||||
```sh |
```sh |
||||||
$ ./mc config host add minio2 http://192.168.1.12:9000 YRDRWWQLEWS9OBJ31GZ2 y2sSWzx5ytwvkELcxOuSaQ8n3doNqoIilRpb5Kjj |
$ ./mc config host add minio2 http://192.168.1.12:9000 YRDRWWQLEWS9OBJ31GZ2 y2sSWzx5ytwvkELcxOuSaQ8n3doNqoIilRpb5Kjj |
||||||
``` |
``` |
||||||
|
|
||||||
**Create bucket** |
**Create bucket** |
||||||
|
|
||||||
We are creating destination bucket ``mbucket`` on ``minio2`` and adding ``minio2`` alias. The bucket ``mbucket`` will be used to mirror data directory of ``minio1``. |
We are creating destination bucket ``mbucket`` on ``minio2`` and adding ``minio2`` alias. The bucket ``mbucket`` will be used to mirror data directory of ``minio1``. |
||||||
|
|
||||||
```sh |
```sh |
||||||
$ ./mc mb minio1/mbucket |
$ ./mc mb minio1/mbucket |
||||||
``` |
``` |
||||||
|
|
||||||
```sh |
```sh |
||||||
$ ./mc config host add minio2 http://192.168.1.12:9000 YRDRWWQLEWS9OBJ31GZ2 y2sSWzx5ytwvkELcxOuSaQ8n3doNqoIilRpb5Kjj |
$ ./mc config host add minio2 http://192.168.1.12:9000 YRDRWWQLEWS9OBJ31GZ2 y2sSWzx5ytwvkELcxOuSaQ8n3doNqoIilRpb5Kjj |
||||||
|
|
||||||
``` |
``` |
||||||
|
|
||||||
## 4. Setup crontab |
## 4. Setup crontab |
||||||
Cron is a Unix/Linux system utility by which you can schedule a task process for particular duration, we have tested this setup on Ubuntu Linux. |
Cron is a Unix/Linux system utility by which you can schedule a task process for particular duration, we have tested this setup on Ubuntu Linux. |
||||||
|
|
||||||
|
|
||||||
### Script |
### Script |
||||||
|
|
||||||
Add crontab configuration on `minio1` providing path of data directory, ``minio1-data``. |
Add crontab configuration on `minio1` providing path of data directory, ``minio1-data``. |
||||||
|
|
||||||
``--force`` option with ``mc mirror`` overwrites the destination contents, this would keep your contents in sync. |
``--force`` option with ``mc mirror`` overwrites the destination contents, this would keep your contents in sync. |
||||||
|
|
||||||
```sh |
```sh |
||||||
|
|
||||||
#!/bin/bash |
#!/bin/bash |
||||||
datadir="/home/minio/minio1-data/" |
datadir="/home/minio/minio1-data/" |
||||||
minio2="minio2/mbucket" |
minio2="minio2/mbucket" |
||||||
MC_PATH="/home/minio/mc" |
MC_PATH="/home/minio/mc" |
||||||
$MC_PATH --quiet mirror --force $minio1 $minio2 |
$MC_PATH --quiet mirror --force $minio1 $minio2 |
||||||
|
|
||||||
``` |
``` |
||||||
|
|
||||||
Set executable permissions on the script before adding a cron entry. |
Set executable permissions on the script before adding a cron entry. |
||||||
|
|
||||||
```sh |
```sh |
||||||
|
|
||||||
$ chmod 755 /home/minio/minio.sh |
$ chmod 755 /home/minio/minio.sh |
||||||
``` |
``` |
||||||
|
|
||||||
Set a new cron entry to run ``minio.sh`` script once every 30mins. |
Set a new cron entry to run ``minio.sh`` script once every 30mins. |
||||||
|
|
||||||
```sh |
```sh |
||||||
|
|
||||||
$ crontab -e |
$ crontab -e |
||||||
*/30 * * * * /home/minio/minio.sh |
*/30 * * * * /home/minio/minio.sh |
||||||
``` |
``` |
||||||
|
|
||||||
Note: We are going to introduce continuous replication feature in `mc mirror` which will enable the sites to be in sync without having the need to setup cron job. |
Note: We are going to introduce continuous replication feature in `mc mirror` which will enable the sites to be in sync without having the need to setup cron job. |
||||||
|
|
||||||
# Explore Further |
# Explore Further |
||||||
* [Minio Quickstart Guide](https://docs.minio.io/docs/minio-quickstart-guide) |
* [Minio Quickstart Guide](https://docs.minio.io/docs/minio-quickstart-guide) |
||||||
* [Minio Client Complete Guide](https://docs.minio.io/docs/minio-client-complete-guide) |
* [Minio Client Complete Guide](https://docs.minio.io/docs/minio-client-complete-guide) |
||||||
|
Loading…
Reference in new issue