The good news is that at this point you are done with the most difficult work. The cluster is operational and ready for the resources you are about to create. Consider the resources to be the services that you want the cluster to manage for you. In this case, we need three resources:
s !RESOURCETHATAUTOMATICALLYCONFIGURESONEOFTHENODESASTHE$2"$PRIMARY
node
s !RESOURCEFORTHEI3#3)TARGET
s !N)0ADDRESSTHATWILLBEUSEDBYTHEI3#3)TARGET
The IP address resource warrants some explanation. This resource is needed because the iSCSI target will roam from one server to another and back from time to time. You do want to configure the iSCSI initiators, however, with an IP address that never changes. For that reason, you are going to configure an IP address resource, and make sure that resource is started whenever the iSCSI target is started. This allows the servers that run an iSCSI initiator simply to connect to the IP address that is offered by the cluster, irrespec- tive of which particular server the iSCSI target is currently served by.
To create cluster resources, Heartbeat provides a graphical user interface named
d^[cqe. By default, this GUI is not installed, so use ]lp)capejop]hhda]np^a]p)cqe to install it now. If you prefer not to run graphical applications from your server, you can install d^[cqe on a graphical desktop. It doesn’t really matter where it runs, because you can connect from a client running d^[cqe to any server running the Heartbeat cluster software. Assuming that you have installed the da]np^a]p)cqe package on a graphical desktop, the following procedure describes how to configure cluster resources:
1. On the cluster server you want to connect to, you have to give a password to user
d]_hqopan, so use l]oos`d]_hqopan (preferably on both nodes) and give this user a password.
2. From the computer where you have installed d^[cqe, open a terminal window and enter the command d^[cqe" to start the Heartbeat GUI.
3. From the d^[cqe interface, select Connection ° Login to open a Login dialog box. Enter the following information:
sServer(:port): The IP address of one of the cluster nodes
sUser Name: The username d]_hqopan
sPassword: The password that you just assigned to user d]_hqopan
Click OK to log in, and wait a few seconds for d^[cqe to read the configuration from the server. You should then see the Linux HA Management Client window (see Figure 7-4).
4. At this point you are ready to create the first resource. Select Resources ° Add New Item (or just click the + button). In the small dialog box that asks you what Item Type you want to create, choose Native and click OK to open the Add Native Resource window (see Figure 7-5).
Figure 7-5. In this window, you can configure the resources in your cluster.
5. Create the resource that you want to be loaded first. This must be the resource that manages the DRBD, because without the DRBD, you cannot start the iSCSI initiator. In the Resource ID field, provide the name of the resource (I used `n^`
in this example). In the Belong to Group field, create a resource group (I used
klajokqn_ao]j). The three resources that you are going to create in this example depend on each other, and assigning them to a group ensures that they are always loaded on the same server and in the order in which they appear in the group. Next, in the Type box, select the `n^``eog resource type, as shown in the example in Figure 7-6.
Figure 7-6. You need the drbddisk resource type to manage which DRBD is going to be the master.
6. Click Add Parameter. In the Name field, enter the name of the DRBD that you have created. If you’ve followed the instructions from the beginning of this chapter, this should be set to `n^`,, in which case you don’t need to enter a value here. Click Add to add the resource. You will see it immediately in the d^[cqe interface, added as a part of the group in which you have created it. Its current status is jkpnqjjejc. To see if it works, right- click it and select Start. You should see that the d^[cqe
interface marks it as op]npa` and indicates on which node it is running. You can get the same information from the output of the _ni[ikj)e- command, an example of which is shown in Listing 7-16.
Listing 7-16. crm_mon -i 1 Shows Whether a Resource Is Up and, if So, on Which Node It Is Started nkkp<o]j.6z_ni[ikj)e- Nabnaodej-o*** 999999999999 H]opql`]pa`6Sa`Fqh/,-/610614.,,4 ?qnnajp@?6o]j.$a^_0_2,,)0_2/)05^-)4_0`).2354]a5_31a% .Jk`ao_kjbecqna`* -Naokqn_ao_kjbecqna`* 999999999999 Jk`a6o]j-$`]_-b^/3)b`._)0b^0)^44`),/-_b^4/35b0%6kjheja Jk`a6o]j.$a^_0_2,,)0_2/)05^-)4_0`).2354]a5_31a%6kjheja Naokqn_aCnkql6klajokqn_ao]j `n^`$da]np^a]p6`n^``eog%6Op]npa`o]j-
7. Now that you’ve verified the DRBD resource is running from the cluster per- spective, it is a good idea to look at the +lnk_+`n^` file to determine which node currently is the primary DRBD from the DRBD perspective. The output of this command should show you that one of the nodes is running as primary, as you can see in Listing 7-17. If everything is still okay, it’s time to go back to the d^[cqe
interface.
Listing 7-17. /proc/drbd Should Show One Node Is Designated as the Primary 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_o6?kjja_pa`op6Oa_kj`]nu+Lnei]nu`o6QlPk@]pa+QlPk@]pa?n))) jo6,jn63143-04`s63143-04`n6,]h6,^i6020hk6,la6,q]6,]l6, naouj_6qoa`6,+/-depo603/3/0ieooao6020op]nrejc6,`enpu6,± _d]jca`6020 ]_p[hkc6qoa`6,+.13depo6,ieooao6,op]nrejc6,`enpu6,_d]jca`6,
8. Now that the DRBD is working properly, it’s time to set up the next resource in the cluster: the IP address that the iSCSI target is going to use. Right- click the resource group you have just created, select Add New Item, choose the Item Type Native, and click OK. This opens the Add Native Resource window, in which you can specify the properties of the resource that you want to add. For the Resource ID, enter iSCSI_target_IP and make sure the resource belongs to the group you’ve just created. Next, in the Type box, select EL]``n.. In the Parameters box, you can see that a parameter with the name el and the description “IPv4 address” is automati- cally added. Click in the Value column in that same row to enter an IP address for this resource. This is the unique IP address that will be used to contact the iSCSI target, so make sure to choose an IP address that is not in use already. You’ll now see a screen similar to the example shown in Figure 7-7 (but with iSCSI_target_IP in this Resource ID field).
Figure 7-7. In the Resource ID field, make sure to enter the name of the resource as you want it to appear in the cluster.
9. With the properties of the IP address resource still visible, click Add Parameter and open the Name drop- down list. You’ll see a list of preconfigured options that you can use to configure the IP address. Typically, you’ll want to specify
_e`n[japi]og to contain the netmask, and specify je_ to identify to which network card the IP address should be bound. When specifying the netmask, make sure to use the CIDR notation—not 255.255.255.0, but 24, for example. Click Add to add the resource to the cluster configuration. You’ll see that the resource is added to the group, but is not started automatically. To start it from the d^[cqe interface, right- click it and select Start. The d^[cqe interface should now look something like Figure 7-8.