Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

how to check uptime of hadoop services

avatar

I want to check from when hadoop services are up or running . is there some command to check same ?

for e.g if there is hbase service i want to check its uptime in other way its last start time . in the same way I want to check for other hadoop services as well.

Thanks in advance

1 ACCEPTED SOLUTION

avatar
Master Mentor

@Anurag Mishra

The HDFS Service is a combination of various components like NameNoides, DataNodes, ZKFC, JournalNodes ..etc So the Service Up time really does not make much sense because in a Service 90% components might be UP but some of them (10%) might be down ... So i will suggest you to check the "Service Component" UP time instead of finding the "Service" up time.

The easiest option to capture the "Service Component" uptime will be to see the "uptime" field in the following command for the component:

For example finding DataNode Uptime:

# ps -ef | grep `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` | awk 'NR==1{print $5 " - "  $7}'
Mar02 - 03:43:47

.

Similarly you can run the following commands to find NameNode, JournalNode Uptime ...etc

#  ps -ef | grep `cat /var/run/hadoop/hdfs/hadoop-hdfs-journalnode.pid` | awk 'NR==1{print $5 " - "  $7}'
#  ps -ef | grep `cat /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid` | awk 'NR==1{print $5 " - "  $7}'

.

The output of Column 5 and column 7 shows the Uptime (date & time)

Example:

#  ps -ef | grep `cat /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid`
root       519 31846  0 23:23 pts/0    00:00:00 grep --color=auto 17262
hdfs     17262     1  0 Mar02 ?        07:55:29 /usr/jdk64/jdk1.8.0_112/bin/java -Dproc_namenode -Xmx1024m -Dhdp.version=2.6.1.0-129 -Djava.net.preferIPv4Stack=true -Dhdp.version= -Djava.net.preferIPv4Stack=true -Dhdp.version= -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/var/log/hadoop/hdfs..........
 -Dhadoop.security.logger=INFO,RFAS org.apache.hadoop.hdfs.server.namenode.NameNode

.

View solution in original post

2 REPLIES 2

avatar
Master Mentor

@Anurag Mishra

The HDFS Service is a combination of various components like NameNoides, DataNodes, ZKFC, JournalNodes ..etc So the Service Up time really does not make much sense because in a Service 90% components might be UP but some of them (10%) might be down ... So i will suggest you to check the "Service Component" UP time instead of finding the "Service" up time.

The easiest option to capture the "Service Component" uptime will be to see the "uptime" field in the following command for the component:

For example finding DataNode Uptime:

# ps -ef | grep `cat /var/run/hadoop/hdfs/hadoop-hdfs-datanode.pid` | awk 'NR==1{print $5 " - "  $7}'
Mar02 - 03:43:47

.

Similarly you can run the following commands to find NameNode, JournalNode Uptime ...etc

#  ps -ef | grep `cat /var/run/hadoop/hdfs/hadoop-hdfs-journalnode.pid` | awk 'NR==1{print $5 " - "  $7}'
#  ps -ef | grep `cat /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid` | awk 'NR==1{print $5 " - "  $7}'

.

The output of Column 5 and column 7 shows the Uptime (date & time)

Example:

#  ps -ef | grep `cat /var/run/hadoop/hdfs/hadoop-hdfs-namenode.pid`
root       519 31846  0 23:23 pts/0    00:00:00 grep --color=auto 17262
hdfs     17262     1  0 Mar02 ?        07:55:29 /usr/jdk64/jdk1.8.0_112/bin/java -Dproc_namenode -Xmx1024m -Dhdp.version=2.6.1.0-129 -Djava.net.preferIPv4Stack=true -Dhdp.version= -Djava.net.preferIPv4Stack=true -Dhdp.version= -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/var/log/hadoop/hdfs..........
 -Dhadoop.security.logger=INFO,RFAS org.apache.hadoop.hdfs.server.namenode.NameNode

.

avatar
Master Mentor

@Anurag Mishra

Similarly for HBase processes you can run the following command to find the Uptime of HBase Master & HBase Region Server.

# ps -ef | grep `cat /var/run/hbase/hbase-hbase-master.pid`| awk 'NR==1{print $5 " - "  $7}'
# ps -ef | grep `cat /var/run/hbase/hbase-hbase-regionserver.pid`| awk 'NR==1{print $5 " - "  $7}'

.