二. 共享存储配置
HACMP的共享存储主要有两个用途: 存储数据和心跳检测
首先是数据存储配置部分:
1. A机创建数据卷组datavg
smit mkvg
Add an Original Volume Group
VOLUME GROUP name [datavg]
Physical partition SIZE in megabytes 128
PHYSICAL VOLUME names [hdisk3]
Force the creation of a volume group? yes
Activate volume group AUTOMATICALLY no
at system restart?
Volume Group MAJOR NUMBER []
Create VG Concurrent Capable? no
2. A机创建文件系统/oradata
smit crfs
Add an Enhanced Journaled File System
Add an Enhanced Journaled File System
Volume group name datavg
SIZE of file system
Unit Size Gigabytes
Number of units [28]
MOUNT POINT [/oradata]
Mount AUTOMATICALLY at system restart? no
PERMISSIONS read/write
Mount OPTIONS []
Block Size (bytes) 4096
Logical Volume for Log
Inline Log size (MBytes) []
Extended Attribute Format
ENABLE Quota Management? no
Enable EFS? no
Allow internal snapshots? no
Mount GROUP []
3. A机挂载文件系统/oradata
# mount /oradata
4. A机禁止数据卷组datavg自动挂载
# chvg -a n datavg
5. A机卸载文件系统/oradata
# umount /oradata
6. A机冷却数据卷组datavg
# varyoffvg datavg
7. A机查看数据卷组major
# ls -l /dev/datavg
crw-rw---- 1 root system 41, 0 Jun 22 22:55 /dev/datavg
#
8. B机导入数据卷组datavg
# importvg -y datavg -V 41 hdisk3
datavg
#
9. B机挂载文件系统/oradata
# mount /oradata
10. B机禁止数据卷组datavg自动挂载
# chvg -a n datavg
11. B机卸载文件系统/oradata
# umount /oradata
12. B机冷却数据卷组datavg
# varyoffvg datavg
接着是心跳磁盘配置部分:
1. A机创建心跳卷组heartvg
smit mkvg
Add an Original Volume Group
VOLUME GROUP name [heartvg]
Physical partition SIZE in megabytes 128
PHYSICAL VOLUME names [hdisk7]
Force the creation of a volume group? yes
Activate volume group AUTOMATICALLY no
at system restart?
Volume Group MAJOR NUMBER []
Create VG Concurrent Capable? enhanced concurrent
2. A机查看心跳卷组major
# ls -l /dev/heartvg
crw-rw---- 1 root system 42, 0 Jun 22 23:08 /dev/heartvg
#
3. B机导入心跳卷组
# importvg -y heartvg -V 42 hdisk7
synclvodm: No logical volumes in volume group heartvg.
heartvg
0516-783 importvg: This imported volume group is concurrent capable.
Therefore, the volume group must be varied on manually.
#
4. B机禁止心跳卷组自动挂载
# varyonvg heartvg
# chvg -a n heartvg
# varyoffvg heartvg
# 自此HACMP共享存储就配置完成了
三. 配置HACMP
1. 编辑/etc/hosts添加IP标签(A机和B机均需操作)
10.10.0.1 hacmp1_boot
10.10.0.2 hacmp2_boot
192.168.3.1 hacmp1_std
192.168.3.2 hacmp2_std
192.168.128.99 hacmp1_per hacmp1
192.168.128.100 hacmp2_per hacmp2
192.168.128.103 hacmp_svc
2. 创建应用服务器启停脚本(A机和B机均需操作)
# touch start.sh stop.sh;chmod u+x start.sh stop.sh
3. 定义HACMP集群(此步开始如无特别说明均在A机操作)
smit hacmp
Extended Configuration
Extended Topology Configuration
Configure an HACMP Cluster
Add/Change/Show an HACMP Cluster
Cluster Name [oraha]
4. 添加节点
smit hacmp
Extended Configuration
Extended Topology Configuration
Configure HACMP Nodes
Add a Node to the HACMP Cluster
Node Name [hacmp1]
Communication Path to Node [hacmp1_boot]
# 以同样的方式添加另一个节点
Node Name [hacmp2]
Communication Path to Node [hacmp2_boot]
5. 定义IP网络
smit hacmp
Extended Configuration
Extended Topology Configuration
Configure HACMP Networks
Add a Network to the HACMP Cluster
ether
Network Name [net_ether_01]
Network Type ether
Netmask(IPv4)/Prefix Length(IPv6) [255.255.252.0]
Enable IP Address Takeover via IP Aliases [Yes]
IP Address Offset for Heartbeating over IP Aliases []
6. 定义非IP网络
smit hacmp
Extended Configuration
Extended Topology Configuration
Configure HACMP Networks
Add a Network to the HACMP Cluster
diskhb
Network Name [net_diskhb_01]
Network Type diskhb
7. 添加通讯接口
smit hacmp
Extended Configuration
Extended Topology Configuration
Configure HACMP Communication Interfaces/Devices
Add Communication Interfaces/Devices
Add Pre-defined Communication Interfaces and Devices
Communication Interfaces
net_ether_01
IP Label/Address [hacmp1_boot]
Network Type ether
Network Name net_ether_01
Node Name [hacmp1]
Network Interface []
# 以同样的方式添加剩余的通讯接口
IP Label/Address [hacmp2_boot]
Network Type ether
Network Name net_ether_01
Node Name [hacmp2]
Network Interface []
IP Label/Address [hacmp1_std]
Network Type ether
Network Name net_ether_01
Node Name [hacmp1]
Network Interface []
IP Label/Address [hacmp2_std]
Network Type ether
Network Name net_ether_01
Node Name [hacmp2]
Network Interface []
8. 添加通讯设备
smit hacmp
Extended Configuration
Extended Topology Configuration
Configure HACMP Communication Interfaces/Devices
Add Communication Interfaces/Devices
Add Pre-defined Communication Interfaces and Devices
Communication Devices
net_diskhb_01
Device Name [hacmp1_heartdisk]
Network Type diskhb
Network Name net_diskhb_01
Device Path [/dev/hdisk7]
Node Name [hacmp1]
# 以同样方式添加剩余的通讯设备
Device Name [hacmp2_heartdisk]
Network Type diskhb
Network Name net_diskhb_01
Device Path [/dev/hdisk7]
Node Name [hacmp2]
9. 添加永久IP
smit hacmp
Extended Configuration
Extended Topology Configuration
Configure HACMP Persistent Node IP Label/Addresses
Add a Persistent Node IP Label/Address
hacmp1
Node Name hacmp1
Network Name [net_ether_01]
Node IP Label/Address [hacmp1_per]
Netmask(IPv4)/Prefix Length(IPv6) []
# 以同样的方式添加另一个
hacmp2
Node Name hacmp2
Network Name [net_ether_01]
Node IP Label/Address [hacmp2_per]
Netmask(IPv4)/Prefix Length(IPv6) []
10. 配置应用服务器
smit hacmp
Extended Configuration
Extended Resource Configuration
HACMP Extended Resources Configuration
Configure HACMP Applications Servers
Configure HACMP Application Servers
Add an Application Server
Server Name [ora]
Start Script [/start.sh]
Stop Script [/stop.sh]
Application Monitor Name(s)
11. 配置Service IP
smit hacmp
Extended Configuration
Extended Resource Configuration
HACMP Extended Resources Configuration
Configure HACMP Service IP Labels/Addresses
Add a Service IP Label/Address
Configurable on Multiple Nodes
net_ether_01 (192.168.0.0/22 10.10.0.0/22)
IP Label/Address hacmp_svc
Netmask(IPv4)/Prefix Length(IPv6) []
Network Name net_ether_01
Alternate Hardware Address to accompany IP Label/A []
ddress
12. 配置资源组
smit hacmp
Extended Configuration
Extended Resource Configuration
HACMP Extended Resource Group Configuration
Add a Resource Group
Resource Group Name [rg]
Participating Nodes (Default Node Priority) [hacmp1 hacmp2]
Startup Policy Online On Home Node Only
Fallover Policy Fallover To Next Priority Node In The List
Fallback Policy Never Fallback
13. 更改资源组属性
smit hacmp
Extended Configuration
Extended Resource Configuration
HACMP Extended Resource Group Configuration
Change/Show Resources and Attributes for a Resource Group
rg
Resource Group Name rg
Participating Nodes (Default Node Priority) hacmp1 hacmp2
Startup Policy Online On Home Node Only
Fallover Policy Fallover To Next Priority Node In The List
Fallback Policy Never Fallback
Service IP Labels/Addresses [hacmp_svc]
Application Servers [ora]
Volume Groups [datavg]
Use forced varyon of volume groups, if necessary false
Automatically Import Volume Groups false
Filesystems (empty is ALL for VGs specified) []
Filesystems Consistency Check fsck
Filesystems Recovery Method sequential
Filesystems mounted before IP configured false
Filesystems/Directories to Export (NFSv2/3) []
Filesystems/Directories to Export (NFSv4) []
Stable Storage Path (NFSv4) []
Filesystems/Directories to NFS Mount []
Network For NFS Mount []
Tape Resources []
Raw Disk PVIDs []
Fast Connect Services []
Communication Links []
Primary Workload Manager Class []
Secondary Workload Manager Class []
Miscellaneous Data []
WPAR Name []
SVC PPRC Replicated Resources []
EMC SRDF(R) Replicated Resources []
四. 同步集群节点
smit hacmp
Extended Configuration
Extended Verification and Synchronization
Verify, Synchronize or Both [Both]
Automatically correct errors found during [No]
verification?
Force synchronization if verification fails? [No]
Verify changes only? [No]
Logging [Standard]
五. 启动HACMP
Start now, on system restart or both now
Start Cluster Services on these nodes [hacmp1,hacmp2]
Manage Resource Groups Automatically
BROADCAST message at startup? false
Startup Cluster Information Daemon? false
Ignore verification errors? false
Automatically correct errors found during Interactively
cluster start?
2. A机查看卷组和网络状态
# lspv
hdisk0 00c74e1411a46c32 rootvg active
hdisk1 00c74e141179c8e0 rootvg active
hdisk3 00c74e146a3f0996 datavg active
hdisk7 00c74e146a3f3348 heartvg
# ifconfig -a
en0: flags=1e080863,c0<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),LARGESEND,CHAIN>
inet 192.168.3.1 netmask 0xfffffc00 broadcast 192.168.3.255
inet 192.168.128.103 netmask 0xfffffc00 broadcast 192.168.131.255
tcp_sendspace 131072 tcp_recvspace 65536 rfc1323 0
en1: flags=5e080863,c0<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),PSEG,LARGESEND,CHAIN>
inet 10.10.0.1 netmask 0xfffffc00 broadcast 10.10.3.255
inet 192.168.128.99 netmask 0xfffffc00 broadcast 192.168.131.255
tcp_sendspace 131072 tcp_recvspace 65536 rfc1323 0
lo0: flags=e08084b,c0<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,LARGESEND,CHAIN>
inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
inet6 ::1%1/0
tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1
#
# datavg已经激活,Service IP也已经生成
六. HACMP切换测试
smit clstop
Stop now, on system restart or both now
Stop Cluster Services on these nodes [hacmp1]
BROADCAST cluster shutdown? true
Select an Action on Resource Groups Move Resource Groups
2. B机查看卷组和网络状态
# ifconfig -a
en2: flags=1e080863,c0<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),LARGESEND,CHAIN>
inet 192.168.3.2 netmask 0xfffffc00 broadcast 192.168.3.255
inet 192.168.128.100 netmask 0xfffffc00 broadcast 192.168.131.255
tcp_sendspace 131072 tcp_recvspace 65536 rfc1323 0
en3: flags=1e080863,c0<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),LARGESEND,CHAIN>
inet 10.10.0.2 netmask 0xfffffc00 broadcast 10.10.3.255
inet 192.168.128.103 netmask 0xfffffc00 broadcast 192.168.131.255
tcp_sendspace 131072 tcp_recvspace 65536 rfc1323 0
lo0: flags=e08084b,c0<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,LARGESEND,CHAIN>
inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
inet6 ::1%1/0
tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1
# lspv
hdisk0 00c74e149860376d rootvg active
hdisk1 00c74e1412044d23 rootvg active
hdisk3 00c74e146a3f0996 datavg active
hdisk7 00c74e146a3f3348 heartvg
#
# Service IP已经投靠过来了,datavg也已经激活.
smit clstart
Start now, on system restart or both now
Start Cluster Services on these nodes [hacmp1]
Manage Resource Groups Automatically
BROADCAST message at startup? false
Startup Cluster Information Daemon? false
Ignore verification errors? false
Automatically correct errors found during Interactively
cluster start?
4. 关闭B机上的集群
smit clstop
Stop now, on system restart or both now
Stop Cluster Services on these nodes [hacmp2]
BROADCAST cluster shutdown? true
Select an Action on Resource Groups Move Resource Groups
5. A机查看卷组和网络状态
# ifconfig -a
en0: flags=1e080863,c0<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),LARGESEND,CHAIN>
inet 192.168.3.1 netmask 0xfffffc00 broadcast 192.168.3.255
inet 192.168.128.103 netmask 0xfffffc00 broadcast 192.168.131.255
tcp_sendspace 131072 tcp_recvspace 65536 rfc1323 0
en1: flags=5e080863,c0<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD(ACTIVE),PSEG,LARGESEND,CHAIN>
inet 10.10.0.1 netmask 0xfffffc00 broadcast 10.10.3.255
inet 192.168.128.99 netmask 0xfffffc00 broadcast 192.168.131.255
tcp_sendspace 131072 tcp_recvspace 65536 rfc1323 0
lo0: flags=e08084b,c0<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,LARGESEND,CHAIN>
inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
inet6 ::1%1/0
tcp_sendspace 131072 tcp_recvspace 131072 rfc1323 1
# lspv
hdisk0 00c74e1411a46c32 rootvg active
hdisk1 00c74e141179c8e0 rootvg active
hdisk3 00c74e146a3f0996 datavg active
hdisk7 00c74e146a3f3348 heartvg
#
# 此时Service IP又飘回A机,卷组也在A机上激活了
6. 开启B机集群
smit clstart
Start now, on system restart or both now
Start Cluster Services on these nodes [hacmp2]
Manage Resource Groups Automatically
BROADCAST message at startup? false
Startup Cluster Information Daemon? false
Ignore verification errors? false
Automatically correct errors found during Interactively
cluster start?
# 自此HACMP配置完成