SlideShare a Scribd company logo
1 of 3
Redefining High Availability on Linux Systems with Wake-on-LAN
Goals
- To extend life of our commodity machines
- Consuming lesser power
- Reduce chances for errors
Today there several HA (High Availability) solutions that ensure fault tolerant services running 24x7
without any interruption to the end user. Several IT companies provide readymade solutions and
there are several available through open source too.
This article presents a simple setup of two Linux machines running RHEL 6.2, that with the help of
CRON and Wake-on-LAN technology, can provide 100% system uptime. The logic here is simple, just
like many other production jobs, one wakes up, and lets the other one sleep after handing over all
updated operations.
In production workloads, services are rendered for long durations before a failover takes place. Here
our node would render services considering the fact that a hardware component, OS, and application
does not crash. This design is made to prolong the life of our commodity hardware like desktops or
laptops, so that they continue to run at scheduled times with the help of Wake-on-LAN technology.
We also make use of CRON scheduling to accomplish this.
Setting up is a fairly simple task. Given below are the tasks needed to be performed.
Step 1 – Install RHEL 6.2 on both the machine, named Node1 and Node2 here
Machine 1 Configuration
Hostname node1.virtorg.net
IP Address 192.168.1.101
MAC Address 44:87:FC:7F:6D:75
Subnet mask 255.255.255.0
Gateway 192.168.1.1
Machine 2 Configuration
Hostname node2.virtorg.net
IP Address 192.168.1.102
MAC Address 44:87:FC:7E:91:DD
Subnet mask 255.255.255.0
Gateway 192.168.1.1
Step 2 – Enable Wake-on-LAN service on both the nodes
Most of desktop and laptop grade machines come with Wake-on-LAN technology these days, also
referred to as WOL in short. The benefit Wake-on-LAN or WOL gives us is powering up and down
machines with a magic packet sent over the ethernet LAN. Some Wi-Fi adapters also allow a variation
called Wake-on-Wireless-LAN. Let us get the WOL configured on both the nodes and test powering up
each other thereafter.
[root@node1 ~]# cd /etc/init.d
[root@node1 init.d]# vi wol
#!/bin/bash
#
# wol Wake-on-LAN configuration script
#
# chkconfig: - 99 01
# description: Wake-on-LAN allows a machine to be started using a WoL network packet.
# This script configured WoL on interfaces listed in $NIC.
# processname: -
# config: -
# pidfile: -
# Source function library.
. /etc/rc.d/init.d/functions
# List of NICs to configure for WoL.
# Note: on Xen hosts, use peth0 instead of eth0.
NIC=.eth0.
if [ "$1" != "start" ]; then
exit 0
fi
echo -n .Enabling Wake-on-LAN for:.
for nic in ${NIC};
do
echo -n . ${nic}.
[ -x /sbin/ethtool ] && /sbin/ethtool -s ${nic} wol g >/dev/null 2>&1
done
# Note: no error checking . ethtool does not return a useful exit code
success
echo
# EOF
[root@node1 ~]# chkconfig wol on
[root@node1 ~]# chkconfig --add wol
[root@node1 ~]# service wol start
Repeat the above procedure for node2 also. Once Wake-on-LAN has been set up on both our nodes,
we can manually test the command "ether-wake" to wake up one node from shutdown state to a
running state as given below. The command here will power up the machine having the given MAC
address.
[root@node1 ~]# /sbin/ether-wake -i eth0 44:87:fc:7e:91:dd
Step 3 – Here is how CRON is configured on both the nodes
Node 1
======
[root@node1 ~]# crontab -l
15 * * * * /sbin/ether-wake -i eth0 44:87:fc:7e:91:dd
20 * * * * /sbin/poweroff
45 * * * * /sbin/ether-wake -i eth0 44:87:fc:7e:91:dd
50 * * * * /sbin/poweroff
Node 2
======
[root@node2 ~]# crontab -l
30 * * * * /sbin/ether-wake -i eth0 44:87:fc:7f:6d:75
35 * * * * /sbin/poweroff
00 * * * * /sbin/ether-wake -i eth0 44:87:fc:7f:6d:75
05 * * * * /sbin/poweroff
With the above configuration, at every 15th and 45th minute, node1 powers on node2, and shuts
down after 5 minutes. Likewise node2 powers up node1 at 30th and 00th minute and powers itself off
after 5 minutes. This cycle continues every hour, and chronologically at 00th minute, node1 is up, at
15th minute, node2 is up, at 30th minute, again node1 is up, and at 45 minute, node2 is up, thereby
repowering up node1 at 00th minute.
Why such a design ? What are the advantages ?
This type of design can be used in many kinds of services. Some examples are highly available Web
server, HADOOP clusters, MySQL database server with replication and so forth. Tutorials on setting up
an HA cluster using Heartbeat are available separately. For now, this is the first step to extend our
commodity infrastructure's life.
Written on 3rd Dec, 2013
Author : Manish Chopra

More Related Content

More from Manish Chopra

Big-Data-Seminar-6-Aug-2014-Koenig
Big-Data-Seminar-6-Aug-2014-KoenigBig-Data-Seminar-6-Aug-2014-Koenig
Big-Data-Seminar-6-Aug-2014-Koenig
Manish Chopra
 
Computer_Clustering_Technologies
Computer_Clustering_TechnologiesComputer_Clustering_Technologies
Computer_Clustering_Technologies
Manish Chopra
 

More from Manish Chopra (15)

Ansible Study Guide ToC
Ansible Study Guide ToCAnsible Study Guide ToC
Ansible Study Guide ToC
 
Microservices with Dockers and Kubernetes
Microservices with Dockers and KubernetesMicroservices with Dockers and Kubernetes
Microservices with Dockers and Kubernetes
 
Unix and Linux Operating Systems
Unix and Linux Operating SystemsUnix and Linux Operating Systems
Unix and Linux Operating Systems
 
Working with Hive Analytics
Working with Hive AnalyticsWorking with Hive Analytics
Working with Hive Analytics
 
Preparing a Dataset for Processing
Preparing a Dataset for ProcessingPreparing a Dataset for Processing
Preparing a Dataset for Processing
 
Organizations with largest hadoop clusters
Organizations with largest hadoop clustersOrganizations with largest hadoop clusters
Organizations with largest hadoop clusters
 
Distributed File Systems
Distributed File SystemsDistributed File Systems
Distributed File Systems
 
Difference between hadoop 2 vs hadoop 3
Difference between hadoop 2 vs hadoop 3Difference between hadoop 2 vs hadoop 3
Difference between hadoop 2 vs hadoop 3
 
Oracle solaris 11 installation
Oracle solaris 11 installationOracle solaris 11 installation
Oracle solaris 11 installation
 
Emergence and Importance of Cloud Computing for the Enterprise
Emergence and Importance of Cloud Computing for the EnterpriseEmergence and Importance of Cloud Computing for the Enterprise
Emergence and Importance of Cloud Computing for the Enterprise
 
Steps to create an RPM package in Linux
Steps to create an RPM package in LinuxSteps to create an RPM package in Linux
Steps to create an RPM package in Linux
 
Setting up a HADOOP 2.2 cluster on CentOS 6
Setting up a HADOOP 2.2 cluster on CentOS 6Setting up a HADOOP 2.2 cluster on CentOS 6
Setting up a HADOOP 2.2 cluster on CentOS 6
 
The Anatomy of GOOGLE Search Engine
The Anatomy of GOOGLE Search EngineThe Anatomy of GOOGLE Search Engine
The Anatomy of GOOGLE Search Engine
 
Big-Data-Seminar-6-Aug-2014-Koenig
Big-Data-Seminar-6-Aug-2014-KoenigBig-Data-Seminar-6-Aug-2014-Koenig
Big-Data-Seminar-6-Aug-2014-Koenig
 
Computer_Clustering_Technologies
Computer_Clustering_TechnologiesComputer_Clustering_Technologies
Computer_Clustering_Technologies
 

Recently uploaded

Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
UK Journal
 

Recently uploaded (20)

Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4j
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101AI presentation and introduction - Retrieval Augmented Generation RAG 101
AI presentation and introduction - Retrieval Augmented Generation RAG 101
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 

Redefining High Availability on Linux Systems with Wake-on-LAN

  • 1. Redefining High Availability on Linux Systems with Wake-on-LAN Goals - To extend life of our commodity machines - Consuming lesser power - Reduce chances for errors Today there several HA (High Availability) solutions that ensure fault tolerant services running 24x7 without any interruption to the end user. Several IT companies provide readymade solutions and there are several available through open source too. This article presents a simple setup of two Linux machines running RHEL 6.2, that with the help of CRON and Wake-on-LAN technology, can provide 100% system uptime. The logic here is simple, just like many other production jobs, one wakes up, and lets the other one sleep after handing over all updated operations. In production workloads, services are rendered for long durations before a failover takes place. Here our node would render services considering the fact that a hardware component, OS, and application does not crash. This design is made to prolong the life of our commodity hardware like desktops or laptops, so that they continue to run at scheduled times with the help of Wake-on-LAN technology. We also make use of CRON scheduling to accomplish this. Setting up is a fairly simple task. Given below are the tasks needed to be performed. Step 1 – Install RHEL 6.2 on both the machine, named Node1 and Node2 here Machine 1 Configuration Hostname node1.virtorg.net IP Address 192.168.1.101 MAC Address 44:87:FC:7F:6D:75 Subnet mask 255.255.255.0 Gateway 192.168.1.1 Machine 2 Configuration Hostname node2.virtorg.net IP Address 192.168.1.102 MAC Address 44:87:FC:7E:91:DD Subnet mask 255.255.255.0 Gateway 192.168.1.1
  • 2. Step 2 – Enable Wake-on-LAN service on both the nodes Most of desktop and laptop grade machines come with Wake-on-LAN technology these days, also referred to as WOL in short. The benefit Wake-on-LAN or WOL gives us is powering up and down machines with a magic packet sent over the ethernet LAN. Some Wi-Fi adapters also allow a variation called Wake-on-Wireless-LAN. Let us get the WOL configured on both the nodes and test powering up each other thereafter. [root@node1 ~]# cd /etc/init.d [root@node1 init.d]# vi wol #!/bin/bash # # wol Wake-on-LAN configuration script # # chkconfig: - 99 01 # description: Wake-on-LAN allows a machine to be started using a WoL network packet. # This script configured WoL on interfaces listed in $NIC. # processname: - # config: - # pidfile: - # Source function library. . /etc/rc.d/init.d/functions # List of NICs to configure for WoL. # Note: on Xen hosts, use peth0 instead of eth0. NIC=.eth0. if [ "$1" != "start" ]; then exit 0 fi echo -n .Enabling Wake-on-LAN for:. for nic in ${NIC}; do echo -n . ${nic}. [ -x /sbin/ethtool ] && /sbin/ethtool -s ${nic} wol g >/dev/null 2>&1 done # Note: no error checking . ethtool does not return a useful exit code success echo # EOF [root@node1 ~]# chkconfig wol on [root@node1 ~]# chkconfig --add wol [root@node1 ~]# service wol start
  • 3. Repeat the above procedure for node2 also. Once Wake-on-LAN has been set up on both our nodes, we can manually test the command "ether-wake" to wake up one node from shutdown state to a running state as given below. The command here will power up the machine having the given MAC address. [root@node1 ~]# /sbin/ether-wake -i eth0 44:87:fc:7e:91:dd Step 3 – Here is how CRON is configured on both the nodes Node 1 ====== [root@node1 ~]# crontab -l 15 * * * * /sbin/ether-wake -i eth0 44:87:fc:7e:91:dd 20 * * * * /sbin/poweroff 45 * * * * /sbin/ether-wake -i eth0 44:87:fc:7e:91:dd 50 * * * * /sbin/poweroff Node 2 ====== [root@node2 ~]# crontab -l 30 * * * * /sbin/ether-wake -i eth0 44:87:fc:7f:6d:75 35 * * * * /sbin/poweroff 00 * * * * /sbin/ether-wake -i eth0 44:87:fc:7f:6d:75 05 * * * * /sbin/poweroff With the above configuration, at every 15th and 45th minute, node1 powers on node2, and shuts down after 5 minutes. Likewise node2 powers up node1 at 30th and 00th minute and powers itself off after 5 minutes. This cycle continues every hour, and chronologically at 00th minute, node1 is up, at 15th minute, node2 is up, at 30th minute, again node1 is up, and at 45 minute, node2 is up, thereby repowering up node1 at 00th minute. Why such a design ? What are the advantages ? This type of design can be used in many kinds of services. Some examples are highly available Web server, HADOOP clusters, MySQL database server with replication and so forth. Tutorials on setting up an HA cluster using Heartbeat are available separately. For now, this is the first step to extend our commodity infrastructure's life. Written on 3rd Dec, 2013 Author : Manish Chopra