Ceph Block Device mirroring
RADOS Block Device (RBD) mirroring is a process of asynchronous replication of Ceph Block Device images between two or more Ceph storage clusters. By locating a Ceph storage cluster in different geographic locations, RBD Mirroring can help you recover from a site disaster. Journal-based Ceph block device mirroring ensures point-in-time consistent replicas of all changes to an image, including reads and writes, block device resizing, snapshots, clones and flattening.
The rbd-mirror daemon is responsible for synchronizing images from one Ceph
storage cluster to another Ceph storage cluster by pulling changes from the remote primary image and
writes those changes to the local, non-primary image. The rbd-mirror daemon can run
either on a single Ceph storage cluster for one-way mirroring or on two Ceph storage clusters for
two-way mirroring that participate in the mirroring relationship.
For RBD mirroring to work, either using one-way or two-way replication, a couple of assumptions are made:
-
A pool with the same name exists on both storage clusters.
-
A pool contains journal-enabled images you want to mirror.
rbd-mirror must be able to connect to the other Ceph storage cluster
simultaneously. Additionally, the network must have sufficient bandwidth between the two data center
sites to handle mirroring.One-way replication
One-way mirroring implies that a primary image or pool of images in one storage cluster gets replicated to a secondary storage cluster. One-way mirroring also supports replicating to multiple secondary storage clusters.
On the secondary storage cluster, the image is the non-primary replicate; that is, Ceph clients
cannot write to the image. When data is mirrored from a primary storage cluster to a secondary
storage cluster, the rbd-mirror runs ONLY on the secondary storage cluster.
For one-way mirroring to work, a couple of assumptions are made:
-
You have two Ceph storage clusters and you want to replicate images from a primary storage cluster to a secondary storage cluster.
-
The secondary storage cluster has a Ceph client node attached to it running the
rbd-mirrordaemon. Therbd-mirrordaemon will connect to the primary storage cluster to sync images to the secondary storage cluster.
Two-way replication
Two-way replication adds an rbd-mirror daemon on the primary cluster so images
can be demoted on it and promoted on the secondary cluster. Changes can then be made to the images
on the secondary cluster and they will be replicated in the reverse direction, from secondary to
primary. Both clusters must have rbd-mirror running to allow promoting and demoting
images on either cluster. Currently, two-way replication is only supported between two sites.
For two-way mirroring to work, a couple of assumptions are made:
-
You have two storage clusters and you want to be able to replicate images between them in either direction.
-
Both storage clusters have a client node attached to them running the
rbd-mirrordaemon. Therbd-mirrordaemon running on the secondary storage cluster will connect to the primary storage cluster to synchronize images to secondary, and therbd-mirrordaemon running on the primary storage cluster will connect to the secondary storage cluster to synchronize images to primary.
Mirroring modes
Mirroring is configured on a per-pool basis with mirror peering storage clusters. Ceph supports two mirroring modes, depending on the type of images in the pool.
Pool Mode
All images in a pool with the journaling feature enabled are mirrored.
Image Mode
Only a specific subset of images within a pool are mirrored. You must
enable mirroring for each image separately.
Image states
Whether or not an image can be modified depends on its state:
-
Images in the primary state can be modified.
-
Images in the non-primary state cannot be modified.
Images are automatically promoted to primary when mirroring is first enabled on an image. The promotion can happen:
-
Implicitly by enabling mirroring in pool mode.
-
Explicitly by enabling mirroring of a specific image.
It is possible to demote primary images and promote non-primary images.