A semi-common maintenance concern regarding synchronized devices is verification. The question we should always ask ourselves in a high-availability scenario is how confident we are that data on both nodes match.
The drbdadm
utility provides a parameter specifically for addressing this need. However, there are some caveats to consider when using it, which we will explain in this recipe.
Follow the recipes defined in all previous sections before starting here. At the very least, we need a fully-operational DRBD node pair to follow this recipe.
Follow these steps as the root
user on pg1
:
resource
section defined in /etc/drbd.d/pg.res
:net { verify-alg md5; }
drbdadm adjust pg
drbdadm verify pg
/proc/drbd
until verification is complete:watch cat /proc/drbd
drbdadm disconnect pg drbdadm connect pg
Our first job is to define what we mean by verify. By default, DRBD is somewhat minimal, and it has no default for the algorithm it should use for checksum comparisons. The verify-alg
setting is a network-oriented value and defines how DRBD should compare data segments. We also know md5
as a widely-used checksum algorithm. Thus, we set the verify-alg
in a net
block within the resource
definition for pg
.
Afterwards, we need to reread the configuration files so that the verify-alg
setting is defined for the verification step. By invoking drbdadm
with the adjust
parameter, it will read and apply any valid changes we made to /etc/drbd.d/pg.res
. When we're ready, we can launch the verification process by calling drbdadm
with the verify
parameter. Due to the CPU overhead of md5
, this will be noticeably slower than a full device synchronization. We can watch its progress by paying attention to /proc/drbd
:
We can see that our example verification is 26.8%
complete, with an estimated completion time of almost 2 minutes. The estimate is produced based on network speed, md5
speed, and the amount of remaining data. These details can fluctuate frequently, as writes to the DRBD device slow down the verification process.
The last step is to disconnect, then reconnect the pg
resource from the DRBD network. During verification, DRBD marks blocks that have unmatched md5
checksums, but does not resend them until a new connection is established. We can't speculate about the reason for this step, but it is required to correct errors.
18.217.164.143