Support Questions

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

For CDH 5.7.0 what is the full path to an HDFS datanode's PID file?

avatar
Explorer

For CDH 5.7.0 what is the full path to an HDFS datanode's PID file?

1 ACCEPTED SOLUTION

avatar
Master Guru

@JeffKubina

 

Oops, that was overkill... forgot that supervisorctl status output has the PID column already...  So, you can run:

 

/usr/lib64/cmf/agent/build/env/bin/supervisorctl -c /var/run/cloudera-scm-agent/supervisor/supervisord.conf status

 

The PID will be the 4th column.

 

-Ben

View solution in original post

11 REPLIES 11

avatar
Champion

Could you check your /tmp . 

 

avatar
Explorer
I did, it's not in /tmp.

avatar
Champion

check the status of datanode dameon in that host

meantime the pfile should be in 

/var/run/hadoop-hdfs/hadoop-hdfs-datanode.pid

avatar
Explorer
I can get the PID via a "pgrep -fa datanode" but would prefer to find where
it writes its PID to a file.

avatar
Champion

Check the below location for datanode pid file 

/var/run/hadoop-hdfs/

avatar
Master Guru

@JeffKubina,

 

Since the supervisor starts CM managed processes, there is no PID file for the processes it starts.

 

Short answer:  there is no PID file.

 

-Ben

avatar
Explorer
So what is the recommended way of getting the datanodes PID?

avatar
Master Guru

@JeffKubina,

 

While there are a number of ways to get the PID (like ps aux |grep ....), this is one I just thought up:

 

/usr/lib64/cmf/agent/build/env/bin/supervisorctl -c /var/run/cloudera-scm-agent/supervisor/supervisord.conf pid `ls -lrt /var/run/cloudera-scm-agent/process/ | awk '{print $9}' |grep DATANODE| tail -1`

 

What it does is run supervisor's client using the Cloudera Manager sueprvisord.conf file to retrieve a pid file.  The backticks execute a command to get the most recent process directory to pass into the "pid" command of supervisorctl.  You can see the process names and statuses using the following:

 

/usr/lib64/cmf/agent/build/env/bin/supervisorctl -c /var/run/cloudera-scm-agent/supervisor/supervisord.conf status

 

-Ben

avatar
Master Guru

@JeffKubina

 

Oops, that was overkill... forgot that supervisorctl status output has the PID column already...  So, you can run:

 

/usr/lib64/cmf/agent/build/env/bin/supervisorctl -c /var/run/cloudera-scm-agent/supervisor/supervisord.conf status

 

The PID will be the 4th column.

 

-Ben