当前位置:网站首页>Apache2 ha experiment with raspberry pie
Apache2 ha experiment with raspberry pie
2022-07-24 13:46:00 【Ki1381】
I heard that raspberry pie is also a financial product , I can't help but fall into meditation after silently closing the website of a treasure , Then I dug out the pile I bought before 3B. Come back , Although the book is full , But I'm not happy . According to Guo Degang , I'm so happy that this pile of raspberry pie can't cure me . Or choose two to make one HA Your experiment , It may be a little happy to make it .
So try this scenario :
A website assumption is very important , When one server hangs up, another one can be on top
The following is the basic information of the experimental equipment :
node 1:hostname ki01;IP:192.168.1.81
node 2:hostname ki02;IP:192.168.1.82
Cluster these two nodes , Virtual out a new address 192.168.1.83. Visit the website and use this address .
How to set fixed IP, How to set hostname Just skip it .
【 The following operations should be performed on both nodes 】
1、 modify /etc/hosts, Forced to join ki01 and ki02 Corresponding IP
192.168.1.81 ki01
192.168.1.82 ki02
2、 Installation required HA Service and make simple initial configuration :
sudo apt install pacemaker pcs resource-agents
sudo systemctl start pcsd.service
sudo systemctl enable pcsd.service
sudo passwd hacluster
Set up hacluster And remember .
【 The following operations only need to be operated on any node 】
3、 Form a cluster
# Forced clean up
sudo pcs cluster destroy
# Register cluster nodes and form a cluster
sudo pcs --force host auth ki01 ki02 -u hacluster -p The password you just set
sudo pcs --force cluster setup kicluster ki01 ki02
4、 Start the cluster and set it to start automatically after power on :
sudo pcs cluster start –-all
sudo pcs cluster enable --all
5、 Ban stonith And arbitration ( For this experiment, none of these is necessary )
sudo pcs property set stonith-enabled=false
sudo pcs property set no-quorum-policy=ignore
【 The following operations should be performed on both nodes 】
6、 install Apache2, And set to prohibit automatic startup :
sudo apt install -y apache2
sudo systemctl stop apache2
sudo systemctl disable apache2
7、 edit /var/www/html/a.html, In order to observe the effect ( This is to ki01 For example .ki02 Just change KI02):
<html>
<body>THIS IS KI01.</body>
</html>
8、 see /etc/apache2/mods-available/status.conf, Confirm the following statement :
<Location /server-status>
SetHandler server-status
Require local
</Location>
【 The following operations only need to be operated on any node 】
9、 Configure cluster resources :WebSite( Corresponding Apache2) And the virtual IP
# establish WebSite Cluster resources
sudo pcs --force resource create WebSite ocf:heartbeat:apache \
configfile=/etc/apache2/apache2.conf \
statusurl="http://localhost/server-status" \
op monitor interval=1min
# establish fictitious IP Cluster resources
sudo pcs --force resource create ClusterIP ocf:heartbeat:IPaddr2 ip=192.168.1.8310、 Set up WebSite And the virtual IP Dependency of 、 Startup sequence 、 Node weight, etc . Normally, it should WebSite And the virtual IP It is on a node :
sudo pcs constraint colocation add WebSite with ClusterIP INFINITY
sudo pcs constraint order ClusterIP then WebSite
sudo pcs constraint location WebSite prefers ki01=50
11、 It can be used at any time sudo pcs status View the status of the cluster . Focus on nodes online/offline state 、 The state of the resource .

At this time, you can use the browser to access http://192.168.1.83/a.html. At the moment, resources are ki01 On , Then it will show THIS IS KI01.
12、 Manual switching test ( The following statement is for the current resource in ki01 Upper ):
sudo pcs resource move WebSite ki02Use sudo pcs status command , And browser access 192.168.1.83 See if it has been cut .
13、 Automatic switching test :
Use sudo pcs status Command or access 192.168.1.83 Determine which node the current resource is on . Then close the node . Normally, you should switch to the surviving node soon . Continue to use on surviving nodes sudo pcs status command , And browser access 192.168.1.83 Confirm whether it works normally .

When the closed node is reopened and online , Because the priority is set ki01=50( The larger the number, the higher the priority ), Resources will still be switched back ki01:

Reference material :
https://clusterlabs.org/quickstart-redhat.html
pcs(8) — pcs — Debian unstable — Debian Manpages
边栏推荐
- 网络安全——文件上传黑名单绕过
- 基于群体熵的机器人群体智能汇聚度量
- R语言使用sort函数排序向量数据实战、返回实际排序后的数据(默认升序)
- R语言epiDisplay包的kap函数计算Kappa统计量的值(总一致性、期望一致性)、对多个评分对象的结果进行一致性分析、评分的类别为多个类别、如果评分中包含缺失值则标准误及其相关统计量则无法计算
- R语言使用epiDisplay包的tableStack函数制作统计汇总表格(基于目标变量分组的描述性统计、假设检验等)、设置by参数为目标变量、设置percent参数配置是否显示百分比信息
- 网络安全——文件上传内容检查绕过
- Group intelligence decision-making in an open environment: concepts, challenges and leading technologies
- Ggarrange function of R language ggpubr package combines multiple images and annotates them_ Figure add annotation, annotation, annotation information for the combined image, and add annotation inform
- R语言使用epiDisplay包的summ函数计算dataframe中指定变量在不同分组变量下的描述性统计汇总信息并可视化有序点图、自定义cex.main参数配置标题文本字体的大小
- How to generate expected data? Emory University and others' latest "deep learning controllable data generation" review, 52 page PDF, covering 346 documents, comprehensively expounds the controllable g
猜你喜欢

Hcip day 13

Unity行人随机行走不碰撞

软链接、硬链接

uni-app 背景音频 熄屏或者退回桌面之后不在播放

基于典型相关分析的多视图学习方法综述

基于图正则化的贝叶斯宽度学习系统
![[untitled]](/img/67/793d1fd7c295f0af9f683ffa389757.png)
[untitled]

网络安全——文件上传渗透测试

How to generate expected data? Emory University and others' latest "deep learning controllable data generation" review, 52 page PDF, covering 346 documents, comprehensively expounds the controllable g

Why are there "two abstract methods" in the functional interface comparator?
随机推荐
[untitled] rhcsa first operation
Network security - war backdoor deployment
Paper notes: swing UNET: UNET like pure transformer for medicalimage segmentation
Data modification modification
Happy number ~ ~ ~ (in fact, I'm not happy at all) & ugly number
How to quickly wrap lines in Excel table
Statistical table of competition time and host school information of 2022 national vocational college skills competition (the second batch)
网络安全——文件上传黑名单绕过
【无标题】
Flinktable & SQL (VII)
网络安全——使用Evil Maid物理访问安全漏洞进行渗透
Aike AI frontier promotion (7.24)
使用Activiti创建数据库表报错,
Difference between code signing certificate and SSL certificate
使用树莓派做Apache2 HA实验
CSP2021 T3 回文
Error reported when using activiti to create a database table
R语言使用epiDisplay包的summ函数计算dataframe中指定变量在不同分组变量下的描述性统计汇总信息并可视化有序点图、自定义cex.main参数配置标题文本字体的大小
Browser failed to get cookies, browser solution
R语言epiDisplay包的kap函数计算Kappa统计量的值(总一致性、期望一致性)、对多个评分对象的结果进行一致性分析、评分的类别为多个类别、如果评分中包含缺失值则标准误及其相关统计量则无法计算