# 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)
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
* 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)
* Familiarity with [``mc mirror``](https://docs.minio.io/docs/minio-client-complete-guide#mirror)
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``.
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 are creating destination bucket ``mbucket`` on ``minio2`` and adding ``minio2`` alias. The bucket ``mbucket`` will be used to mirror data directory of ``minio1``.
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
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.
```sh
#!/bin/bash
datadir="/home/minio/minio1-data/"
minio2="minio2/mbucket"
MC_PATH="/home/minio/mc"
$MC_PATH --quiet mirror --force $minio1 $minio2
```
Set executable permissions on the script before adding a cron entry.
```sh
$ chmod 755 /home/minio/minio.sh
```
Set a new cron entry to run ``minio.sh`` script once every 30mins.
```sh
$ crontab -e
*/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.