HACMP常用命令及要點點播

perfychi發表於2013-05-04
檢視cluster是否啟動:
lssrc -g cluster

啟動和停止cluster
 #smitty clstart  /smitty clstop
 
 ,檢視cluster服務情況
# tail  –f  /var/hacmp/log/hacmp.out

檢視ha ip服務情況
#/usr/sbin/cluster/clstat


# netstat –in (檢視網路狀態資訊)

建立共享資料儲存區prodvg
#smitty mkvg
然後輸入要建立VG 的名字:prodvg,選擇硬碟:hdisk4;按回車執行。
#smitty chvg
來改變prodvg 的狀態,要把重啟系統後自動啟用卷組改為NO。
然後再prodvg 上建立邏輯卷和檔案系統。
分別用#smitty mklv 和#smitty fs
最後要在這臺機器執行:#varyoffvg prodvg 來停止這個共享卷組。
換到另一臺機器,用#smitty importvg 來匯入這個共享卷組,輸入卷組的名字:prodvg ;選
擇硬碟:hdisk7(因為在erp 這臺機器有多個硬碟,看PVID 號得出hdisk7 是共享的資料盤)
匯入prodvg 後,我們在這臺機器也要改變VG 的屬性。
#smitty chvg
要把重啟系統後自動啟用卷組改為NO



配置磁碟心跳:

HACMP 5.4磁碟心跳配置過程
Step1:     配置並行卷組
[dbsvr1]#smitty hacmp
 
  Initialization and Standard Configuration
  Extended Configuration
  System Management (C-SPOC)
Problem Determination Tools


  Manage HACMP Services
  HACMP Communication Interface Management
  HACMP Resource Group and Application Management
  HACMP Log Viewing and Management
  HACMP File Collection Management
  HACMP Security and Users Management
  HACMP Logical Volume Management
  HACMP Concurrent Logical Volume Management
  HACMP Physical Volume Management
  Configure GPFS


  Concurrent Volume Groups
  Concurrent Logical Volumes
  Synchronize Concurrent LVM Mirrors


  List All Concurrent Volume Groups
  Create a Concurrent Volume Group
  Create a Concurrent Volume Group with Data Path Devices
  Set Characteristics of a Concurrent Volume Group
  Import a Concurrent Volume Group
  Mirror a Concurrent Volume Group


               Node Names                               
                                                                           
 Move cursor to desired item and press Esc+7.                            
   ONE OR MORE items can be selected.                                  
  Press Enter AFTER making all selections.                                

      >dbsvr1
      >dbsvr2




                        Create a Concurrent Volume Group

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

[TOP]                                                   [Entry Fields]
  Node Names                                          dbsvr1,dbsvr2
  PVID                                                0003714b1331a3ed
  VOLUME GROUP name                               [heartvg]
  Physical partition SIZE in megabytes                           4                   +
  Volume group MAJOR NUMBER                         [56]                 +#
  Enhanced Concurrent Mode                             true                 +
  Enable Cross-Site LVM Mirroring Verification               false                  +


  Warning:
  Changing the volume group major number may result
  in the command being unable to execute
  successfully on a node that does not have the
  major number currently available. Please check
[MORE...3]

F1=Help             F2=Refresh          F3=Cancel           F4=List
Esc+5=Reset         Esc+6=Command       Esc+7=Edit          Esc+8=Image


[dbsvr1]#lspv
hdisk0          0003714ba5048a99                    rootvg          active
hdisk1          0003714bd3cf768a                    rootvg          active
hdisk2          0003714b7d935335                    datavg          active
hdisk3          0003714b27d6164f                    datavg_1        active
hdisk4          none                                None
hdisk5          0003714b1331a3ed                    heartvg

[dbsvr2]#lspv
hdisk1          000531c9c977a892                    rootvg          active
hdisk2          0003714b7d935335                    datavg
hdisk3          none                                None
hdisk4          none                                None
hdisk0          000531c9a501da2a                    rootvg          active
hdisk5          0003714b1331a3ed                    heartvg

Step2:     編輯環境變數
[dbsvr1]#vi /etc/environment
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java14/jre/bin:/us
r/java14/bin:/usr/sbin/rsct/bin
TZ=BEIST-8
LANG=en_US
LOCPATH=/usr/lib/nls/loc
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
LC__FASTMSG=true
[dbsvr2]#vi /etc/environment
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java14/jre/bin:/us
r/java14/bin:/usr/sbin/rsct/bin
TZ=BEIST-8
LANG=en_US
LOCPATH=/usr/lib/nls/loc
NLSPATH=/usr/lib/nls/msg/%L/%N:/usr/lib/nls/msg/%L/%N.cat
LC__FASTMSG=true

Step3:     測試並行卷組通訊
[dbsvr1]#dhb_read -p hdisk5 -r
DHB CLASSIC MODE
 First node byte offset: 61440
Second node byte offset: 62976
Handshaking byte offset: 65024
       Test byte offset: 64512

Receive Mode:
Waiting for response . . .
Magic number = 0x87654321
Magic number = 0x87654321
Magic number = 0x87654321
Magic number = 0x87654321
Link operating normally

[dbsvr2]#dhb_read -p hdisk5 -t
DHB CLASSIC MODE
First node byte offset: 61440
Second node byte offset: 62976
Handshaking byte offset: 65024
      Test byte offset: 64512

Transmit Mode:
Magic number = 0x87654321
Detected remote utility in receive mode.  Waiting for response . . .
Magic number = 0x87654321
Magic number = 0x87654321
Link operating normally

Step4:     配置磁碟心跳網路
[dbsvr1]#smitty hacmp
  Initialization and Standard Configuration
  Extended Configuration
  System Management (C-SPOC)
Problem Determination Tools

  Discover HACMP-related Information from Configured Nodes
  Extended Topology Configuration
  Extended Resource Configuration
  Extended Cluster Service Settings
  Extended Event Configuration
  Extended Performance Tuning Parameters Configuration
  Security and Users Configuration
  Snapshot Configuration
  Export Definition File for Online Planning Worksheets

  Configure an HACMP Cluster
  Configure HACMP Nodes
  Configure HACMP Sites
  Configure HACMP Networks
  Configure HACMP Communication Interfaces/Devices
  Configure HACMP Persistent Node IP Label/Addresses
  Configure HACMP Global Networks
  Configure HACMP Network Modules
  Configure Topology Services and Group Services
  Show HACMP Topology

  Add a Network to the HACMP Cluster
  Change/Show a Network in the HACMP Cluster
  Remove a Network from the HACMP Cluster



                            Select a Network Type         
                                                          
   Move cursor to desired item and press Enter.           
                                                          
   [TOP]                                                  
     # Discovery last performed: (Apr 03 15:13)           
     # Discovered IP-based Network Types                  
     ether                                                
                                                          
     # Discovered Serial Device Types                     
     rs232                                                
                                                          
     # Pre-defined IP-based Network Types                 
     XD_data                                              
     XD_ip                                                
     atm                                                  
     ether                                                
     fddi                                                 
     hps                                                  
     ib                                                   
     token                                                
                                                          
     # Pre-defined Serial Device Types                    
     XD_rs232                                             
     diskhb                                               


                  Add a Serial Network to the HACMP Cluster

Type or select values in entry fields.
Press Enter AFTER making all desired changes.

                                                        [Entry Fields]
* Network Name                                       [net_diskhb_01]
* Network Type                                       diskhb


  Configure an HACMP Cluster
  Configure HACMP Nodes
  Configure HACMP Sites
  Configure HACMP Networks
  Configure HACMP Communication Interfaces/Devices
  Configure HACMP Persistent Node IP Label/Addresses
  Configure HACMP Global Networks
  Configure HACMP Network Modules
  Configure Topology Services and Group Services
  Configure HACMP Networks

                            Select a category         
                                                      
 Move cursor to desired item and press Enter.         
                                                      
   Add Discovered Communication Interface and Devices 
   Add Pre-defined Communication Interface and Devices 


Communication Interfaces
Communication devices

                         Select a Device Network    
                                                    
 Move cursor to desired item and press Enter.       
                                                    
   net_diskhb_01                                    


* Device Name                                        [heartdbsvr1]
* Network Type                                        diskhb
* Network Name                                        net_diskhb_01
* Device Path                                        [/dev/hdisk5]
*Node name                                            [dbsvr1]

* Device Name                                        [heartdbsvr2]
* Network Type                                        diskhb
* Network Name                                        net_diskhb_01
* Device Path                                        [/dev/hdisk5]
*Node name                                            [dbsvr2]

Step5:     檢查叢集網路結構
  Show Cluster Topology
  Show Cluster Definition
  Show Topology Information by Node
  Show Topology Information by Network
  Show Topology Information by Communication Interface


Cluster Name: gyjt                                                                  
Cluster Connection Authentication Mode: Standard                                    
Cluster Message Authentication Mode: None                                           
Cluster Message Encryption: None                                                    
Use Persistent Labels for Communication: No                                         
                                                                                    
NODE dbsvr1:                                                                        
                heartdbsvr1     /dev/hdisk5                                         
                dbsvr1_svc      158.1.1.126                                         
                dbsvr1_boot     158.1.1.127                                         
                dbsvr1_stb      192.168.1.1                                         
        Network net_diskhb_01                                                       
                heartdbsvr1     /dev/hdisk5                                         
        Network net_ether_01                                                        
                dbsvr1_stb      192.168.1.1                                         
        Network net_rs232_01                                                        
                dbsvr1_tty0     /dev/tty0                                           
                                                                                    
                                                                                    
NODE dbsvr2:                                                                        
                heartdbsvr2     /dev/hdisk5                                         
                dbsvr2_svc      158.1.1.124                                         
                dbsvr2_boot     158.1.1.125                                         
                dbsvr2_stb      192.168.1.3                                         
       Network net_diskhb_01                                                        
                heartdbsvr2     /dev/hdisk5                                         
        Network net_ether_01                                                        
                dbsvr2_stb      192.168.1.3                                         
        Network net_rs232_01                                                        
                dbsvr2_tty0     /dev/tty0                                           
                                                                                    

Step6:     同步叢集配置
                                                                                    
                             Extended Configuration                                 
                                                                                    
Move cursor to desired item and press Enter.                                        
                                                                                    
  Discover HACMP-related Information from Configured Nodes                          
  Extended Topology Configuration                                                   
  Extended Resource Configuration                                                   
  Extended Cluster Service Settings                                                 
  Extended Event Configuration                                                      
  Extended Performance Tuning Parameters Configuration                              
  Security and Users Configuration                                                  
  Snapshot Configuration                                                            
  Export Definition File for Online Planning Worksheets                             
                                                                                    
  Extended Verification and Synchronization                                         
  HACMP Cluster Test Tool                            





檢視心跳:
#lssrc –ls topsvcs

用於心跳的程式:
# ps -ef|grep nim

更改心跳相關的引數:
  Extended Configuration----àExtended Topology Configuration----à
Configure HACMP Network Modules----à
Change a Network Module using Predefined Values
分別選擇ether,diskhb,rs232



串列埠做心跳:
Smitty tty
選擇“Add a TTY”

lsdev –Cc tty 檢視新增串列埠,會有如下顯示:
tty0 Available 00-00-S3-00 Asynchronous Terminal


串列埠測試:


1.    
   

主機A
   

stty
2.    
   

主機B
   

stty
這時在兩臺主機的命令列下會有內容的顯示,否則,tty配置失敗。示例如下:

speed 9600 baud; -parity hupcl

eol2 = ^?

brkint -inpck -istrip icrnl -ixany ixoff onlcr tab3

echo echoe echok

3.    
   

主機A
   

cat /etc/hosts > /dev/tty0

4.    
   

主機B
   

cat < /dev/tty0

這時在主機2的命令列下有主機1的/etc/hosts檔案的內容,否則,tty配置失敗。

完成串列埠測試




配置HACMP (以下我們以主機A作為主機,B作為備用機)


(cluster name-cluster node-discover 發現-HACMP networks-新增HACMP IP地址或hacmp communication interfaces/deves 介面和串列埠裝置-hacmp persistent NODE ip label/address 新增現有節點的IP及標識,地址。)HACMP的配置都是在一臺主機上做配置,作完之後,只需要同步另外一臺主機即可。節點名兩臺主機要分別新增。

詳細配置

<1>配置CLUSTER NAME 及節點;分別將NODE加入CLUSTER叢集中,然後在發現一下。

Communication path to node 這一步選擇透過發現方式來選擇node對應的主機(boot1/boot2),分兩次來完成,不同的node來對應不同的主機

<2>給HACMP新增IP網路

Smit/smitty hacmp—Extended Topology Configuration--&gtConfigure HACMP Networks->Add a Network to the HACMP cluster

選擇ETHERNET,新增IP網路(該資訊都是自動獲取無需修改任何引數設定,只需要修改最後一項,選擇YES OR NO)

其中Enable IP Takeover via IP Aliases項,如果SVC IP地址與boot1地址在同一網段,則選擇“NO”,反之選擇“YES

<3>新增非IP網路,即串列埠心跳網路

Extended Configuration>Extended Topology Configuration>

Configure HACMP Networks>Add a Network to the HACMP Cluster

選擇RS232,新增串列埠心跳。(自動獲取網路名和型別)

<4>新增IP地址(HACMP IP地址和串列埠地址)即網路介面和,心跳或磁碟裝置

Extended Configuratin>Extended Topology Configuration>

Configure HACMP Communication interfaces/Devices(HACMP通訊介面或串列埠裝置配置)

>Add Communication interfaces/Devices

新增串列埠裝置IP地址

Extended Configuratin>Extended Topology Configuration>

Configure HACMP Communication interfaces/Devices(HACMP通訊介面或串列埠裝置配置)

>Add Communication interfaces/Devices

Device Name 自己自定義名稱。如:hisser1_tty0

Device path 一般都是:/dev/tty0

Node name 選擇主機A作為NODE A,如圖就是hisser1

 

<5>新增對外IP 也就是服務IP即:server(新增資源組之前必須先新增服務IP,否則資源組就無法和SERVER IP繫結在一起)

Extended Configuration>Extended Resource Configuration>

HACMP Extended Resources Configuration>Configure HACMP server IP

Labels /Addresses >Add a Service IP Label/Address



#檢視HACMP拓撲結構
/usr/es/sbin/cluster/utilities/cltopinfo
/usr/es/sbin/cluster/utilities/cltopinfo -c
/usr/es/sbin/cluster/utilities/cltopinfo -n
/usr/es/sbin/cluster/utilities/cltopinfo -i

#檢視HACMP狀態
/usr/es/sbin/cluster/utilities/clshowsrv -v

新增pv到concurrent vg中
smitty hacmp->
System Management (C-SPOC)->
HACMP Concurrent Logical Volume Management->
Concurrent Volume Groups->
Set Characteristics of a Concurrent Volume Group->
Add a Volume to a Concurrent Volume Group->
 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27042095/viewspace-759747/,如需轉載,請註明出處,否則將追究法律責任。

相關文章