Pacemaker : Set Cluster Resource (Apache2)2023/07/27 |
|
Set Apache httpd Cluster Resource and Configure Active/Passive Web Server.
This example is based on the environment like follows.
+--------------------+
| [ ISCSI Target ] |
| dlp.srv.world |
+----------+---------+
10.0.0.30|
|
+----------------------+ | +----------------------+
| [ Cluster Node#1 ] |10.0.0.51 | 10.0.0.52| [ Cluster Node#2 ] |
| node01.srv.world +----------+----------+ node02.srv.world |
| Apache httpd | | | Apache httpd |
+----------------------+ | +----------------------+
vip:10.0.0.60
|
+----------+---------+
| [ Clients ] |
| |
+--------------------+
|
| [1] | On all Cluster Nodes, Install Apache2. |
|
root@node02:~#
apt -y install apache2
root@node02:~#
vi /etc/apache2/conf-available/server-status.conf # create new (enable server-status)
<Location /server-status>
SetHandler server-status
Require local
</Location>
a2enconf server-status
|
| [2] | On a Node that LVM shared storage is active in Cluster, Copy httpd files and create a Test page. [/dev/vg_ha/lv_ha] on the example below is LVM shared storage. |
|
root@node02:~# mount /dev/vg_ha/lv_ha /mnt root@node02:~# cp -pR /var/www/* /mnt/ root@node02:~# echo "High Availability Test Page" > /mnt/html/index.html root@node02:~# umount /mnt |
| [3] | On a Node that LVM shared storage is active in Cluster, Add httpd resource. [/dev/vg_ha/lv_ha] on the example below is LVM shared storage. |
|
# create filesystem resource root@node02:~# pcs resource create httpd_fs ocf:heartbeat:Filesystem device=/dev/vg_ha/lv_ha directory=/var/www fstype=ext4 --group ha_group
# create virtual IP address resource root@node02:~# pcs resource create httpd_vip ocf:heartbeat:IPaddr2 ip=10.0.0.60 cidr_netmask=24 --group ha_group
# create Apache resource root@node02:~# pcs resource create website ocf:heartbeat:apache configfile=/etc/apache2/apache2.conf statusurl=http://127.0.0.1/server-status --group ha_group
pcs status
Cluster name: ha_cluster
Status of pacemakerd: 'Pacemaker is running' (last updated 2023-07-26 23:07:37 -05:00)
Cluster Summary:
* Stack: corosync
* Current DC: node02.srv.world (version 2.1.5-a3f44794f94) - partition with quorum
* Last updated: Wed Jul 26 23:07:38 2023
* Last change: Wed Jul 26 23:07:34 2023 by root via cibadmin on node01.srv.world
* 2 nodes configured
* 5 resource instances configured
Node List:
* Online: [ node01.srv.world node02.srv.world ]
Full List of Resources:
* scsi-shooter (stonith:fence_scsi): Started node01.srv.world
* Resource Group: ha_group:
* lvm_ha (ocf:heartbeat:LVM-activate): Started node02.srv.world
* httpd_fs (ocf:heartbeat:Filesystem): Started node02.srv.world
* httpd_vip (ocf:heartbeat:IPaddr2): Started node02.srv.world
* website (ocf:heartbeat:apache): Started node02.srv.world
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
# access to vip to verify working root@node02:~# curl http://10.0.0.60/index.html High Availability Test Page |
| Sponsored Link |
|
|