`
sillycat
  • 浏览: 2527444 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Pacemaker 2019(1)Introduction and Installation on CentOS7

 
阅读更多
Pacemaker 2019(1)Introduction and Installation on CentOS7

Try that on my CentOS7
https://clusterlabs.org/quickstart-redhat.html

Install that on my system via yum
> sudo yum install pacemaker pcs resource-agents

Create the Cluster
It is on top of Corosync 2, so make sure pcs daemon is running
> sudo systemctl start pcsd.service
> sudo systemctl enable pcsd.service

Set up user and password
> echo password123 | sudo passwd --stdin hacluster
Changing password for user hacluster.
passwd: all authentication tokens updated successfully.

> sudo pcs cluster auth centos-dev1 centos-dev2 -u hacluster -p password123 --force
centos-dev1: Authorized
centos-dev2: Authorized

Create first cluster as peacemaker1
> sudo pcs cluster setup --force --name pacemaker1 centos-dev1 centos-dev2
Destroying cluster on nodes: centos-dev1, centos-dev2...
centos-dev2: Stopping Cluster (pacemaker)...
centos-dev1: Stopping Cluster (pacemaker)...
centos-dev2: Successfully destroyed cluster
centos-dev1: Successfully destroyed cluster
Sending 'pacemaker_remote authkey' to 'centos-dev1', 'centos-dev2'
centos-dev1: successful distribution of the file 'pacemaker_remote authkey'
centos-dev2: successful distribution of the file 'pacemaker_remote authkey'
Sending cluster config files to the nodes...
centos-dev1: Succeeded
centos-dev2: Succeeded
Synchronizing pcsd certificates on nodes centos-dev1, centos-dev2...
centos-dev1: Success
centos-dev2: Success
Restarting pcsd on the nodes in order to reload the certificates...
centos-dev1: Success
centos-dev2: Success

Start the Cluster
> sudo pcs cluster start --all
centos-dev1: Starting Cluster (corosync)...
centos-dev2: Starting Cluster (corosync)...
centos-dev2: Starting Cluster (pacemaker)...
centos-dev1: Starting Cluster (pacemaker)...

Enable that on boot
> sudo pcs cluster enable --all
centos-dev1: Cluster Enabled
centos-dev2: Cluster Enabled

Install nginx and run the static page there
> sudo yum install nginx -y
> sudo systemctl enable nginx
> sudo systemctl start nginx

Go and modify the default nginx page
> sudo vi /usr/share/nginx/html/index.html
Webserver-1

> sudo vi /usr/share/nginx/html/index.html
Webserver-2

Check cluster status
> sudo pcs status
Cluster name: pacemaker1
WARNINGS:
No stonith devices and stonith-enabled is not false
Stack: corosync
Current DC: centos-dev1 (version 1.1.19-8.el7_6.4-c3c624ea3d) - partition with quorum
Last updated: Tue Sep 10 16:04:42 2019
Last change: Tue Sep 10 15:44:26 2019 by hacluster via crmd on centos-dev1
2 nodes configured
0 resources configured
Online: [ centos-dev1 centos-dev2 ]
No resources
Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

Disable STONITH
> sudo pcs property set stonith-enabled=false

Check status again
> sudo pcs status
Cluster name: pacemaker1
Stack: corosync
Current DC: centos-dev1 (version 1.1.19-8.el7_6.4-c3c624ea3d) - partition with quorum
Last updated: Tue Sep 10 16:06:54 2019
Last change: Tue Sep 10 16:06:42 2019 by root via cibadmin on centos-dev1
2 nodes configured
0 resources configured
Online: [ centos-dev1 centos-dev2 ]
No resources
Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled

Ignore the Quorum Policy
> sudo pcs property set no-quorum-policy=ignore

Check the features
> sudo pcs property list
Cluster Properties:
cluster-infrastructure: corosync
cluster-name: pacemaker1
dc-version: 1.1.19-8.el7_6.4-c3c624ea3d
have-watchdog: false
no-quorum-policy: ignore
stonith-enabled: false

Add Resources floatingIP
> sudo pcs resource create v_ip ocf:heartbeat:IPaddr2 ip=192.168.56.110 cidr_netmask=32 op monitor interval=20s

Add Resource web server
> sudo pcs resource create webserver ocf:heartbeat:nginx configfile=/etc/nginx/nginx.conf op monitor timeout="5s" interval="5s"

Check resources
> sudo pcs status resources
v_ip (ocf::heartbeat:IPaddr2): Started centos-dev1
webserver (ocf::heartbeat:nginx): Started centos-dev2

Resources running on the same node
> sudo pcs constraint colocation add webserver v_ip INFINITY

> sudo pcs status resources
v_ip (ocf::heartbeat:IPaddr2): Started centos-dev1
webserver (ocf::heartbeat:nginx): Started centos-dev1

Set the running order of the resources
> sudo pcs constraint order v_ip then webserver
Adding v_ip webserver (kind: Mandatory) (Options: first-action=start then-action=start)

Check status again
> sudo pcs status resources
v_ip (ocf::heartbeat:IPaddr2): Started centos-dev1
webserver (ocf::heartbeat:nginx): Started centos-dev1

Visit the floating IP, you will see the web server
http://192.168.56.110/

Stop the cluster
> sudo pcs cluster stop centos-dev1

The service goes to server 2
> sudo pcs status resources
v_ip (ocf::heartbeat:IPaddr2): Started centos-dev2
webserver (ocf::heartbeat:nginx): Started centos-dev2

Pacemaker/Corosync.    VS.  HAProxy/Keepalived

Check resources
> sudo pcs resource standards
[sudo] password for carl:
lsb
ocf
service
systemd

> sudo pcs resource providers
heartbeat
openstack
pacemaker

> sudo pcs resource agents
aliyun-vpc-move-ip
apache
arp-ethers
arp-ethers
attribute
auditd
…snip…

All the files are here
> cd /usr/lib/ocf/resource.d/

Check the help file
> sudo pcs resource describe ocf:heartbeat:nginx

Customer Resource
https://blog.csdn.net/tantexian/article/details/50160159
https://unix.stackexchange.com/questions/303814/pacemaker-corosync-ha-simple-custom-resource-testing-status-flapping-s
https://dopensource.com/2017/04/27/creating-custom-ocf-resource-agents/

List the LSB services
> sudo pcs resource agents lsb
netconsole
network

List the OCF
> sudo pcs resource agents ocf
apache
attribute
aws-vpc-move-ip
awseip



References:
https://blog.51cto.com/freeloda/1274533
https://clusterlabs.org/
https://clusterlabs.org/quickstart.html
https://clusterlabs.org/quickstart-redhat.html
https://www.dreamvps.com/tutorials/set-nginx-high-availability-cluster-using-pacemaker-centos-7/
https://www.sharpcode.cn/linux/cluster-corosync-pacemaker/

https://stackoverflow.com/questions/45166494/pacemaker-adding-custom-resource

分享到:
评论

相关推荐

    pacemaker on centos7

    在本文中,我们将详细探讨在CentOS 7系统上配置Pacemaker集群,包括Corosync和DRBD技术来实现主从或双主高可用性集群的技术细节。为了更好地理解,我们首先需要对Pacemaker、Corosync和DRBD等概念有一个清晰的认识。...

    CentOS7/RHEL7 pacemaker+corosync高可用集群搭建.pdf

    在本文档中,重点介绍了在CentOS7或RHEL7操作系统环境下,如何搭建基于pacemaker和corosync组件的高可用性(High Availability, HA)集群。集群技术的主要目的是通过冗余配置,确保关键服务的持续可用性和故障转移...

    CentOS7.1 PaceMaker3节点集群部署实例

    7. **启动服务和验证**: 分别在每个节点上启动 Corosync 和 Pacemaker 服务,并使用 `pcs status` 检查集群状态。 8. **测试故障转移**: 可以通过手动停止单个节点的服务,观察 Pacemaker 是否能够正确地将服务转移...

    Pacemaker从头开始搭建集群

    1. 配置Pacemaker集群: ```bash crm cluster setup --name=mycluster IP_ADDRESS_OF_SERVER1 IP_ADDRESS_OF_SERVER2 ``` 2. 配置Pacemaker资源: ```bash crm configure primitive example_resource ocf:...

    linux高可用集群(centos7)

    ### Linux高可用集群(CentOS 7) #### 知识点概述 本文旨在详细介绍如何在CentOS 7环境中搭建一个高可用(High Availability, HA)集群。该集群使用Pacemaker作为核心组件来管理资源和服务的高可用性,具体包括...

    CentOS 7是CentOS项目发布的一个开源类服务器操作系统,于2014年7月7日正式发布 以下是对CentOS 7的详细介

    centos7CentOS 7是CentOS项目发布的一个开源类服务器操作系统,于2014年7月7日正式发布。以下是对CentOS 7的详细介绍: 一、系统概述 发布时间:2014年7月7日 最新版本:CentOS 7.9.2009(于2020年11月12日发布) ...

    CentOS7通过HeartBeat配置实现高可用HA.rar

    在CentOS 7中,HeartBeat已经演进为Pacemaker和Corosync的组合,但这里我们将沿用HeartBeat这一术语,以描述传统的高可用性架构。 接下来,我们详细解析配置过程: 1. **安装HeartBeat**:在两台CentOS 7服务器上...

    CentOS7+Redis5集群搭建.md

    CentOS7+Redis5集群搭建.md

    Pacemaker-2.0-Pacemaker_Explained-en-US.pdf

    Pacemaker是一个开源的集群资源管理器,主要用于配置和管理高可用性集群。它是基于开源社区开发的项目,旨在提供跨多个服务器的资源管理,确保关键应用和服务的高可用性和负载均衡。Pacemaker通过协同工作,实现了...

    Embedded.Systems.Introduction

    This first book is an introduction to computers and interfacing focusing on assembly language and C programming. The second book Embedded Systems: Real-Time Interfacing to ARM Cortex-M ...

    Pacemaker高可用原理

    在redhat7以后发行版中,红帽公司将rhel6之前的RHCS集群套件改成了Corosync+pacemaker的方式

    CentOS 7下怎么搭建高可用集群?.docx

    CentOS 7 下搭建高可用集群 本文档将指导您在 CentOS 7 下搭建高可用集群。高可用集群是一种服务器集群技术,旨在减少服务中断时间,保护用户的业务程序对外不间断提供服务,将因软件、硬件或人为造成的故障对业务...

    CENTOS集群配置

    1. **安装CentOS 5.3**:在每台虚拟机上安装相同版本的CentOS操作系统。 2. **网络配置**:设置适当的网络拓扑,如心跳网络和公共网络,以实现节点间的通信和外部访问。 3. **集群软件安装**:安装并配置Heartbeat或...

Global site tag (gtag.js) - Google Analytics