- 浏览: 2542507 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
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
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
发表评论
-
Update Site will come soon
2021-06-02 04:10 1672I am still keep notes my tech n ... -
Stop Update Here
2020-04-28 09:00 310I will stop update here, and mo ... -
NodeJS12 and Zlib
2020-04-01 07:44 468NodeJS12 and Zlib It works as ... -
Docker Swarm 2020(2)Docker Swarm and Portainer
2020-03-31 23:18 362Docker Swarm 2020(2)Docker Swar ... -
Docker Swarm 2020(1)Simply Install and Use Swarm
2020-03-31 07:58 364Docker Swarm 2020(1)Simply Inst ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 330Traefik 2020(1)Introduction and ... -
Portainer 2020(4)Deploy Nginx and Others
2020-03-20 12:06 424Portainer 2020(4)Deploy Nginx a ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 428Private Registry 2020(1)No auth ... -
Docker Compose 2020(1)Installation and Basic
2020-03-15 08:10 366Docker Compose 2020(1)Installat ... -
VPN Server 2020(2)Docker on CentOS in Ubuntu
2020-03-02 08:04 445VPN Server 2020(2)Docker on Cen ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 377Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 468NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 414Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 332Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 243GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 445GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 321GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 307Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 310Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 286Serverless with NodeJS and Tenc ...
相关推荐
在本文中,我们将详细探讨在CentOS 7系统上配置Pacemaker集群,包括Corosync和DRBD技术来实现主从或双主高可用性集群的技术细节。为了更好地理解,我们首先需要对Pacemaker、Corosync和DRBD等概念有一个清晰的认识。...
在本文档中,重点介绍了在CentOS7或RHEL7操作系统环境下,如何搭建基于pacemaker和corosync组件的高可用性(High Availability, HA)集群。集群技术的主要目的是通过冗余配置,确保关键服务的持续可用性和故障转移...
7. **启动服务和验证**: 分别在每个节点上启动 Corosync 和 Pacemaker 服务,并使用 `pcs status` 检查集群状态。 8. **测试故障转移**: 可以通过手动停止单个节点的服务,观察 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高可用集群(CentOS 7) #### 知识点概述 本文旨在详细介绍如何在CentOS 7环境中搭建一个高可用(High Availability, HA)集群。该集群使用Pacemaker作为核心组件来管理资源和服务的高可用性,具体包括...
centos7CentOS 7是CentOS项目发布的一个开源类服务器操作系统,于2014年7月7日正式发布。以下是对CentOS 7的详细介绍: 一、系统概述 发布时间:2014年7月7日 最新版本:CentOS 7.9.2009(于2020年11月12日发布) ...
在CentOS 7中,HeartBeat已经演进为Pacemaker和Corosync的组合,但这里我们将沿用HeartBeat这一术语,以描述传统的高可用性架构。 接下来,我们详细解析配置过程: 1. **安装HeartBeat**:在两台CentOS 7服务器上...
CentOS7+Redis5集群搭建.md
Pacemaker是一个开源的集群资源管理器,主要用于配置和管理高可用性集群。它是基于开源社区开发的项目,旨在提供跨多个服务器的资源管理,确保关键应用和服务的高可用性和负载均衡。Pacemaker通过协同工作,实现了...
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 ...
在redhat7以后发行版中,红帽公司将rhel6之前的RHCS集群套件改成了Corosync+pacemaker的方式
CentOS 7 下搭建高可用集群 本文档将指导您在 CentOS 7 下搭建高可用集群。高可用集群是一种服务器集群技术,旨在减少服务中断时间,保护用户的业务程序对外不间断提供服务,将因软件、硬件或人为造成的故障对业务...
1. **安装CentOS 5.3**:在每台虚拟机上安装相同版本的CentOS操作系统。 2. **网络配置**:设置适当的网络拓扑,如心跳网络和公共网络,以实现节点间的通信和外部访问。 3. **集群软件安装**:安装并配置Heartbeat或...
《Pacemaker入门手册:从零构建集群》 在IT领域,高可用性和容错性是企业级应用不可或缺的一部分,而集群技术则是实现这一目标的关键。Pacemaker,作为一款强大的集群资源管理器,被广泛应用于Linux环境中,用于...