It’s time to take the first real step in the SAN configuration and set up the DRBD. Make sure that you have a storage device available on each of the servers involved in setting up the SAN. In this chapter, I’ll assume that the name of the storage device is +`ar+o`^. To configure the DRBD, you have to create the file +ap_+`n^`*_kjb, an example of which is shown in Listing 7-1. You can remove its contents and replace it with your own configuration.
Listing 7-1. The DRBD Is Configured from /etc/drbd.conf
o]j-6+ap__]p`n^`*_kjb ^acejnaokqn_a`n^`, naokqn_a`n^`,w lnkpk_kh?7 op]npqlw`acn)sb_)peiakqp-.,7y `eogwkj)ek)annkn`ap]_d7y japwy ouj_anw n]pa-,,i7 ]h)atpajpo.137 y kjo]j-w `are_a+`ar+`n^`,7 `eog+`ar+o`^7 ]``naoo-5.*-24*-*./,633447 iap])`eogejpanj]h7 y kjo]j.w `are_a+`ar+`n^`,7 `eog+`ar+o`^7 ]``naoo-5.*-24*-*.0,633447 iap])`eogejpanj]h7 y y aj`naokqn_a`n^`,
In this example configuration file, one DRBD is configured, named +`ar+`n^`,. The configuration file starts with the definition of the resource `n^`,. If you would like to add another resource that has the name `n^`-, you would add the naokqn_a`n^`-w***y
specification later in the file. Each resource starts with some generic settings, the first of which is always the protocol setting. There are three protocols, A, B, and C, and of the three, protocol C offers the best performance. Next, there are four generic parts in the configuration:
sop]npql: Defines parameters that play a role during the startup phase of the DRBD. As you can see, there is just one parameter here, specifying that a timeout of 120 seconds is used. After this timeout, if a device fails to start, the software assumes that it is not available and tries periodically later to start it.
s`eog: Specifies what has to happen when a disk error occurs. The current setting
kn)ek)annkn`ap]_d makes sure that the disk device is no longer used if there is an error. This is the only parameter that you’ll really need in this section of the setup.
sjap: Contains parameters that are used for tuning network performance. If you really need the best performance, using i]t)^qbbano.,04 makes sense here. This parameter makes sure that the DRBD is capable of handling 2048 simultaneous requests, instead of the default of 32. This allows your DRBD to function well in an environment in which lots of simultaneous requests occur.
souj_an: Defines how synchronization between the two nodes will occur. First, the synchronization rate is defined. In the example shown in Listing 7-1, synchroniza- tion will happen at 100 MBps (note the setting is in megabytes, not megabits). To get the most out of your gigabit connection, you would set it to -,,i (i.e., almost 1 Gbps), but you should only do this if you have a dedicated network card for syn- chronization. The parameter ]h)atpajpo.13 defines the so- called active group, a collection of storage that the DRBD handles simultaneously. The syncer works on one active group at the same time, and this parameter defines an active group of 257 extents of 4 MB each. This creates an active group that is 1 GB, which is fine in all cases. You shouldn’t have to change this parameter.
After the generic settings in +ap_+`n^`*_kjb comes the part where you define node- specific settings. In the example shown in Listing 7-1, I used two nodes, o]j- and
o]j.. Each node has four lines in its definition:
sThe name of the DRBD that will be created: It should be +`ar+`n^`, in all cases for the first device that you configure.
sThe IP address and port of each of the two servers that participate in the DRBD con- figuration: Make sure that you are using a fixed IP address here, to eliminate the risk that the IP address could suddenly change. Every DRBD needs its own port, so if you are defining a +`ar+`n^`- resource later in the file, it should have a unique port. Typically, the first DRBD has port 7788, the second device has 7789, and so on.
sThe parameter that defines how to handle metadata : You should use the param- eter iap])`eogejpanj]h. This parameter does well in most cases, so you don’t need to change it.
This completes the configuration of the DRBD. Now you need to copy the +ap_+`n^`* _kjb file to the other server. The following command shows you how to copy the `n^`*_kjb
file from the current server to the +ap_ directory on the server o]j.:
o_l+ap_+`n^`*_kjbo]j.6+ap_+
Now that you have configured both servers, it’s time to start the DRBD for the first time. This involves the following steps:
1. Make sure that the DRBD resource is stopped on both servers. Do this by entering the following command on both servers:
+ap_+ejep*`+`n^`opkl
2. Create the device and its associated metadata, on both nodes. To do so, run the
`n^`]`i_na]pa)i``n^`, command. Listing 7-2 shows an example of its output.
Listing 7-2. Creating the DRBD
nkkp<o]j-6z`n^`]`i_na]pa)i``n^`, r,4I]ce_jqi^anjkpbkqj` i`[kbboap/55551.452, ]h[kbboap/5555052-5. ^i[kbboap/5554.3-044 Bkqj`okia`]p] 99:Pdeoiecdp`aopnkuateopejc`]p]899 @kukqs]jppklnk_aa`; Wjaa`pkpula#uao#pk_kjbeniYuao
r,3I]ce_jqi^anjkpbkqj` r,3I]ce_jqi^anjkpbkqj` r,4I]ce_jqi^anjkpbkqj` Snepejciap]`]p]*** ejepe]heoejc]_perepuhkc JKPejepe]heva`^epi]l Jas`n^`iap]`]p]^hk_goq_aoobqhhu_na]pa`* ))99?na]pejciap]`]p]99)) =osepdjk`aosa_kqjppdapkp]hjqi^ankb`are_aoiennkna`^u@N>@]p ]pdppl6++qo]ca*`n^`*knc* Pda_kqjpanskngo_kilhapahu]jkjuikqo*=n]j`kijqi^ancapo_na]pa`bkn pdeo`are_a(]j`pd]pn]j`kianjqi^an]j`pda`are_aooevasehh^aoajp* dppl6++qo]ca*`n^`*knc+_ce)^ej+ejoanp[qo]ca*lh;jq9.,0,,.,120-1.2.20,-"nq± 9-,45/240/43225-5/342"no9/55551/220, Ajpan#jk#pkklpkqp(knfqoplnaooWnapqnjYpk_kjpejqa6 oq__aoo
3. Make sure the `n^` module is loaded on both nodes, and then associate the DRBD resource with its backing device:
ik`lnk^a`n^` `n^`]`i]pp]_d`n^`,
4. Connect the DRBD resource with its counterpart on the other node in the setup:
`n^`]`i_kjja_p`n^`,
5. The DRBD should run properly on both nodes now. You can verify this by using the +lnk_+`n^` file. Listing 7-3 shows an example of what it should look like at this point.
6. As you can see, the DRBD is set up now, but both nodes at this stage are config- ured as secondary in the DRBD setup, and no synchronization is happening yet. To start synchronization and configure one node as primary, use the following command on one of the nodes:
`n^`]`i))))kransnepa)`]p])kb)laanlnei]nu`n^`,
This starts synchronization from the node where you enter this command to the other node.
NCaution
At this point, you will start erasing all data on the other node, so make sure that this is really what you want to do.7. Now that the DRBD is set up and has started its synchronization, it’s a good idea to verify that this is really happening, by looking at +lnk_+`n^` once more. Listing 7-4 shows an example of what it should look like at this point. It will take some time for the device to synchronize completely. Up to that time, the device is marked as inconsistent. That doesn’t really matter at this point, as long as it is up and works.
Listing 7-4. Verify Everything Is Working Properly by Monitoring /proc/drbd
nkkp<o]j-6z_]p+lnk_+`n^` ranoekj64*,*--$]le642+lnkpk642% CEP)d]od6^/ba.^`b`/^5b3_.b5./-4244/a^5a.],`/]1^-^^qeh`^uldeh<iao_]h(± .,,4),.)-.--61260/ ,6_o6Ouj_Okqn_aop6Lnei]nu+Oa_kj`]nu`o6QlPk@]pa+Ej_kjoeopajp?n))) jo62.-00jn6,`s6,`n62.-00]h6,^i6/hk6,la6,q]6,]l6, W:********************Youj_#a`6,*.!$/4,40+/4-01%I bejeod6-46,/6-3olaa`60,,$/.,%G+oa_ naouj_6qoa`6,+/-depo6/44,ieooao60op]nrejc6,`enpu6,_d]jca`60 ]_p[hkc6qoa`6,+.13depo6,ieooao6,op]nrejc6,`enpu6,_d]jca`6,
In the next section you’ll learn how to configure the iSCSI target to provide access to the DRBD from other nodes.