- 积分
- 16843
在线时间 小时
最后登录1970-1-1
|

楼主 |
发表于 2017-12-29 10:40:48
|
显示全部楼层
安装ha组件:
' p" [/ W5 q" r# p4 E' x0 ?1 x' v/ i5 byum install pcs fence-agents-all6 O; |& L( E& v+ V9 N7 k
5 k8 X& S3 J4 o% W+ o创建集群# U! O( `7 \, b6 B; t% {
pcs cluster setup --start --name my_cluster z1.example.com z2.example.com6 k2 F) C' @1 W) T* a% \, f
启动集群服务
" H3 o$ h4 p6 }0 V5 V$ ypcs cluster enable --all
8 x @2 v: {$ ^2 e9 s查看集群状态
* c" t E% b& _, ?, y3 F( m2 z/ ~: l6 @pcs cluster status, k0 V6 h3 y' z D, Z
5 R, c6 j/ i4 l, _# t
创建stonith设备
6 a! @/ w+ w. u( o A. u4 K% z& p+ d) s5 S3 L! C6 ?0 }2 f8 R
pcs stonith create myapc fence_apc_snmp params ipaddr="zapc.example.com" pcmk_host_map="z1.example.com:1;z2.example.com:2" pcmk_host_check= "static-list" pcmk_host_list="z1.example.com,z2.example.com" login="apc" passwd="apc" 7 m( x5 v5 e G1 M d
pcs stonith show myapc
6 |' g, y4 q( A9 P1 z2 A( [
/ X4 d* z% q% _6 N创建资源
& d6 p1 ^, S0 cpcs resource create my_lvm LVM volgrpname=my_vg exclusive=true --group apachegroup
2 `) M' k8 o4 ~6 B) U1 ?$ {pcs resource show
& a) e, W4 w! n, c, _) O7 f; v$ E
$ C, ]6 F# C1 g: wpcs resource enable
9 j7 k) S8 ?, A) k# Apcs resource create my_fs Filesystem device="/dev/my_vg/my_lv" directory="/var/www" fstype="ext4" --group apachegroup1 ^+ w) U; t5 t/ `4 i
pcs resource create VirtualIP IPaddr2 ip=198.51.100.3 cidr_netmask=24 --group apachegroup9 o7 D4 M5 i1 y7 ~
pcs resource create Website apache configfile="/etc/httpd/conf/httpd.conf" statusurl="http://127.0.0.1/server-status" --group apachegroup: z7 W" \+ j2 M8 E5 \
pcs resource create VirtualIP ocf:heartbeat:IPaddr2 ip=192.16 8.0.120 cidr_netmask=24 opmonitorinterval= 30s6 Q5 s# D7 d+ H1 e! h
7 p5 R7 D3 ]/ p6 C! m8 d
; Q, Z3 e4 u( K; Q! {; X% U' a查看集群状态:. @$ b& p( N! f5 }0 k, H
pcs status
; G* a' g+ `; \倒换节点:pcs cluster standby z1.example.compcs cluster unstandby z1.example.com0 K0 e$ A0 c h- ]% Z. ~# h5 E
查看帮助pcs resource -h* o/ F( g9 H8 k9 B! R+ _2 K
导出和备份配置文件pcs cluster cib testfilepcs config backuppcs config restorepcs cluster setup --name new_cluster nodeA nodeB --token 10000 --join 100pcs cluster stoppcs cluster enablepcs cluster disablepcs cluster node add nodepcs cluster node remove nodepcs cluster standby nodepcs cluster unstandby nodepcs stonith listpcs stonith describepcs stonith show --fullpcs stonith create myapc-west-13 fence_apc pcmk_host_list="west-13" ipaddr="west-apc" login="apc" passwd="apc" port="15"
+ A" ?7 N/ [; {4 u) s0 Tfence对应节点:pcs stonith fence nodepcs resource delete VirtualIPpcs resource describe LVMpcs resource show --fullpcs resource enable resource_id/ C# @/ @; Y; J3 l- r% T
pcs resource disable resource_id
; Y$ d: O; J1 h- F3 ]! S: G# |$ ` t* n9 J4 y: e) s
设置资源先后关系pcs constraint VirtualIP then dummy_resource kind=Optional
2 \! ~9 ~0 m1 s2 L3 h7 f, t进入维护模式:pcs resource unmanage resource1
0 ?6 x% w8 e! w2 x7 d2 R9 f$ s( d解除维护模式
3 T6 O; Y- d' ~; l2 zpcs resource manage resource1 |
|