corosync+pacemaker 는 pcs 를 사용 하여 사용 가능 한 클 러 스 터 를 구축 합 니 다.

1.corosync+pacemaker 군집 전제 준비
군집 전제 준비--> HA-web
윗글 을 잇다--> corosync+pacemaker 는 crmsh 를 사용 하여 사용 가능 한 클 러 스 터 를 구축 합 니 다.
준비 pcs
[root@node1 ~]# yum install pcs

  stonith  
[root@node1 ~]# pcs property set stonith-enable=false

[root@node1 ~]# pcs property set no-quorum-policy=ignore

      
[root@node1 ~]# pcs status
Cluster name: 
Last updated: Tue Nov 22 12:20:59 2016		Last change: Tue Nov 22 11:57:08 2016 by root via cibadmin on node1
Stack: classic openais (with plugin)
Current DC: node1 (version 1.1.14-8.el6_8.2-70404b0) - partition with quorum
2 nodes and 0 resources configured, 2 expected votes

Online: [ node1 node2 ]

Full list of resources:


PCSD Status:
Error: Unable to read /etc/cluster/cluster.conf: No such file or directory

클 러 스 터 설정 파일 이 없 음 을 알려 주 는 오류 가 있 습 니 다.그러나 이 설정 파일 은 cman 플러그 인 이 제공 해 야 하기 때문에 무시 합 니 다.
3.corosync+pacemaker+pcs 높 은 사용 가능 한 웹 설정
1.pcs 가 지원 하 는 자원 에이전트 유형 보기
[root@node1 ~]# pcs resource standards
ocf
lsb
service
stonith

2.ocf 자원 에이전트 형식의 하위 형식 보기
[root@node1 ~]# pcs resource providers
heartbeat
pacemaker

3.대리 할 수 있 는 자원 보기
[root@node1 ~]# pcs resource agents
[root@node1 ~]# pcs resource agents lsb
[root@node1 ~]# pcs resource agents ocf:heartbeat

4.자원 에이전트 의 상세 한 정보 보기
[root@node1 ~]# pcs resource describ ocf:heartbeat:IPaddr
[root@node1 ~]# pcs resource describ ocf:heartbeat:httpd

5.ip httpd 자원 정의(위 글,httpd 제공 페이지,시작 금지)
[root@node1 ~]# pcs resource create webip ocf:heartbeat:IPaddr params ip=192.168.0.17  op monitor interval=20s timeout=40s
[root@node1 ~]# pcs resource create webserver lsb:httpd op monitor interval=20s timeout=40s

6.자원 운행 상황 보기
[root@node1 ~]# pcs status
Cluster name: 
Last updated: Tue Nov 22 13:07:16 2016		Last change: Tue Nov 22 13:06:45 2016 by root via cibadmin on node1
Stack: classic openais (with plugin)
Current DC: node1 (version 1.1.14-8.el6_8.2-70404b0) - partition with quorum
2 nodes and 2 resources configured, 2 expected votes

Online: [ node1 node2 ]

Full list of resources:

 webip	(ocf::heartbeat:IPaddr):	Started node1
 webserver	(lsb:httpd):	Started node2

PCSD Status:
Error: Unable to read /etc/cluster/cluster.conf: No such file or directory

7.정의 배열 제약 조건
[root@node1 ~]# pcs constraint colocation add webserver with webip
[root@node1 ~]# pcs status
Cluster name: 
Last updated: Tue Nov 22 13:13:18 2016		Last change: Tue Nov 22 13:12:28 2016 by root via cibadmin on node1
Stack: classic openais (with plugin)
Current DC: node1 (version 1.1.14-8.el6_8.2-70404b0) - partition with quorum
2 nodes and 2 resources configured, 2 expected votes

Online: [ node1 node2 ]

Full list of resources:

 webip	(ocf::heartbeat:IPaddr):	Started node2
 webserver	(lsb:httpd):	Started node2

Failed Actions:
* webserver_start_0 on node1 'unknown error' (1): call=20, status=complete, exitreason='none',
    last-rc-change='Tue Nov 22 13:12:29 2016', queued=0ms, exec=508ms

테스트
[root@node1 ~]# curl 192.168.0.17
This is node2

8.정의 순서 제약 조건
[root@node1 ~]# pcs constraint order webip then webserver
Adding webip webserver (kind: Mandatory) (Options: first-action=start then-action=start)

9.위치 제약 조건 정의
[root@node1 ~]# pcs constraint location webip prefers node2=100

좋은 웹페이지 즐겨찾기