Pacemaker : क्लस्टर संसाधन सेट करें (Apache2)2024/07/23 |
|
Apache httpd क्लस्टर संसाधन सेट करें और सक्रिय/निष्क्रिय वेब सर्वर कॉन्फ़िगर करें।
यह उदाहरण निम्न प्रकार से पर्यावरण पर आधारित है।
+--------------------+
| [ 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] | सभी क्लस्टर नोड्स पर, Apache2 इंस्टॉल करें। |
|
root@node01:~#
apt -y install apache2
root@node01:~#
vi /etc/apache2/conf-available/server-status.conf # नया बनाएं (server-status सक्षम करें)
<Location /server-status>
SetHandler server-status
Require local
</Location>
a2enconf server-status
|
| [2] | जिस नोड पर LVM साझा भंडारण क्लस्टर में सक्रिय है, httpd फ़ाइलों की प्रतिलिपि बनाएँ और एक परीक्षण पृष्ठ बनाएँ। [/dev/vg_ha/lv_ha] नीचे दिए गए उदाहरण में LVM साझा भंडारण है। |
|
root@node01:~# mount /dev/vg_ha/lv_ha /mnt root@node01:~# cp -pR /var/www/* /mnt/ root@node01:~# echo "High Availability Test Page" > /mnt/html/index.html root@node01:~# umount /mnt |
| [3] | जिस नोड पर LVM साझा भंडारण क्लस्टर में सक्रिय है, httpd संसाधन जोड़ें। [/dev/vg_ha/lv_ha] नीचे दिए गए उदाहरण में LVM साझा भंडारण है। |
|
root@node01:~# pcs status
Cluster name: ha_cluster
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: node01.srv.world (version 2.1.6-6fdc9deea29) - partition with quorum
* Last updated: Tue Jul 23 04:19:20 2024 on node01.srv.world
* Last change: Tue Jul 23 04:15:34 2024 by root via cibadmin on node01.srv.world
* 2 nodes configured
* 2 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 node01.srv.world
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
# फ़ाइल सिस्टम संसाधन बनाएँ root@node01:~# pcs resource create httpd_fs ocf:heartbeat:Filesystem device=/dev/vg_ha/lv_ha directory=/var/www fstype=ext4 group ha_group --future
# वर्चुअल आईपी एड्रेस संसाधन बनाएं root@node01:~# pcs resource create httpd_vip ocf:heartbeat:IPaddr2 ip=10.0.0.60 cidr_netmask=24 group ha_group --future
# Apache संसाधन बनाएँ root@node01:~# pcs resource create website ocf:heartbeat:apache configfile=/etc/apache2/apache2.conf statusurl=http://127.0.0.1/server-status group ha_group --future
pcs status
Cluster name: ha_cluster
Cluster Summary:
* Stack: corosync (Pacemaker is running)
* Current DC: node01.srv.world (version 2.1.6-6fdc9deea29) - partition with quorum
* Last updated: Tue Jul 23 04:21:57 2024 on node01.srv.world
* Last change: Tue Jul 23 04:21:51 2024 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 node01.srv.world
* httpd_fs (ocf:heartbeat:Filesystem): Started node01.srv.world
* httpd_vip (ocf:heartbeat:IPaddr2): Started node01.srv.world
* website (ocf:heartbeat:apache): Started node01.srv.world
Daemon Status:
corosync: active/enabled
pacemaker: active/enabled
pcsd: active/enabled
# कामकाज को सत्यापित करने के लिए वीआईपी तक पहुंच root@node01:~# curl http://10.0.0.60/index.html High Availability Test Page |
| Sponsored Link |
|
|