1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946
|
[[ch-admin]]
== Common administrative tasks
This chapter outlines typical administrative tasks encountered during
day-to-day operations. It does not cover troubleshooting tasks, these
are covered in detail in <<ch-troubleshooting>>.
[[s-check-status]]
=== Checking DRBD status
[[s-drbd-overview]]
==== Retrieving status with +drbd-overview+
The most convenient way to look at DRBD's status is the
indexterm:[drbd-overview]+drbd-overview+ utility.
----------------------------
# drbd-overview
0:home Connected Primary/Secondary
UpToDate/UpToDate C r--- /home xfs 200G 158G 43G 79%
1:data Connected Primary/Secondary
UpToDate/UpToDate C r--- /mnt/ha1 ext3 9.9G 618M 8.8G 7%
2:nfs-root Connected Primary/Secondary
UpToDate/UpToDate C r--- /mnt/netboot ext3 79G 57G 19G 76%
----------------------------
[[s-proc-drbd]]
==== Status information in +/proc/drbd+
indexterm:[/proc/drbd]+/proc/drbd+ is a virtual file displaying
real-time status information about all DRBD resources currently
configured. You may interrogate this file's contents using this
command:
----------------------------
$ cat /proc/drbd
version: 8.4.0 (api:1/proto:86-100)
GIT-hash: 09b6d528b3b3de50462cd7831c0a3791abc665c3 build by linbit@buildsystem.linbit, 2011-10-12 09:07:35
0: cs:Connected ro:Secondary/Secondary ds:UpToDate/UpToDate C r-----
ns:0 nr:0 dw:0 dr:656 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
1: cs:Connected ro:Primary/Secondary ds:UpToDate/UpToDate C r---
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
2: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r---
ns:0 nr:0 dw:0 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
----------------------------
The first line, prefixed with +version:+, shows the DRBD version used
on your system. The second line contains information about this
specific build.
The other four lines in this example form a block that is repeated for
every DRBD device configured, prefixed by the device minor number. In
this case, this is +0+, corresponding to the device +/dev/drbd0+.
The resource-specific output from +/proc/drbd+ contains various pieces
of information about the resource:
.+cs+ (connection state)
indexterm:[connection state]Status of the network connection. See
<<s-connection-states>>for details about the various connection
states.
.+ro+ (roles)
indexterm:[resource]Roles of the nodes. The role of the local node is
displayed first, followed by the role of the partner node shown after
the slash. See <<s-roles>>for details about the possible resource
roles.
.+ds+ (disk states)
indexterm:[disk state]State of the hard disks. Prior to the slash the
state of the local node is displayed, after the slash the state of the
hard disk of the partner node is shown. See <<s-disk-states>>for
details about the various disk states.
.Replication protocol
Replication protocol used by the resource. Either +A+, +B+ or +C+. See
<<s-replication-protocols>> for details.
.I/O Flags
Six state flags reflecting the I/O status of this resource. See
<<s-io-flags>> for a detailed explanation of these flags.
.Performance indicators
A number of counters and gauges reflecting the resource's utilization
and performance. See <<s-performance-indicators>> for details.
[[s-connection-states]]
==== Connection states
indexterm:[connection state]A resource's connection state can be
observed either by monitoring +/proc/drbd+, or by issuing the `drbdadm
cstate` command:
----------------------------
# drbdadm cstate <resource>
Connected
----------------------------
A resource may have one of the following connection states:
.+StandAlone+
indexterm:[connection state]No network configuration available. The
resource has not yet been connected, or has been administratively
disconnected (using `drbdadm disconnect`), or has dropped its
connection due to failed authentication or split brain.
.+Disconnecting+
indexterm:[connection state]Temporary state during disconnection. The
next state is +StandAlone+.
.+Unconnected+
indexterm:[connection state]Temporary state, prior to a connection
attempt. Possible next states: +WFConnection+ and +WFReportParams+.
.+Timeout+
indexterm:[connection state]Temporary state following a timeout in the
communication with the peer. Next state: +Unconnected+.
.+BrokenPipe+
indexterm:[connection state]Temporary state after the connection to
the peer was lost. Next state: +Unconnected+.
.+NetworkFailure+
indexterm:[connection state]Temporary state after the connection to
the partner was lost. Next state: +Unconnected+.
.+ProtocolError+
indexterm:[connection state]Temporary state after the connection to
the partner was lost. Next state: +Unconnected+.
.+TearDown+
indexterm:[connection state]Temporary state. The peer is closing the
connection. Next state: +Unconnected+.
.+WFConnection+
indexterm:[connection state]This node is waiting until the peer node
becomes visible on the network.
.+WFReportParams+
indexterm:[connection state]TCP connection has been established, this
node waits for the first network packet from the peer.
.+Connected+
indexterm:[connection state]A DRBD connection has been established,
data mirroring is now active. This is the normal state.
.+StartingSyncS+
indexterm:[connection state]Full synchronization, initiated by the
administrator, is just starting. The next possible states are:
+SyncSource+ or +PausedSyncS+.
.+StartingSyncT+
indexterm:[connection state]Full synchronization, initiated by the
administrator, is just starting. Next state: +WFSyncUUID+.
.+WFBitMapS+
indexterm:[connection state]Partial synchronization is just
starting. Next possible states: +SyncSource+ or +PausedSyncS+.
.+WFBitMapT+
indexterm:[connection state]Partial synchronization is just
starting. Next possible state: +WFSyncUUID+.
.+WFSyncUUID+
indexterm:[connection state]Synchronization is about to begin. Next
possible states: +SyncTarget+ or +PausedSyncT+.
.+SyncSource+
indexterm:[connection state]Synchronization is currently running, with
the local node being the source of synchronization.
.+SyncTarget+
indexterm:[connection state]Synchronization is currently running, with
the local node being the target of synchronization.
.+PausedSyncS+
indexterm:[connection state]The local node is the source of an ongoing
synchronization, but synchronization is currently paused. This may be
due to a dependency on the completion of another synchronization
process, or due to synchronization having been manually interrupted by
`drbdadm pause-sync`.
.+PausedSyncT+
indexterm:[connection state]The local node is the target of an ongoing
synchronization, but synchronization is currently paused. This may be
due to a dependency on the completion of another synchronization
process, or due to synchronization having been manually interrupted by
`drbdadm pause-sync`.
.+VerifyS+
indexterm:[connection state]On-line device verification is currently
running, with the local node being the source of verification.
.+VerifyT+
indexterm:[connection state]On-line device verification is currently
running, with the local node being the target of verification.
[[s-roles]]
==== Resource roles
indexterm:[resource]A resource's role can be observed either by
monitoring +/proc/drbd+, or by issuing the indexterm:[drbdadm]
`drbdadm role` command:
----------------------------
# drbdadm role <resource>
Primary/Secondary
----------------------------
The local resource role is always displayed first, the remote resource
role last.
You may see one of the following resource roles:
.+Primary+
The resource is currently in the primary role, and may be read from
and written to. This role only occurs on one of the two nodes, unless
<<s-dual-primary-mode,dual-primary mode>> is enabled.
.+Secondary+
The resource is currently in the secondary role. It normally receives
updates from its peer (unless running in disconnected mode), but may
neither be read from nor written to. This role may occur on one
or both nodes.
.+Unknown+
The resource's role is currently unknown. The local resource role
never has this status. It is only displayed for the peer's resource
role, and only in disconnected mode.
[[s-disk-states]]
==== Disk states
A resource's disk state can be observed either by monitoring
+/proc/drbd+, or by issuing the `drbdadm dstate` command:
----------------------------
# drbdadm dstate <resource>
UpToDate/UpToDate
----------------------------
The local disk state is always displayed first, the remote disk state
last.
Both the local and the remote disk state may be one of the following:
.+Diskless+
indexterm:[disk state]No local block device has been assigned to the
DRBD driver. This may mean that the resource has never attached to its
backing device, that it has been manually detached using `drbdadm
detach`, or that it automatically detached after a lower-level I/O
error.
.+Attaching+
indexterm:[disk state]Transient state while reading meta data.
.+Failed+
indexterm:[disk state]Transient state following an I/O failure report
by the local block device. Next state: +Diskless+.
.+Negotiating+
indexterm:[disk state]Transient state when an +Attach+ is carried out on
an already-+Connected+ DRBD device.
.+Inconsistent+
indexterm:[disk state]The data is inconsistent. This status occurs
immediately upon creation of a new resource, on both nodes (before the
initial full sync). Also, this status is found in one node (the
synchronization target) during synchronization.
.+Outdated+
indexterm:[disk state]Resource data is consistent, but
<<s-outdate,outdated>>.
.+DUnknown+
indexterm:[disk state]This state is used for the peer disk if no
network connection is available.
.+Consistent+
indexterm:[disk state]Consistent data of a node without
connection. When the connection is established, it is decided whether
the data is +UpToDate+ or +Outdated+.
.+UpToDate+
indexterm:[disk state]Consistent, up-to-date state of the data. This
is the normal state.
[[s-io-flags]]
==== I/O state flags
The I/O state flag field in +/proc/drbd+ contains information about
the current state of I/O operations associated with the
resource. There are six such flags in total, with the following
possible values:
. I/O suspension. Either +r+ for _running_ or +s+ for _suspended_
I/O. Normally +r+.
. Serial resynchronization. When a resource is awaiting
resynchronization, but has deferred this because of a +resync-after+
dependency, this flag becomes +a+. Normally +-+.
. Peer-initiated sync suspension. When resource is awaiting
resynchronization, but the peer node has suspended it for any
reason, this flag becomes +p+. Normally +-+.
. Locally initiated sync suspension. When resource is awaiting
resynchronization, but a user on the local node has suspended it,
this flag becomes +u+. Normally +-+.
. Locally blocked I/O. Normally +-+. May be one of the following
flags:
** +d+: I/O blocked for a reason internal to DRBD, such as a
transient disk state.
** +b+: Backing device I/O is blocking.
** +n+: Congestion on the network socket.
** +a+: Simultaneous combination of blocking device I/O and network congestion.
. Activity Log update suspension. When updates to the Activity Log are
suspended, this flag becomes +s+. Normally +-+.
[[s-performance-indicators]]
==== Performance indicators
The second line of +/proc/drbd+ information for each resource contains
the following counters and gauges:
.+ns+ (network send)
Volume of net data sent to the partner via the network connection; in
Kibyte.
.+nr+ (network receive)
Volume of net data received by the partner via the network connection;
in Kibyte.
.+dw+ (disk write)
Net data written on local hard disk; in Kibyte.
.+dr+ (disk read)
Net data read from local hard disk; in Kibyte.
.+al+ (activity log)
Number of updates of the activity log area of the meta data.
.+bm+ (bit map)
Number of updates of the bitmap area of the meta data.
.+lo+ (local count)
Number of open requests to the local I/O sub-system issued by DRBD.
.+pe+ (pending)
Number of requests sent to the partner, but that have not yet been
answered by the latter.
.+ua+ (unacknowledged)
Number of requests received by the partner via the network connection,
but that have not yet been answered.
.+ap+ (application pending)
Number of block I/O requests forwarded to DRBD, but not yet answered
by DRBD.
.+ep+ (epochs)
Number of epoch objects. Usually 1. Might increase under I/O load when
using either the +barrier+ or the +none+ write ordering method.
.+wo+ (write order)
Currently used write ordering method: +b+(barrier), +f+(flush),
+d+(drain) or +n+(none).
.+oos+ (out of sync)
Amount of storage currently out of sync; in Kibibytes.
[[s-enable-disable]]
=== Enabling and disabling resources
[[s-enable-resource]]
==== Enabling resources
indexterm:[resource]Normally, all configured DRBD resources are
automatically enabled
* by a cluster resource management application at its discretion,
based on your cluster configuration, or
* by the +/etc/init.d/drbd+ init script on system startup.
If, however, you need to enable resources manually for any reason, you
may do so by issuing the command
----------------------------
# drbdadm up <resource>
----------------------------
As always, you may use the keyword +all+ instead of a specific
resource name if you want to enable all resources configured in
+/etc/drbd.conf+ at once.
[[s-disable-resource]]
==== Disabling resources
indexterm:[resource]You may temporarily disable specific resources by
issuing the command
----------------------------
# drbdadm down <resource>
----------------------------
Here, too, you may use the keyword +all+ in place of a resource name if
you wish to temporarily disable all resources listed in
+/etc/drbd.conf+ at once.
[[s-reconfigure]]
=== Reconfiguring resources
indexterm:[resource]DRBD allows you to reconfigure resources while
they are operational. To that end,
* make any necessary changes to the resource configuration in
+/etc/drbd.conf+,
* synchronize your +/etc/drbd.conf+ file between both nodes,
* issue the indexterm:[drbdadm]`drbdadm adjust <resource>` command on
both nodes.
`drbdadm adjust` then hands off to `drbdsetup` to make the necessary
adjustments to the configuration. As always, you are able to review
the pending `drbdsetup` invocations by running `drbdadm` with the
+-d+ (dry-run) option.
NOTE: When making changes to the +common+ section in +/etc/drbd.conf+,
you can adjust the configuration for all resources in one run, by
issuing `drbdadm adjust all`.
[[s-switch-resource-roles]]
=== Promoting and demoting resources
indexterm:[resource]Manually switching a <<s-resource-roles,resource's
role>> from secondary to primary (promotion) or vice versa (demotion)
is done using the following commands:
----------------------------
# drbdadm primary <resource>
# drbdadm secondary <resource>
----------------------------
In <<s-single-primary-mode,single-primary mode>> (DRBD's default), any
resource can be in the primary role on only one node at any given time
while the <<s-connection-states,connection state>> is
+Connected+. Thus, issuing `drbdadm primary <resource>` on one node
while _<resource>_ is still in the primary role on the peer will
result in an error.
A resource configured to allow <<s-dual-primary-mode,dual-primary
mode>> can be switched to the primary role on both nodes.
[[s-manual-fail-over]]
=== Basic Manual Fail-over
If not using Pacemaker and looking to handle fail-overs manually in a
passive/active configuration the process is as follows.
On the current primary node stop any applications or services using the DRBD device,
unmount the DRBD device, and demote the resource to secondary.
----------------------------
# umount /dev/drbd/by-res/<resource>
# drbdadm secondary <resource>
----------------------------
Now on the node we wish to make primary promote the resource and mount the device.
----------------------------
# drbdadm primary <resource>
# mount /dev/drbd/by-res/<resource> <mountpoint>
----------------------------
[[s-upgrading-drbd]]
=== Upgrading DRBD
Upgrading DRBD is a fairly simple process. This section will cover
the process of upgrading from 8.3.x to 8.4.x, however this process
should work for all upgrades.
[[s-updating-your-repo]]
==== Updating your repository
Due to the number of changes between the 8.3 and 8.4 branches we
have created separate repositories for each. Perform this repository
update on both servers.
[[s-RHEL-systems]]
===== RHEL/CentOS systems
Edit your /etc/yum.repos.d/linbit.repo file to reflect the following
changes.
----------------------------
[drbd-8.4]
name=DRBD 8.4
baseurl=http://packages.linbit.com/<hash>/8.4/rhel6/<arch>
gpgcheck=0
----------------------------
NOTE: You will have to populate the <hash> and <arch> variables. The
<hash> is provided by LINBIT support services.
[[s-Debian-Systems]]
===== Debian/Ubuntu systems
Edit /etc/apt/sources.list to reflect the following changes.
----------------------------
deb http://packages.linbit.com/<hash>/8.4/debian squeeze main
----------------------------
NOTE: You will have to populate the <hash> variable. The
<hash> is provided by LINBIT support services.
Next you will want to add the DRBD signing key to your trusted keys.
----------------------------
# gpg --keyserver subkeys.pgp.net --recv-keys 0x282B6E23
# gpg --export -a 282B6E23 | apt-key add -
----------------------------
Lastly perform an apt-get update so Debian recognizes the updated repo.
----------------------------
apt-get update
----------------------------
[[s-Upgrading-the-packages]]
==== Upgrading the packages
Before you begin make sure your resources are in sync. The output of
'cat /proc/drbd' should show UpToDate/UpToDate.
----------------------------
bob# cat /proc/drbd
version: 8.3.12 (api:88/proto:86-96)
GIT-hash: e2a8ef4656be026bbae540305fcb998a5991090f build by buildsystem@linbit, 2011-10-28 10:20:38
0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:33300 dw:33300 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
----------------------------
Now that you know the resources are in sync, start by upgrading the
secondary node. This can be done manually or if you're using
Pacemaker put the node in standby mode. Both processes are covered
below. If you're running Pacemaker do not use the manual method.
* Manual Method
----------------------------
bob# /etc/init.d/drbd stop
----------------------------
* Pacemaker
Put the secondary node into standby mode. In this example bob is secondary.
----------------------------
bob# crm node standby bob
----------------------------
NOTE: You can watch the status of your cluster using 'crm_mon -rf' or watch
'cat /proc/drbd' until it shows "Unconfigured" for your resources.
Now update your packages with either yum or apt.
----------------------------
bob# yum upgrade
----------------------------
----------------------------
bob# apt-get upgrade
----------------------------
Once the upgrade is finished will now have the latest DRBD 8.4 kernel
module and drbd-utils on your secondary node, bob. Start DRBD.
* Manually
----------------------------
bob# /etc/init.d/drbd start
----------------------------
* Pacemaker
----------------------------
# crm node online bob
----------------------------
The output of 'cat /proc/drbd' on bob should show 8.4.x and look similar
to this.
----------------------------
version: 8.4.1 (api:1/proto:86-100)
GIT-hash: 91b4c048c1a0e06777b5f65d312b38d47abaea80 build by buildsystem@linbit, 2011-12-20 12:58:48
0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:12 dw:12 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
----------------------------
NOTE: On the primary node, alice, 'cat /proc/drbd' will still show the
prior version, until you upgrade it.
At this point the cluster has two different versions of DRBD. Stop
any service using DRBD and then DRBD on the primary node, alice, and promote
bob. Again this can be done either manually or via the Pacemaker shell.
* Manually
----------------------------
alice # umount /dev/drbd/by-res/r0
alice # /etc/init.d/drbd stop
bob # drbdadm primary r0
bob # mount /dev/drbd/by-res/r0/0 /mnt/drbd
----------------------------
Please note that the mount command now references '/0' which defines
the volume number of a resource. See <<s-recent-changes-volumes>> for
more information on the new volumes feature.
* Pacemaker
----------------------------
# crm node standby alice
----------------------------
WARNING: This will interrupt running services by stopping them and
migrating them to the secondary server, bob.
At this point you can safely upgrade DRBD by using yum or apt.
----------------------------
alice# yum upgrade
----------------------------
----------------------------
alice# apt-get upgrade
----------------------------
Once the upgrade is complete you will now have the latest version
of DRBD on alice and can start DRBD.
* Manually
----------------------------
alice# /etc/init.d/drbd start
----------------------------
* Pacemaker
----------------------------
alice# crm node online alice
----------------------------
NOTE: Services will still be located on bob and will remain there
until you migrate them back.
Both servers should now show the latest version of DRBD in a connected
state.
----------------------------
version: 8.4.1 (api:1/proto:86-100)
GIT-hash: 91b4c048c1a0e06777b5f65d312b38d47abaea80 build by buildsystem@linbit, 2011-12-20 12:58:48
0: cs:Connected ro:Secondary/Primary ds:UpToDate/UpToDate C r-----
ns:0 nr:12 dw:12 dr:0 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:b oos:0
----------------------------
==== Migrating your configs
DRBD 8.4 is backward compatible with the 8.3 configs however some
syntax has changed. See <<s-recent-changes-config>> for
a full list of changes. In the meantime you can port your old
configs fairly easily by using 'drbdadm dump all' command. This
will output both a new global config followed by the
new resource config files. Take this output and make changes
accordingly.
[[s-downgrading-drbd84]]
=== Downgrading DRBD 8.4 to 8.3
If you're currently running DRBD 8.4 and would like to revert to 8.3
there are several steps you will have to follow. This section assumes
you still have the 8.4 kernel module and 8.4 utilities installed.
Stop any services accessing the DRBD resources, unmount, and demote
the devices to Secondary. Then perform the following commands.
NOTE: These steps will have to be completed on both servers.
----------------------------
drbdadm down all
drbdadm apply-al all
rmmod drbd
----------------------------
If you're using the LINBIT repositories you can remove the packages using
`apt-get remove drbd8-utils drbd8-module-`uname -r`` or
`yum remove drbd kmod-drbd`
Now that 8.4 is removed reinstall 8.3. You can do this either by changing
your repositories back to the 8.3 repos, or by following the steps located
http://www.drbd.org/users-guide-8.3/p-build-install-configure.html[in the
8.3 User's Guide]
WARNING: If you migrated your configs to the 8.4 format be sure to revert
them back to the 8.3 format. See <<s-recent-changes-config>> for the options
you need to revert.
Once 8.3 is re-installed you can start your DRBD resources either manually
using `drbdadm` or `/etc/init.d/drbd start`.
[[s-enable-dual-primary]]
=== Enabling dual-primary mode
Dual-primary mode allows a resource to assume the primary role
simultaneously on both nodes. Doing so is possible on either a
permanent or a temporary basis.
[NOTE]
===============================
Dual-primary mode requires that the resource is configured to
replicate synchronously (protocol C). Because of this it is latency
sensitive, and ill suited for WAN environments.
Additionally, as both resources are always primary, any interruption in the
network between nodes will result in a split-brain.
===============================
[[s-enable-dual-primary-permanent]]
==== Permanent dual-primary mode
indexterm:[dual-primary mode]To enable dual-primary mode, set the
+allow-two-primaries+ option to +yes+ in the +net+ section of your
resource configuration:
[source,drbd]
----------------------------
resource <resource>
net {
protocol C;
allow-two-primaries yes;
}
...
}
----------------------------
After that, do not forget to synchronize the configuration between nodes. Run
`drbdadm adjust <resource>` on both nodes.
You can now change both nodes to role primary at the same time with `drbdadm
primary <resource>`.
[[s-enable-dual-primary-temporary]]
==== Temporary dual-primary mode
To temporarily enable dual-primary mode for a resource normally
running in a single-primary configuration, issue the following
command:
----------------------------
# drbdadm net-options --protocol=C --allow-two-primaries <resource>
----------------------------
To end temporary dual-primary mode, run the same command as above but with
+--allow-two-primaries=no+ (and your desired replication protocol, if
applicable).
==== Automating promotion on system startup
When a resource is configured to support dual-primary mode, it may
also be desirable to automatically switch the resource into the
primary role upon system (or DRBD) startup.
[source,drbd]
----------------------------
resource <resource>
startup {
become-primary-on both;
}
...
}
----------------------------
The +/etc/init.d/drbd+ system init script parses this option on
startup and promotes resources accordingly.
NOTE: The +become-primary-on+ approach is not required, nor
recommended, in <<ch-pacemaker,Pacemaker-managed>> DRBD
configurations. In Pacemaker configuration, resource promotion and
demotion should always be handled by the cluster manager.
[[s-use-online-verify]]
=== Using on-line device verification
[[s-online-verify-enable]]
==== Enabling on-line verification
indexterm:[on-line device verification]<<s-online-verify,On-line
device verification>> is not enabled for resources by default. To
enable it, add the following lines to your resource configuration in
+/etc/drbd.conf+:
[source,drbd]
----------------------------
resource <resource>
net {
verify-alg <algorithm>;
}
...
}
----------------------------
_<algorithm>_ may be any message digest algorithm supported by the
kernel crypto API in your system's kernel configuration. Normally, you
should be able to choose at least from +sha1+, +md5+, and +crc32c+.
If you make this change to an existing resource, as always,
synchronize your +drbd.conf+ to the peer, and run `drbdadm adjust
<resource>` on both nodes.
[[s-online-verify-invoke]]
==== Invoking on-line verification
indexterm:[on-line device verification]After you have enabled on-line
verification, you will be able to initiate a verification run using
the following command:
----------------------------
# drbdadm verify <resource>
----------------------------
When you do so, DRBD starts an online verification run for
_<resource>_, and if it detects any blocks not in sync, will mark
those blocks as such and write a message to the kernel log. Any
applications using the device at that time can continue to do so
unimpeded, and you may also <<s-switch-resource-roles,switch resource
roles>> at will.
If out-of-sync blocks were detected during the verification run, you
may resynchronize them using the following commands after verification
has completed:
----------------------------
# drbdadm disconnect <resource>
# drbdadm connect <resource>
----------------------------
[[s-online-verify-automate]]
==== Automating on-line verification
indexterm:[on-line device verification]Most users will want to
automate on-line device verification. This can be easily
accomplished. Create a file with the following contents, named
+/etc/cron.d/drbd-verify+ on _one_ of your nodes:
[source,drbd]
----------------------------
42 0 * * 0 root /sbin/drbdadm verify <resource>
----------------------------
This will have +cron+ invoke a device verification every Sunday at 42
minutes past midnight.
If you have enabled on-line verification for all your resources (for
example, by adding +verify-alg <algorithm>+ to the +common+ section
in +/etc/drbd.conf+), you may also use:
[source,drbd]
----------------------------
42 0 * * 0 root /sbin/drbdadm verify all
----------------------------
[[s-configure-sync-rate]]
=== Configuring the rate of synchronization
indexterm:[synchronization]Normally, one tries to ensure that
background synchronization (which makes the data on the
synchronization target temporarily inconsistent) completes as quickly
as possible. However, it is also necessary to keep background
synchronization from hogging all bandwidth otherwise available for
foreground replication, which would be detrimental to application
performance. Thus, you must configure the synchronization bandwidth to
match your hardware -- which you may do in a permanent fashion or
on-the-fly.
IMPORTANT: It does not make sense to set a synchronization rate that
is higher than the maximum write throughput on your secondary
node. You must not expect your secondary node to miraculously be able
to write faster than its I/O subsystem allows, just because it happens
to be the target of an ongoing device synchronization.
Likewise, and for the same reasons, it does not make sense to set a
synchronization rate that is higher than the bandwidth available on
the replication network.
[[s-configure-sync-rate-permanent]]
==== Permanent fixed sync rate configuration
The maximum bandwidth a resource uses for background
re-synchronization is determined by the +rate+ option
for a resource. This must be included in the resource configuration's
+disk+ section in +/etc/drbd.conf+:
[source,drbd]
----------------------------
resource <resource>
disk {
resync-rate 40M;
...
}
...
}
----------------------------
Note that the rate setting is given in _bytes_, not _bits_ per second; the
default unit is _Kibibyte_, so a value of +4096+ would be interpreted as +4MiB+.
TIP: A good rule of thumb for this value is to use about 30% of the
available replication bandwidth. Thus, if you had an I/O subsystem
capable of sustaining write throughput of 180MB/s, and a Gigabit
Ethernet network capable of sustaining 110 MB/s network throughput
(the network being the bottleneck), you would calculate:
[[eq-sync-rate-example1]]
.Syncer rate example, 110MB/s effective available bandwidth
image::sync-rate-example1[]
Thus, the recommended value for the +rate+ option would be +33M+.
By contrast, if you had an I/O subsystem with a maximum throughput of
80MB/s and a Gigabit Ethernet connection (the I/O subsystem being the
bottleneck), you would calculate:
[[eq-sync-rate-example2]]
.Syncer rate example, 80MB/s effective available bandwidth
image::sync-rate-example2[]
In this case, the recommended value for the +rate+ option would be
+24M+.
[[s-configure-sync-rate-temporary]]
==== Temporary fixed sync rate configuration
It is sometimes desirable to temporarily adjust the sync rate. For
example, you might want to speed up background re-synchronization
after having performed scheduled maintenance on one of your cluster
nodes. Or, you might want to throttle background re-synchronization if
it happens to occur at a time when your application is extremely busy
with write operations, and you want to make sure that a large portion
of the existing bandwidth is available to replication.
For example, in order to make most bandwidth of a Gigabit Ethernet
link available to re-synchronization, issue the following command:
----------------------------
# drbdadm disk-options --resync-rate=110M <resource>
----------------------------
You need to issue this command on only one of the nodes.
To revert this temporary setting and re-enable the synchronization
rate set in +/etc/drbd.conf+, issue this command:
----------------------------
# drbdadm adjust <resource>
----------------------------
[[s-configure-sync-rate-variable]]
==== Variable sync rate configuration
Specifically in configurations where multiple DRBD resources share a
single replication/synchronization network, fixed-rate synchronization
may not be an optimal approach. In this case, you should configure
variable-rate synchronization. In this mode, DRBD uses an automated
control loop algorithm to determine, and permanently adjust, the
synchronization rate. This algorithm ensures that there is always
sufficient bandwidth available for foreground replication, greatly
mitigating the impact that background synchronization has on
foreground I/O.
The optimal configuration for variable-rate synchronization may vary
greatly depending on the available network bandwidth, application I/O
pattern and link congestion. Ideal configuration settings also depend
on whether <<s-drbd-proxy,DRBD Proxy>> is in use or not. It may be
wise to engage professional consultancy in order to optimally
configure this DRBD feature. An _example_ configuration (which assumes
a deployment in conjunction with DRBD Proxy) is provided below:
[source,drbd]
----------------------------
resource <resource> {
disk {
c-plan-ahead 200;
c-max-rate 10M;
c-fill-target 15M;
}
}
----------------------------
TIP: A good starting value for +c-fill-target+ is _BDP×3_, where
BDP is your bandwidth delay product on the replication link.
[[s-configure-checksum-sync]]
=== Configuring checksum-based synchronization
indexterm:[checksum-based
synchronization]<<p-checksum-sync,Checksum-based synchronization>> is
not enabled for resources by default. To enable it, add the following
lines to your resource configuration in +/etc/drbd.conf+:
[source,drbd]
----------------------------
resource <resource>
net {
csums-alg <algorithm>;
}
...
}
----------------------------
_<algorithm>_ may be any message digest algorithm supported by the
kernel crypto API in your system's kernel configuration. Normally, you
should be able to choose at least from +sha1+, +md5+, and +crc32c+.
If you make this change to an existing resource, as always,
synchronize your +drbd.conf+ to the peer, and run `drbdadm adjust
<resource>` on both nodes.
[[s-configure-congestion-policy]]
=== Configuring congestion policies and suspended replication
In an environment where the replication bandwidth is highly variable
(as would be typical in WAN replication setups), the replication link
may occasionally become congested. In a default configuration, this
would cause I/O on the primary node to block, which is sometimes
undesirable.
Instead, you may configure DRBD to _suspend_ the ongoing replication
in this case, causing the Primary's data set to _pull ahead_ of the
Secondary. In this mode, DRBD keeps the replication channel open -- it
never switches to disconnected mode -- but does not actually replicate
until sufficient bandwith becomes available again.
The following example is for a DRBD Proxy configuration:
[source,drbd]
----------------------------
resource <resource> {
net {
on-congestion pull-ahead;
congestion-fill 2G;
congestion-extents 2000;
...
}
...
}
----------------------------
It is usually wise to set both +congestion-fill+ and
+congestion-extents+ together with the +pull-ahead+ option.
A good value for +congestion-fill+ is 90%
* of the allocated DRBD proxy buffer memory, when replicating over
DRBD Proxy, or
* of the TCP network send buffer, in non-DRBD Proxy setups.
A good value for +congestion-extents+ is 90% of your configured
+al-extents+ for the affected resources.
[[s-configure-io-error-behavior]]
=== Configuring I/O error handling strategies
indexterm:[I/O errors]indexterm:[drbd.conf]DRBD's
<<s-handling-disk-errors,strategy for handling lower-level I/O
errors>> is determined by the +on-io-error+ option, included in the
resource +disk+ configuration in +/etc/drbd.conf+:
[source,drbd]
----------------------------
resource <resource> {
disk {
on-io-error <strategy>;
...
}
...
}
----------------------------
You may, of course, set this in the +common+ section too, if you want
to define a global I/O error handling policy for all resources.
_<strategy>_ may be one of the following options:
. +detach+
This is the default and recommended option. On the occurrence of a
lower-level I/O error, the node drops its backing device, and
continues in diskless mode.
. +pass_on+
This causes DRBD to report the I/O error to the upper layers. On the
primary node, it is reported to the mounted file system. On the
secondary node, it is ignored (because the secondary has no upper
layer to report to).
. +call-local-io-error
Invokes the command defined as the local I/O error handler. This
requires that a corresponding +local-io-error+ command invocation is
defined in the resource's +handlers+ section. It is entirely left to
the administrator's discretion to implement I/O error handling using
the command (or script) invoked by +local-io-error+.
NOTE: Early DRBD versions (prior to 8.0) included another option,
+panic+, which would forcibly remove the node from the cluster by way
of a kernel panic, whenever a local I/O error occurred. While that
option is no longer available, the same behavior may be mimicked via
the +local-io-error+/+ call-local-io-error+ interface. You should do so
only if you fully understand the implications of such behavior.
You may reconfigure a running resource's I/O error handling strategy
by following this process:
* Edit the resource configuration in +/etc/drbd.d/<resource>.res+.
* Copy the configuration to the peer node.
* Issue `drbdadm adjust <resource>` on both nodes.
[[s-configure-integrity-check]]
=== Configuring replication traffic integrity checking
indexterm:[replication traffic integrity
checking]<<s-integrity-check,Replication traffic integrity checking>>
is not enabled for resources by default. To enable it, add the
following lines to your resource configuration in +/etc/drbd.conf+:
[source,drbd]
----------------------------
resource <resource>
net {
data-integrity-alg <algorithm>;
}
...
}
----------------------------
_<algorithm>_ may be any message digest algorithm supported by the
kernel crypto API in your system's kernel configuration. Normally, you
should be able to choose at least from +sha1+, +md5+, and +crc32c+.
If you make this change to an existing resource, as always,
synchronize your +drbd.conf+ to the peer, and run `drbdadm adjust
<resource>` on both nodes.
[[s-resizing]]
=== Resizing resources
[[s-growing-online]]
==== Growing on-line
indexterm:[resource]If the backing block devices can be grown while in
operation (online), it is also possible to increase the size of a DRBD
device based on these devices during operation. To do so, two criteria
must be fulfilled:
. The affected resource's backing device must be one managed by a
logical volume management subsystem, such as LVM.
. The resource must currently be in the +Connected+ connection state.
Having grown the backing block devices on both nodes, ensure that only
one node is in primary state. Then enter on one node:
----------------------------
# drbdadm resize <resource>
----------------------------
This triggers a synchronization of the new section. The
synchronization is done from the primary node to the secondary node.
If the space you're adding is clean, you can skip syncing the additional
space by using the --assume-clean option.
----------------------------
# drbdadm -- --assume-clean resize <resource>
----------------------------
[[s-growing-offline]]
==== Growing off-line
indexterm:[resource]When the backing block devices on both nodes are
grown while DRBD is inactive, and the DRBD resource is using
<<s-external-meta-data,external meta data>>, then the new size is
recognized automatically. No administrative intervention is
necessary. The DRBD device will have the new size after the next
activation of DRBD on both nodes and a successful establishment of a
network connection.
If however the DRBD resource is configured to use
<<s-internal-meta-data,internal meta data>>, then this meta data must
be moved to the end of the grown device before the new size becomes
available. To do so, complete the following steps:
WARNING: This is an advanced procedure. Use at your own discretion.
* Unconfigure your DRBD resource:
[source,drbd]
----------------------------
# drbdadm down <resource>
----------------------------
* Save the meta data in a text file prior to shrinking:
----------------------------
# drbdadm dump-md <resource> > /tmp/metadata
----------------------------
You must do this on both nodes, using a separate dump file for every
node. _Do not_ dump the meta data on one node, and simply copy the
dump file to the peer. This will not work.
* Grow the backing block device on both nodes.
* Adjust the size information ( +la-size-sect+) in the file
+/tmp/metadata+ accordingly, on both nodes. Remember that
+la-size-sect+ must be specified in sectors.
* Re-initialize the metadata area:
----------------------------
# drbdadm create-md <resource>
----------------------------
* Re-import the corrected meta data, on both nodes:
----------------------------
# drbdmeta_cmd=$(drbdadm -d dump-md <resource>)
# ${drbdmeta_cmd/dump-md/restore-md} /tmp/metadata
Valid meta-data in place, overwrite? [need to type 'yes' to confirm]
yes
Successfully restored meta data
----------------------------
NOTE: This example uses +bash+ parameter substitution. It may or may
not work in other shells. Check your +SHELL+ environment variable if
you are unsure which shell you are currently using.
* Re-enable your DRBD resource:
----------------------------
# drbdadm up <resource>
----------------------------
* On one node, promote the DRBD resource:
----------------------------
# drbdadm primary <resource>
----------------------------
* Finally, grow the file system so it fills the extended size of the
DRBD device.
[[s-shrinking-online]]
==== Shrinking on-line
WARNING: Online shrinking is only supported with external metadata.
indexterm:[resource]Before shrinking a DRBD device, you _must_ shrink
the layers above DRBD, i.e. usually the file system. Since DRBD cannot
ask the file system how much space it actually uses, you have to be
careful in order not to cause data loss.
NOTE: Whether or not the _filesystem_ can be shrunk on-line depends on
the filesystem being used. Most filesystems do not support on-line
shrinking. XFS does not support shrinking at all.
To shrink DRBD on-line, issue the following command _after_ you have
shrunk the file system residing on top of it:
[source,drbd]
----------------------------
# drbdadm resize --size=<new-size> <resource>
----------------------------
You may use the usual multiplier suffixes for _<new-size>_ (K, M, G
etc.). After you have shrunk DRBD, you may also shrink the containing
block device (if it supports shrinking).
[[s-shrinking-offline]]
==== Shrinking off-line
indexterm:[resource]If you were to shrink a backing block device while
DRBD is inactive, DRBD would refuse to attach to this block device
during the next attach attempt, since it is now too small (in case
external meta data is used), or it would be unable to find its meta
data (in case internal meta data is used). To work around these
issues, use this procedure (if you cannot use
<<s-shrinking-online,on-line shrinking>>):
WARNING: This is an advanced procedure. Use at your own discretion.
* Shrink the file system from one node, while DRBD is still
configured.
* Unconfigure your DRBD resource:
----------------------------
# drbdadm down <resource>
----------------------------
* Save the meta data in a text file prior to shrinking:
----------------------------
# drbdadm dump-md <resource> > +/tmp/metadata+
----------------------------
You must do this on both nodes, using a separate dump file for every
node. _Do not_ dump the meta data on one node, and simply copy the dump
file to the peer. This will not work.
* Shrink the backing block device on both nodes.
* Adjust the size information ( +la-size-sect+) in the file
+/tmp/metadata+ accordingly, on both nodes. Remember that
+la-size-sect+ must be specified in sectors.
* _Only if you are using internal metadata_ (which at this time have
probably been lost due to the shrinking process), re-initialize the
metadata area:
----------------------------
# drbdadm create-md <resource>
----------------------------
* Re-import the corrected meta data, on both nodes:
----------------------------
# drbdmeta_cmd=$(drbdadm -d dump-md <resource>)
# ${drbdmeta_cmd/dump-md/restore-md} /tmp/metadata
Valid meta-data in place, overwrite? [need to type 'yes' to confirm]
yes
Successfully restored meta data
----------------------------
NOTE: This example uses +bash+ parameter substitution. It may or may not
work in other shells. Check your +SHELL+ environment variable if you
are unsure which shell you are currently using.
* Re-enable your DRBD resource:
----------------------------
# drbdadm up <resource>
----------------------------
[[s-disable-flushes]]
=== Disabling backing device flushes
CAUTION: You should only disable device flushes when running DRBD on
devices with a battery-backed write cache (BBWC). Most storage
controllers allow to automatically disable the write cache when the
battery is depleted, switching to write-through mode when the battery
dies. It is strongly recommended to enable such a feature.
Disabling DRBD's flushes when running without BBWC, or on BBWC with a
depleted battery, is _likely to cause data loss_ and should not be
attempted.
DRBD allows you to enable and disable <<s-disk-flush-support,backing
device flushes>> separately for the replicated data set and DRBD's own
meta data. Both of these options are enabled by default. If you wish
to disable either (or both), you would set this in the +disk+ section
for the DRBD configuration file, +/etc/drbd.conf+.
To disable disk flushes for the replicated data set, include the
following line in your configuration:
[source,drbd]
----------------------------
resource <resource>
disk {
disk-flushes no;
...
}
...
}
----------------------------
To disable disk flushes on DRBD's meta data, include the following
line:
[source,drbd]
----------------------------
resource <resource>
disk {
md-flushes no;
...
}
...
}
----------------------------
After you have modified your resource configuration (and synchronized
your +/etc/drbd.conf+ between nodes, of course), you may enable these
settings by issuing this command on both nodes:
----------------------------
# drbdadm adjust <resource>
----------------------------
[[s-configure-split-brain-behavior]]
=== Configuring split brain behavior
[[s-split-brain-notification]]
==== Split brain notification
DRBD invokes the +split-brain+ handler, if configured, at any time
split brain is _detected_. To configure this handler, add the
following item to your resource configuration:
----------------------------
resource <resource>
handlers {
split-brain <handler>;
...
}
...
}
----------------------------
_<handler>_ may be any executable present on the system.
The DRBD distribution contains a split brain handler script that
installs as +/usr/lib/drbd/notify-split-brain.sh+. It simply sends a
notification e-mail message to a specified address. To configure the
handler to send a message to +root@localhost+ (which is expected to be
an email address that forwards the notification to a real system
administrator), configure the +split-brain handler+as follows:
----------------------------
resource <resource>
handlers {
split-brain "/usr/lib/drbd/notify-split-brain.sh root";
...
}
...
}
----------------------------
After you have made this modification on a running resource (and
synchronized the configuration file between nodes), no additional
intervention is needed to enable the handler. DRBD will simply invoke
the newly-configured handler on the next occurrence of split brain.
[[s-automatic-split-brain-recovery-configuration]]
==== Automatic split brain recovery policies
In order to be able to enable and configure DRBD's automatic split
brain recovery policies, you must understand that DRBD offers several
configuration options for this purpose. DRBD applies its split brain
recovery procedures based on the number of nodes in the Primary role
at the time the split brain is detected. To that end, DRBD examines
the following keywords, all found in the resource's +net+ configuration
section:
.+after-sb-0pri+
Split brain has just been detected, but at this time the resource is
not in the Primary role on any host. For this option, DRBD understands
the following keywords:
* +disconnect+: Do not recover automatically, simply invoke the
+split-brain+ handler script (if configured), drop the connection and
continue in disconnected mode.
* +discard-younger-primary+: Discard and roll back the modifications
made on the host which assumed the Primary role last.
* +discard-least-changes+: Discard and roll back the modifications on
the host where fewer changes occurred.
* +discard-zero-changes+: If there is any host on which no changes
occurred at all, simply apply all modifications made on the other
and continue.
.+after-sb-1pri+
Split brain has just been detected, and at this time the resource is
in the Primary role on one host. For this option, DRBD understands the
following keywords:
* +disconnect+: As with +after-sb-0pri+, simply invoke the
+split-brain+ handler script (if configured), drop the connection
and continue in disconnected mode.
* +consensus+: Apply the same recovery policies as specified in
+after-sb-0pri+. If a split brain victim can be selected after
applying these policies, automatically resolve. Otherwise, behave
exactly as if +disconnect+ were specified.
* +call-pri-lost-after-sb+: Apply the recovery policies as specified
in +after-sb-0pri+. If a split brain victim can be selected after
applying these policies, invoke the +pri-lost-after-sb+ handler on
the victim node. This handler must be configured in the
+handlers+ section and is expected to forcibly remove the node from
the cluster.
* +discard-secondary+: Whichever host is currently in the Secondary
role, make that host the split brain victim.
+after-sb-2pri+.
Split brain has just been detected, and at this time the resource is
in the Primary role on both hosts. This option accepts the same
keywords as +after-sb-1pri+ except +discard-secondary+ and +consensus+.
NOTE: DRBD understands additional keywords for these three options,
which have been omitted here because they are very rarely used. Refer
to +drbd.conf(5)+ for details on split brain recovery keywords not
discussed here.
For example, a resource which serves as the block device for a GFS or
OCFS2 file system in dual-Primary mode may have its recovery policy
defined as follows:
----------------------------
resource <resource> {
handlers {
split-brain "/usr/lib/drbd/notify-split-brain.sh root"
...
}
net {
after-sb-0pri discard-zero-changes;
after-sb-1pri discard-secondary;
after-sb-2pri disconnect;
...
}
...
}
----------------------------
[[s-three-nodes]]
=== Creating a three-node setup
A three-node setup involves one DRBD device _stacked_ atop another.
[[s-stacking-considerations]]
==== Device stacking considerations
The following considerations apply to this type of setup:
* The stacked device is the active one. Assume you have configured one
DRBD device +/dev/drbd0+, and the stacked device atop it is
+/dev/drbd10+, then +/dev/drbd10+ will be the device that you mount
and use.
* Device meta data will be stored twice, on the underlying DRBD device
_and_ the stacked DRBD device. On the stacked device, you must always
use <<s-internal-meta-data,internal meta data>>. This means that the
effectively available storage area on a stacked device is slightly
smaller, compared to an unstacked device.
* To get the stacked upper level device running, the underlying device
must be in the primary role.
* To be able to synchronize the backup node, the stacked device on the
active node must be up and in the primary role.
[[s-three-node-config]]
==== Configuring a stacked resource
In the following example, nodes are named +alice+, +bob+, and
+charlie+, with +alice+ and +bob+ forming a two-node cluster, and
+charlie+ being the backup node.
[source,drbd]
----------------------------
resource r0 {
net {
protocol C;
}
on alice {
device /dev/drbd0;
disk /dev/sda6;
address 10.0.0.1:7788;
meta-disk internal;
}
on bob {
device /dev/drbd0;
disk /dev/sda6;
address 10.0.0.2:7788;
meta-disk internal;
}
}
resource r0-U {
net {
protocol A;
}
stacked-on-top-of r0 {
device /dev/drbd10;
address 192.168.42.1:7788;
}
on charlie {
device /dev/drbd10;
disk /dev/hda6;
address 192.168.42.2:7788; # Public IP of the backup node
meta-disk internal;
}
}
----------------------------
As with any +drbd.conf+ configuration file, this must be distributed
across all nodes in the cluster -- in this case, three nodes. Notice
the following extra keyword not found in an unstacked resource
configuration:
.+stacked-on-top-of+
This option informs DRBD that the resource which contains it is a
stacked resource. It replaces one of the +on+ sections normally found
in any resource configuration. Do not use +stacked-on-top-of+ in an
lower-level resource.
NOTE: It is not a requirement to use <<fp-protocol-a,Protocol A>> for
stacked resources. You may select any of DRBD's replication protocols
depending on your application.
[[s-three-node-enable]]
==== Enabling stacked resources
To enable a stacked resource, you first enable its lower-level
resource and promote it:
----------------------------
drbdadm up r0
drbdadm primary r0
----------------------------
As with unstacked resources, you must create DRBD meta data on the
stacked resources. This is done using the following command:
----------------------------
# drbdadm create-md --stacked r0-U
----------------------------
Then, you may enable the stacked resource:
---------------------------
# drbdadm up --stacked r0-U
# drbdadm primary --stacked r0-U
----------------------------
After this, you may bring up the resource on the backup node, enabling
three-node replication:
----------------------------
# drbdadm create-md r0-U
# drbdadm up r0-U
----------------------------
In order to automate stacked resource management, you may integrate
stacked resources in your cluster manager configuration. See
<<s-pacemaker-stacked-resources>> for information on doing this in a
cluster managed by the Pacemaker cluster management framework.
[[s-using-drbd-proxy]]
=== Using DRBD Proxy
[[s-drbd-proxy-deployment-considerations]]
==== DRBD Proxy deployment considerations
The <<s-drbd-proxy,DRBD Proxy>> processes can either be located
directly on the machines where DRBD is set up, or they can be placed
on distinct dedicated servers. A DRBD Proxy instance can serve as a
proxy for multiple DRBD devices distributed across multiple nodes.
DRBD Proxy is completely transparent to DRBD. Typically you will
expect a high number of data packets in flight, therefore the activity
log should be reasonably large. Since this may cause longer re-sync
runs after the crash of a primary node, it is recommended to enable
DRBD's +csums-alg+ setting.
[[s-drbd-proxy-installation]]
==== Installation
To obtain DRBD Proxy, please contact your Linbit sales
representative. Unless instructed otherwise, please always use the
most recent DRBD Proxy release.
To install DRBD Proxy on Debian and Debian-based systems, use the dpkg
tool as follows (replace version with your DRBD Proxy version, and
architecture with your target architecture):
----------------------------
# dpkg -i drbd-proxy_3.0.0_amd64.deb
----------------------------
To install DRBD Proxy on RPM based systems (like SLES or RHEL) use
the rpm tool as follows (replace version with your DRBD Proxy version,
and architecture with your target architecture):
----------------------------
# rpm -i drbd-proxy-3.0-3.0.0-1.x86_64.rpm
----------------------------
Also install the DRBD administration program drbdadm since it is
required to configure DRBD Proxy.
This will install the DRBD proxy binaries as well as an init script
which usually goes into +/etc/init.d+. Please always use the init
script to start/stop DRBD proxy since it also configures DRBD Proxy
using the +drbdadm+ tool.
[[s-drbd-proxy-license]]
==== License file
When obtaining a license from Linbit, you will be sent a DRBD Proxy
license file which is required to run DRBD Proxy. The file is called
+drbd-proxy.license+, it must be copied into the +/etc+ directory of the
target machines, and be owned by the user/group +drbdpxy+.
----------------------------
# cp drbd-proxy.license /etc/
----------------------------
[[s-drbd-proxy-configuration]]
==== Configuration
DRBD Proxy is configured in DRBD's main configuration file. It is
configured by an additional options section called +proxy+ and
additional +proxy on+ sections within the host sections.
Below is a DRBD configuration example for proxies running directly on
the DRBD nodes:
[source,drbd]
----------------------------
resource r0 {
net {
protocol A;
}
device minor 0;
disk /dev/sdb1;
meta-disk /dev/sdb2;
proxy {
memlimit 100M;
plugin {
zlib level 9;
}
}
on alice {
address 127.0.0.1:7789;
proxy on alice {
inside 127.0.0.1:7788;
outside 192.168.23.1:7788;
}
}
on bob {
address 127.0.0.1:7789;
proxy on bob {
inside 127.0.0.1:7788;
outside 192.168.23.2:7788;
}
}
}
----------------------------
The +inside+ IP address is used for communication between DRBD and the
DRBD Proxy, whereas the +outside+ IP address is used for communication
between the proxies.
[[s-drbd-proxy-controlling]]
==== Controlling DRBD Proxy
+drbdadm+ offers the +proxy-up+ and +proxy-down+ subcommands to
configure or delete the connection to the local DRBD Proxy process of
the named DRBD resource(s). These commands are used by the +start+ and
+stop+ actions which +/etc/init.d/drbdproxy+ implements.
The DRBD Proxy has a low level configuration tool, called
+drbd-proxy-ctl+. When called without any option it operates in
interactive mode.
To pass a command directly, avoiding interactive mode, use
the '-c' parameter followed by the command.
To display the available commands use:
----------------------------
# drbd-proxy-ctl -c "help"
----------------------------
Note the double quotes around the command being passed.
[source,drbd]
----------------------------
add connection <name> <listen-lan-ip>:<port> <remote-proxy-ip>:<port>
<local-proxy-wan-ip>:<port> <local-drbd-ip>:<port>
Creates a communication path between two DRBD instances.
set memlimit <name> <memlimit-in-bytes>
Sets memlimit for connection <name>
del connection <name>
Deletes communication path named name.
show
Shows currently configured communication paths.
show memusage
Shows memory usage of each connection.
show [h]subconnections
Shows currently established individual connections
together with some stats. With h outputs bytes in human
readable format.
show [h]connections
Shows currently configured connections and their states
With h outputs bytes in human readable format.
shutdown
Shuts down the drbd-proxy program. Attention: this
unconditionally terminates any DRBD connections running.
Examples:
drbd-proxy-ctl -c "list hconnections"
prints configured connections and their status to stdout
Note that the quotes are required.
drbd-proxy-ctl -c "list subconnections" | cut -f 2,9,13
prints some more detailed info about the individual connections
watch -n 1 'drbd-proxy-ctl -c "show memusage"'
monitors memory usage.
Note that the quotes are required as listed above.
----------------------------
While the commands above are only accepted from UID 0 (ie., the +root+ user),
there's one (information gathering) command that can be used by any user
(provided that unix permissions allow access on the proxy socket at
+/var/run/drbd-proxy/drbd-proxy-ctl.socket+); see the init script at
+/etc/init.d/drbdproxy+ about setting the rights.
----------------------------
print details
This prints detailed statistics for the currently active connections.
Can be used for monitoring, as this is the only command that may be sent by a user with UID
quit
Exits the client program (closes control connection).
----------------------------
[[s-drbd-proxy-plugins]]
==== About DRBD Proxy plugins
Since DRBD proxy 3.0 the proxy allows to enable a few specific
plugins for the WAN connection. +
The currently available plugins are +zlib+ and
+lzma+.
The +zlib+ plugin uses the GZIP algorithm for compression.
The advantage is fairly low CPU usage.
The +lzma+ plugin uses the liblzma2 library. It can
use dictionaries of several hundred MiB; these allow for very
efficient delta-compression of repeated data, even for small changes.
+lzma+ needs much more CPU and memory, but results in much better
compression than +zlib+. The +lzma+ plugin has to be enabled in your license.
Please contact Linbit to find the best settings for your environment - it
depends on the CPU (speed, threading count), memory, input and
the available output bandwidth.
Please note that the older +compression on+ in the
+proxy+ section is deprecated, and will be removed in
a future release. +
Currently it is treated as +zlib level 9+.
[[s-drbd-proxy-bwlimit]]
==== Using a WAN Side Bandwidth Limit
With DRBD-utils 8.4.4 and DRBD Proxy version 3.1.1 there is experimental
support for a per-connection bandwidth limit in the proxy configuration
section, via the the +bwlimit+ option.
This will make the corresponding sending thread sleep a bit after sending
a chunk of data, to use not more than (approximately) the specified bandwidth.
// Please note that, to avoid surplus CPU load, the sending happens in pieces of up to two seconds' worth
The value +0+ means _no_ limitation, and is the default.
--------------------------
proxy {
bwlimit 2M;
...
}
--------------------------
The example above would restrict the outgoing rate over the WAN connection to
approximately 2MiB per second, leaving room on the wire for other data.
[[s-drbd-proxy-troubleshoot]]
==== Troubleshooting
DRBD proxy logs via syslog using the +LOG_DAEMON+ facility. Usually
you will find DRBD Proxy messages in +/var/log/daemon.log+.
Enabling debug mode in DRBD Proxy can be done with the following command.
--------------------------
# drbd-proxy-ctl -c 'set loglevel debug'
--------------------------
For example, if proxy fails to connect it will log something like
+Rejecting connection because I can't connect on the other side+. In
that case, please check if DRBD is running (not in StandAlone mode) on
both nodes and if both proxies are running. Also double-check your
configuration.
|