Pagine

Linux - HA (High Availability) su Centos - P. 3 - Configuriamo DRBD per il Cluster

1) Supponiamo di avere installato DRBD e questi è funzionante su entrmabi i server

2) [root@www1 ~]# /etc/rc.d/init.d/heartbeat stop

Stopping High-Availability services:
[  OK  ]

3) [root@www1 ~]# cd /var/lib/heartbeat/crm


4) [root@www1 crm]# rm -f cib.xml.*

5) [root@www1 crm]# vi cib.xml

  
    
      
        
          
        
      
    
    
      
      
    
     <= remove
# add these lines for DRBD
    
      
        
          
            
            
            
            
            
             
          
        
        
          
             
               # specify resource "value=" that is set on DRBD section
              
            
          
        
      
      
        
          
        
        
          
             
             # specify mount point "value=xxx"
            
             # specify device "value=xxx" that is set on DRBD section
             
          
        
      
    
    
      
        
           # specify primary node "value=xxx" that is set on DRBD section
          
         
      
      
      
    
       <= remove
  




6) [root@www1 crm]# /etc/init.d/heartbeat start
Starting High-Availability services:
[  OK  ]


7) Eseguire crm_mon dopo che è passato un po di tempo, dopodichè dovrebbe apparire il listato seguente dicendo che è tutto ok. In questo momento DRBD è controllato tramite l’heartbeat ed il disco è montato automaticamente sul nodo primario come di seguito

8) [root@www1 crm]# crm_mon -i 3

Defaulting to one-shot mode
You need to have curses available at compile time to enable console mode

============
Last updated: Wed Jun 18 23:16:41 2010
Current DC: www2.instyle.locale (f8719a77-70b4-4e5f-851b-dafa7d65d3a2)
2 Nodes configured.
2 Resources configured.
============

Node: www1. instyle.locale (2bbd6408-ec01-4b8c-bb8e-207237af3a99): online
Node: www2. instyle.locale (f8719a77-70b4-4e5f-851b-dafa7d65d3a2): online

Master/Slave Set: ms-drbd0
drbd0:0(heartbeat::ocf:drbd):Master www1. instyle.locale
drbd0:1(heartbeat::ocf:drbd):Started www2. instyle.locale
fs0        (heartbeat::ocf:Filesystem):Started www1. instyle.locale

9) [root@www1 crm]# df –h

FilesystemSizeUsedAvailableUse%Mounted on
/dev/had1       20G     2.7G    17G     14%     /
Tmpfs  513M   0          513      0%       /dev/shm
/dev/drbd0     1008M            18M     940M  2%       /mnt/drbd

10) Stoppare l’HeartBeat sul server primario

[root@www1 crm]# /etc/rc.d/init.d/heartbeat stop

11) Eseguiamo crm_mon sul server secondario, DRBD dovrebbe essere montato correttamente come di seguito:

[root@www2 crm]# crm_mon -i 3

Defaulting to one-shot mode
You need to have curses available at compile time to enable console mode

============
Last updated: Wed Jun 18 23:32:11 2008
Current DC: www2.instyle.locale (f8719a77-70b4-4e5f-851b-dafa7d65d3a2)
2 Nodes configured.
2 Resources configured.
============

Node: www1. instyle.locale (2bbd6408-ec01-4b8c-bb8e-207237af3a99): OFFLINE
Node: www2. instyle.locale (f8719a77-70b4-4e5f-851b-dafa7d65d3a2): online

Master/Slave Set: ms-drbd0
drbd0:0(heartbeat::ocf:drbd):Master www2. instyle.locale
drbd0:1(heartbeat::ocf:drbd):Stopped
fs0        (heartbeat::ocf:Filesystem):Started www2. instyle.locale

12) [root@www2 crm]# df -h
FilesystemSizeUsedAvailableUse%Mounted on
/dev/hda1       15G     1.6G    13G     12%     /
Tmpfs  513M   0          513      0%       /dev/shm
/dev/drbd0     1008M            18M     940M  2%       /mnt/drbd
13) Avviamo il servizio Hearthbeat, torniamo sul server primario e verifichiamo che sia tutto ok

[root@www1 crm]# /etc/rc.d/init.d/heartbeat start

Starting High-Availability services:
[  OK  ]

14) [root@www1 crm]# crm_mon -i 3

Defaulting to one-shot mode
You need to have curses available at compile time to enable console mode

============
Last updated: Wed Jun 18 23:16:41 2010
Current DC: www2.instyle.locale (f8719a77-70b4-4e5f-851b-dafa7d65d3a2)
2 Nodes configured.
2 Resources configured.
============

Node: www1. instyle.locale (2bbd6408-ec01-4b8c-bb8e-207237af3a99): online
Node: www2. instyle.locale (f8719a77-70b4-4e5f-851b-dafa7d65d3a2): online

Master/Slave Set: ms-drbd0
drbd0:0(heartbeat::ocf:drbd):Master www1. instyle.locale
drbd0:1(heartbeat::ocf:drbd):Started www2. instyle.locale
fs0        (heartbeat::ocf:Filesystem):Started www1. instyle.locale

15) [root@www1 crm]# df –h

FilesystemSizeUsedAvailableUse%Mounted on
/dev/had1       20G     2.7G    17G     14%     /
Tmpfs  513M   0          513      0%       /dev/shm
/dev/drbd0     1008M            18M     940M  2%       /mnt/drbd