corosync+pacemaker使用pcs构建高可用集群

corosync+pacemaker使用pcs构建高可用集群,第1张

corosync+pacemaker使用pcs构建高可用集群

一、提前准备好corosync起搏器集群的前提条件

集群提前准备-->:HA-web

上面的->:Corosyncpacemaker使用crmsh构建高可用性集群


第二,提前准备电脑

[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 2016Last 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软件呈现,所以暂时忽略。


三。采用corosync起搏器电脑的高可用性网络

1.检查适用于PC的资源代理类型

[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.定义iphttpd资源(收到好的文档后,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 2016Last 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 2016Last 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=508米s

测试

[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


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zz/778148.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-03
下一篇 2022-05-03

发表评论

登录后才能评论

评论列表(0条)

保存