pcs增加mysql资源_pcs命令配置示例

PCS(Pacemaker/Corosync configuration system)命令配置群集示例:

一、建立群集:

1、配置群集节点的认证as the hacluster user:

[shell]# pcs cluster auth node1 node2

2、创建一个二个节点的群集

[shell]# pcs cluster setup --name mycluster node1 node2

[shell]# pcs cluster start --all                  ## 启动群集

3、设置资源默认粘性(防止资源回切)

[shell]# pcs resource defaults resource-stickiness=100

[shell]# pcs resource defaults

4、设置资源超时时间

[shell]# pcs resource op defaults timeout=90s

[shell]# pcs resource op defaults

5、二个节点时,忽略节点quorum功能

[shell]# pcs property set no-quorum-policy=ignore

6、没有 Fencing设备时,禁用STONITH 组件功能

在 stonith-enabled="false" 的情况下,分布式锁管理器 (DLM) 等资源以及依赖DLM 的所有服务(例如 cLVM2、GFS2 和 OCFS2)都将无法启动。

[shell]# pcs property set stonith-enabled=false

[shell]# crm_verify -L -V                        ## 验证群集配置信息

二、建立群集资源

1、查看可用资源

[shell]# pcs resource list                     ## 查看支持资源列表,pcs resource list ocf:heartbeat

[shell]# pcs resource describe agent_name              ## 查看资源使用参数,pcs resource describe ocf:heartbeat:IPaddr2

2、配置虚拟IP

[shell]# pcs resource create ClusterIP ocf:heartbeat:IPaddr2 \

ip="192.168.10.15" cidr_netmask=32 nic=eth0 op monitor interval=30s

3、配置Apache(httpd)

[shell]# pcs resource create WebServer ocf:heartbeat:apache \

httpd="/usr/sbin/httpd" configfile="/etc/httpd/conf/httpd.conf" \

statusurl="http://localhost/server-status" op monitor interval=1min

4、配置Nginx

[shell]# pcs resource create WebServer ocf:heartbeat:nginx \

httpd="/usr/sbin/nginx" configfile="/etc/nginx/nginx.conf" \

statusurl="http://localhost/ngx_status" op monitor interval=30s

5.1、配置FileSystem

[shell]# pcs resource create WebFS ocf:heartbeat:Filesystem \

device="/dev/sdb1" directory="/var/www/html" fstype="ext4"

[shell]# pcs resource create WebFS ocf:heartbeat:Filesystem \

device="-U 32937d65eb" directory="/var/www/html" fstype="ext4"

5.2、配置FileSystem-NFS

[shell]# pcs resource create WebFS ocf:heartbeat:Filesystem \

device="192.168.10.18:/mysqldata" directory="/var/lib/mysql" fstype="nfs" \

options="-o username=your_name,password=your_password" \

op start timeout=60s op stop timeout=60s op mon

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值