2020-05-16 13:06:47 +05:30
# Geo-Replication
2016-09-21 19:46:13 +05:30
## Introduction
2015-05-19 12:11:52 +05:30
Geo-replication provides a continuous, asynchronous, and incremental
replication service from one site to another over Local Area Networks
(LANs), Wide Area Network (WANs), and across the Internet.
2020-05-16 13:06:47 +05:30
## Prerequisites
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
* Primary and Secondary Volumes should be Gluster Volumes.
* Primary and Secondary clusters should have the same GlusterFS version.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
## Replicated Volumes vs Geo-replication
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
The following table lists the difference between replicated volumes
and Geo-replication:
2015-05-19 12:11:52 +05:30
Replicated Volumes | Geo-replication
--- | ---
Mirrors data across clusters | Mirrors data across geographically distributed clusters
Provides high-availability | Ensures backing up of data for disaster recovery
Synchronous replication (each and every file operation is sent across all the bricks) | Asynchronous replication (checks for the changes in files periodically and syncs them on detecting differences)
2016-09-21 19:46:13 +05:30
## Exploring Geo-replication Deployment Scenarios
2015-05-19 12:11:52 +05:30
Geo-replication provides an incremental replication service over Local
2020-05-16 13:06:47 +05:30
Area Networks (LANs), Wide Area Network (WANs), and across the
Internet.
2015-05-19 12:11:52 +05:30
This section illustrates the most common deployment scenarios for
Geo-replication, including the following:
2020-05-16 13:06:47 +05:30
### Geo-replication over Local Area Network(LAN)
2015-05-19 12:11:52 +05:30

2020-05-16 13:06:47 +05:30
### Geo-replication over Wide Area Network(WAN)
2015-05-19 12:11:52 +05:30

2020-05-16 13:06:47 +05:30
### Geo-replication over Internet
2015-05-19 12:11:52 +05:30

2020-05-16 13:06:47 +05:30
### Mirror data in a cascading fashion across multiple sites(Multi-site cascading Geo-replication)
2015-05-19 12:11:52 +05:30

2020-12-09 18:15:53 +05:30
## Secondary User setup
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
Setup an unprivileged user in Secondary nodes to secure the SSH
connectivity to those nodes. The unprivileged Secondary user uses the
2020-05-16 13:06:47 +05:30
mountbroker service of glusterd to set up an auxiliary gluster mount
for the user in a special environment, which ensures that the user is
only allowed to access with special parameters that provide
administrative level access to the particular Volume.
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
In all the Secondary nodes, create a new group as "geogroup".
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
```
# sudo groupadd geogroup
```
2015-05-19 12:11:52 +05:30
2023-07-06 11:49:39 +02:00
In all the Secondary nodes, create an unprivileged account. This user
must have a home directory and a configured shell. For example,
2020-05-16 13:06:47 +05:30
"geoaccount". Add geoaccount as a member of "geogroup" group.
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
```
2023-07-06 11:49:39 +02:00
# useradd -s /bin/bash -d /home/geoaccount/ -G geogroup geoaccount
2020-05-16 13:06:47 +05:30
```
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
In any one Secondary node, run the following command to setup the
2020-05-16 13:06:47 +05:30
mountbroker root directory and group.
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
```
gluster-mountbroker setup <MOUNT ROOT> <GROUP>
```
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
For example,
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
```
# gluster-mountbroker setup /var/mountbroker-root geogroup
```
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
In any one of Secondary node, Run the following commands to add Volume and
2020-05-16 13:06:47 +05:30
user to mountbroker service.
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
```
gluster-mountbroker add <VOLUME> <USER>
```
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
For example,
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
```
2020-12-09 18:15:53 +05:30
# gluster-mountbroker add gvol-secondary geoaccount
2020-05-16 13:06:47 +05:30
```
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
(**Note**: To remove a user, use `gluster-mountbroker remove` command)
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
Check the status of setup using,
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
```
# gluster-mountbroker status
```
2019-09-20 15:23:43 +05:30
2020-12-09 18:15:53 +05:30
Restart `glusterd` service on all Secondary nodes.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
## Setting Up the Environment for Geo-replication
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
### Time Synchronization
2020-12-09 18:15:53 +05:30
On bricks of a geo-replication Primary volume, all the servers' time
2020-05-16 13:06:47 +05:30
must be uniform. You are recommended to set up NTP (Network Time
Protocol) or similar service to keep the bricks sync in time and avoid
the out-of-time sync effect.
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
For example: In a Replicated volume where brick1 of the Primary is at
12.20 hrs, and brick 2 of the Primary is at 12.10 hrs with 10 minutes
2020-05-16 13:06:47 +05:30
time lag, all the changes in brick2 between this period may go
2020-12-09 18:15:53 +05:30
unnoticed during synchronization of files with Secondary.
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
### Password-less SSH
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Password-less login has to be set up between the host machine (where
2020-12-09 18:15:53 +05:30
geo-replication Create command will be issued) and one of the Secondary
2020-05-16 13:06:47 +05:30
node for the unprivileged account created above.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
**Note**: This is required to run Create command. This can be disabled
2020-05-16 13:06:47 +05:30
once the session is established.(Required again while running create
force)
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
On one of the Primary node where geo-replication Create command will be
2020-05-16 13:06:47 +05:30
issued, run the following command to generate the SSH key(Press Enter
twice to avoid passphrase).
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
```
# ssh-keygen
```
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
Run the following command on the same node to one Secondary node which is
identified as the main Secondary node.
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
```
# ssh-copy-id geoaccount@snode1.example.com
```
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
### Creating secret pem pub file
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Execute the below command from the node where you setup the
2020-12-09 18:15:53 +05:30
password-less ssh to Secondary. This will generate Geo-rep session
specific ssh-keys in all Primary peer nodes and collect public keys
2016-09-21 19:46:13 +05:30
from all peer nodes to the command initiated node.
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
# gluster-georep-sshkey generate
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
This command adds extra prefix inside common_secret.pem.pub file to
each pub keys to prevent running extra commands using this key, to
disable that prefix,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
# gluster-georep-sshkey generate --no-prefix
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
## Creating the session
2020-05-16 13:06:47 +05:30
2020-12-09 18:15:53 +05:30
Create a geo-rep session between Primary and Secondary volume using the
2016-09-21 19:46:13 +05:30
following command. The node in which this command is executed and the
2021-01-28 09:48:28 +05:30
`<Secondary_host>` specified in the command should have password less ssh
2016-09-21 19:46:13 +05:30
setup between them. The push-pem option actually uses the secret pem
pub file created earlier and establishes geo-rep specific password
2020-12-09 18:15:53 +05:30
less ssh between each node in Primary to each node of Secondary.
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> \
2019-09-20 15:23:43 +05:30
create [ssh-port <port>] push-pem|no-verify [force]
```
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
For example,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1 .example.com::gvol-secondary \
2020-05-16 13:06:47 +05:30
create push-pem
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2021-10-04 21:06:02 +05:30
If custom SSH port (example: 50022) is configured in Secondary nodes then
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2021-10-04 21:06:02 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1 .example.com::gvol-secondary \
config ssh_port 50022
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1 .example.com::gvol-secondary \
2020-05-16 13:06:47 +05:30
create ssh-port 50022 push-pem
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
If the total available size in Secondary volume is less than the total
size of Primary, the command will throw error message. In such cases
2016-09-21 19:46:13 +05:30
'force' option can be used.
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
In use cases where the rsa-keys of nodes in Primary volume is
distributed to Secondary nodes through an external agent and following
Secondary side verifications are taken care of by the external agent, then
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
- if ssh port 22 or custom port is open in Secondary
2016-09-21 19:46:13 +05:30
- has proper passwordless ssh login setup
2020-12-09 18:15:53 +05:30
- Secondary volume is created and is empty
- if Secondary has enough memory
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Then use following command to create Geo-rep session with `no-verify`
option.
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> create no-verify [force]
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
For example,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1 .example.com::gvol-secondary \
2020-05-16 13:06:47 +05:30
create no-verify
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
In this case the Primary node rsa-key distribution to Secondary node does
not happen and above mentioned Secondary verification is not performed and
2016-09-21 19:46:13 +05:30
these two things has to be taken care externaly.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
## Post Creation steps
2020-05-16 13:06:47 +05:30
2020-12-09 18:15:53 +05:30
Run the following command as root in any one of Secondary node.
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
/usr/libexec/glusterfs/set_geo_rep_pem_keys.sh <secondary_user> \
<primary_volume> <secondary_volume>
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
For example,
```
# /usr/libexec/glusterfs/set_geo_rep_pem_keys.sh geoaccount \
2020-12-09 18:15:53 +05:30
gvol-primary gvol-secondary
2020-05-16 13:06:47 +05:30
```
2016-09-21 19:46:13 +05:30
## Configuration
2020-05-16 13:06:47 +05:30
2016-09-21 19:46:13 +05:30
Configuration can be changed anytime after creating the session. After
successful configuration change, Geo-rep session will be automatically
restarted.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
To view all configured options of a session,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> config [option]
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
For Example,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1 .example.com::gvol-secondary \
2020-05-16 13:06:47 +05:30
config
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1 .example.com::gvol-secondary \
2020-05-16 13:06:47 +05:30
config sync-jobs
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
To configure Gluster Geo-replication, use the following command at the
Gluster command line
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> config [option]
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
For example:
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1 .example.com::gvol-secondary \
2020-05-16 13:06:47 +05:30
config sync-jobs 3
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
> **Note**: If Geo-rep is in between sync, restart due to configuration
> change may cause resyncing a few entries which are already synced.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
## Configurable Options
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
**Meta Volume**
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
In case of Replica bricks, one brick worker will be Active and
participate in syncing and others will be waiting as Passive. By
default Geo-rep uses `node-uuid` , if `node-uuid` of worker present in
first up subvolume node ids list then that worker will become
Active. With this method, multiple workers of same replica becomes
Active if multiple bricks used from same machine.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
To prevent this, Meta Volume(Extra Gluster Volume) can be used in
Geo-rep. With this method, Each worker will try to acquire lock on a
file inside meta volume. Lock file name pattern will be different for
each sub volume. If a worker acquire lock, then it will become Active
else remain as Passive.
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> config
2019-09-20 15:23:43 +05:30
use-meta-volume true
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
> **Note**: Meta Volume is shared replica 3 Gluster Volume. The name
> of the meta-volume should be `gluster_shared_storage` and should be
> mounted at `/var/run/gluster/shared_storage/`.
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
The following table provides an overview of the configurable options
for a geo-replication setting:
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Option | Description
--- | ---
2020-05-16 13:06:47 +05:30
log-level LOGFILELEVEL | The log level for geo-replication.
2016-09-21 19:46:13 +05:30
gluster-log-level LOGFILELEVEL | The log level for glusterfs processes.
changelog-log-level LOGFILELEVEL| The log level for Changelog processes.
2020-05-16 13:06:47 +05:30
ssh-command COMMAND | The SSH command to connect to the remote machine (the default is ssh). If ssh is installed in custom location, that path can be configured. For ex `/usr/local/sbin/ssh`
rsync-command COMMAND | The rsync command to use for synchronizing the files (the default is rsync).
use-tarssh true | The use-tarssh command allows tar over Secure Shell protocol. Use this option to handle workloads of files that have not undergone edits.
timeout SECONDS | The timeout period in seconds.
sync-jobs N | The number of simultaneous files/directories that can be synchronized.
2020-12-09 18:15:53 +05:30
ignore-deletes | If this option is set to 1, a file deleted on the primary will not trigger a delete operation on the secondary. As a result, the secondary will remain as a superset of the primary and can be used to recover the primary in the event of a crash and/or accidental delete.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
## Starting Geo-replication
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Use the following command to start geo-replication session,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> \
2020-05-16 13:06:47 +05:30
start [force]
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
For example,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1 .example.com::gvol-secondary \
2020-05-16 13:06:47 +05:30
start
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
> **Note**
>
> You may need to configure the session before starting Gluster
> Geo-replication.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
## Stopping Geo-replication
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Use the following command to stop geo-replication sesion,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> \
2020-05-16 13:06:47 +05:30
stop [force]
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
For example,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1 .example.com::gvol-secondary \
2020-05-16 13:06:47 +05:30
stop
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
## Status
To check the status of all Geo-replication sessions in the Cluster
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
# gluster volume geo-replication status
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
To check the status of one session,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> status [detail]
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Example,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1::gvol -secondary status
2020-05-16 13:06:47 +05:30
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1::gvol -secondary status detail
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Example Status Output
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
PRIMARY NODE PRIMARY VOL PRIMARY BRICK SECONDARY USER SECONDARY SECONDARY NODE STATUS CRAWL STATUS LAST_SYNCED
---------------------------------------------------------------------------------------------------------------------------------------------------------
mnode1 gvol-primary /bricks/b1 root snode1::gvol-secondary snode1 Active Changelog Crawl 2016-10-12 23:07:13
mnode2 gvol-primary /bricks/b2 root snode1::gvol-secondary snode2 Active Changelog Crawl 2016-10-12 23:07:13
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Example Status detail Output
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
PRIMARY NODE PRIMARY VOL PRIMARY BRICK SECONDARY USER SECONDARY SECONDARY NODE STATUS CRAWL STATUS LAST_SYNCED ENTRY DATA META FAILURES CHECKPOINT TIME CHECKPOINT COMPLETED CHECKPOINT COMPLETION TIME
2019-09-20 15:23:43 +05:30
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2020-12-09 18:15:53 +05:30
mnode1 gvol-primary /bricks/b1 root snode1::gvol-secondary snode1 Active Changelog Crawl 2016-10-12 23:07:13 0 0 0 0 N/A N/A N/A
mnode2 gvol-primary /bricks/b2 root snode1::gvol-secondary snode2 Active Changelog Crawl 2016-10-12 23:07:13 0 0 0 0 N/A N/A N/A
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
The `STATUS` of the session could be one of the following,
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
- **Initializing**: This is the initial phase of the Geo-replication
session; it remains in this state for a minute in order to make
sure no abnormalities are present.
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
- **Created**: The geo-replication session is created, but not
started.
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
- **Active**: The gsync daemon in this node is active and syncing the
data. (One worker among the replica pairs will be in Active state)
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
- **Passive**: A replica pair of the active node. The data
synchronization is handled by active node. Hence, this node does
not sync any data. If Active node goes down, Passive worker will
become Active
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
- **Faulty**: The geo-replication session has experienced a problem,
and the issue needs to be investigated further. Check log files
for more details about the Faulty status. Log file path can be
found using
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> config log-file
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
- **Stopped**: The geo-replication session has stopped, but has not
been deleted.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
The `CRAWL STATUS` can be one of the following:
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
- **Hybrid Crawl**: The gsyncd daemon is crawling the glusterFS file
system and generating pseudo changelog to sync data. This crawl is
used during initial sync and if Changelogs are not available.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
- **History Crawl**: gsyncd daemon syncs data by consuming Historical
Changelogs. On every worker restart, Geo-rep uses this Crawl to
process backlog Changelogs.
2015-05-19 12:11:52 +05:30
2020-05-16 13:06:47 +05:30
- **Changelog Crawl**: The changelog translator has produced the
changelog and that is being consumed by gsyncd daemon to sync
data.
2015-05-19 12:11:52 +05:30
2020-10-29 14:04:56 +05:30
The `ENTRY` denotes:
**The number of pending entry operations ** (create, mkdir, mknod, symlink, link, rename, unlink, rmdir) per session.
The `DATA` denotes:
**The number of pending Data operations ** (write, writev, truncate, ftruncate) per session.
The `META` denotes:
**The number of pending Meta operations ** (setattr, fsetattr, setxattr, fsetxattr, removexattr, fremovexattr) per session.
The `FAILURE` denotes:
**The number of failures per session ** . On encountering failures, one can proceed to look at the log files.
2016-09-21 19:46:13 +05:30
## Deleting the session
2020-05-16 13:06:47 +05:30
2016-09-21 19:46:13 +05:30
Established Geo-replication session can be deleted using the following
command,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> delete [force]
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
For example,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1 .example.com::gvol-secondary delete
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
> Note: If the same session is created again then syncing will resume
> from where it was stopped before deleting the session. If the
> session to be deleted permanently then use reset-sync-time option
> with delete command. For example, `gluster volume geo-replication
2020-12-09 18:15:53 +05:30
> gvol-primary geoaccount@snode1::gvol-secondary delete reset-sync-time`
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
## Checkpoint
2020-05-16 13:06:47 +05:30
2016-09-21 19:46:13 +05:30
Using Checkpoint feature we can find the status of sync with respect
to the Checkpoint time. Checkpoint completion status shows "Yes" once
Geo-rep syncs all the data from that brick which are created or
modified before the Checkpoint Time.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Set the Checkpoint using,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> config checkpoint now
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Example,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
# gluster volume geo-replication gvol-primary \
geoaccount@snode1 .example.com::gvol-secondary \
2020-05-16 13:06:47 +05:30
config checkpoint now
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
Touch the Primary mount point to make sure Checkpoint completes even
2016-09-21 19:46:13 +05:30
though no I/O happening in the Volume
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
# mount -t glusterfs <primaryhost>:<primaryvol> /mnt
2019-09-20 15:23:43 +05:30
# touch /mnt
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Checkpoint status can be checked using Geo-rep status
command. Following columns in status output gives more information
about Checkpoint
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
- **CHECKPOINT TIME**: Checkpoint Set Time
- **CHECKPOINT COMPLETED**: Yes/No/NA, Status of Checkpoint
- **CHECKPOINT COMPLETION TIME**: Checkpoint Completion Time if
completed, else N/A
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
## Log Files
2020-12-09 18:15:53 +05:30
Primary Log files are located in `/var/log/glusterfs/geo-replication`
directory in each Primary nodes. Secondary log files are located in
`/var/log/glusterfs/geo-replication-secondary` directory in Secondary nodes.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
## Gluster Snapshots and Geo-replicated Volumes
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
Gluster snapshot of Primary and Secondary should not go out of order on
restore. So while taking snapshot take snapshot of both Primary and
Secondary Volumes.
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
- Pause the Geo-replication session using,
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> pause
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
- Take Gluster Snapshot of Secondary Volume and Primary Volume(Use same
2016-09-21 19:46:13 +05:30
name for snapshots)
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
gluster snapshot create <snapname> <volname>
2019-09-20 15:23:43 +05:30
2016-09-21 19:46:13 +05:30
Example,
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
# gluster snapshot create snap1 gvol-secondary
# gluster snapshot create snap1 gvol-primary
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
- Resume Geo-replication session using,
2015-05-19 12:11:52 +05:30
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> resume
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
If we want to continue Geo-rep session after snapshot restore, we need
2020-12-09 18:15:53 +05:30
to restore both Primary and Secondary Volume and resume the Geo-replication
2016-09-21 19:46:13 +05:30
session using force option
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
gluster snapshot restore <snapname>
2020-12-09 18:15:53 +05:30
gluster volume geo-replication <primary_volume> \
<secondary_user>@<secondary_host>::<secondary_volume> resume force
2019-09-20 15:23:43 +05:30
```
2015-05-19 12:11:52 +05:30
2016-09-21 19:46:13 +05:30
Example,
2015-05-19 12:11:52 +05:30
2019-09-20 15:23:43 +05:30
```console
2020-12-09 18:15:53 +05:30
# gluster snapshot restore snap1 # Secondary Snap
# gluster snapshot restore snap1 # Primary Snap
# gluster volume geo-replication gvol-primary geoaccount@snode1::gvol-secondary \
2020-05-16 13:06:47 +05:30
resume force
2019-09-20 15:23:43 +05:30
```