Pivotal Knowledge Base

Follow

Changing default storage location of PHD logs:

Environment

    • PHD 2.x

Summary

By default icm_client will setup a log directory for each service under /var/log/gphd/ directory to store all the Hadoop related logs.

For example:  The HDFS logs it will be stored under the /var/log/gphd/hadoop-hdfs directory

Here we will discuss how to change the default log directory for HDFS.  This procedure is applicable for Habase, Hive Zookeeper, etc..

And, for example, you wish to change it to /data/log/gphd/hadoop-hdfs directory on all nodes.  And you wish to change HBase, Hive, Zookeeper, etc as well:

Preparing the environment

  1. On PCC node fetch the current cluster configuration
    icm_client fetch-configuration -o ./clusterConfig_log_dir_change -l <your-cluster-id>
  2. cd clusterConfig_log_dir_change/hdfs
  3. Add the below parameter in hadoop-env.sh
    export HADOOP_LOG_DIR=/data/log/gphd/hadoop-hdfs
  4. Create the new directory on all the nodes
    massh hostfile verbose "mkdir -p /data/log/gphd/hadoop-hdfs"
    massh hostfile verbose "chown hdfs:hadoop /data/log/gphd/hadoop-hdfs" 

Changing HBase log location

  1. cd clusterConfig_log_dir_change/hbase
  2. Add the below parameter in hbase-env.sh
    export HBASE_LOG_DIR="/data/log/gphd/hbase"
  3. Create the new directory on all the nodes before restarting the cluster
    massh hostfile verbose "mkdir -p /data/log/gphd/hbase"
    massh hostfile verbose "chown hbase:hbase /data/log/gphd/hbase"

Changing Hive log location

  1. cd clusterConfig_log_dir_change/hive
  2. Add the below parameter in hive-env.sh
    export HIVE_LOG_DIR="/data/log/gphd/hive"
  3. Create the new directory on all the nodes before restarting the cluster
    massh hostfile verbose "mkdir -p /data/log/gphd/hive"
    massh hostfile verbose "chown hive:hive /data/log/gphd/hive" 

Changing YARN log location

  1. cd clusterConfig_log_dir_change/yarn
  2. Add the below parameter in yarn-env.sh
    export YARN_LOG_DIR="/data/log/gphd/hadoop-yarn"
  3. Create the new directory on all the nodes before restarting the cluster
    massh hostfile verbose "mkdir -p /data/log/gphd/hadoop-yarn"
    massh hostfile verbose "chown yarn:hadoop /data/log/gphd/hadoop-yarn"

Changing HistoryServer log location

  1. cd clusterConfig_log_dir_change/yarn
  2. Add the below parameter in mapred-env.sh
    export HADOOP_MAPRED_LOG_DIR="/data/log/gphd/hadoop-mapreduce"
  3. Create the new directory on all the nodes before restarting the cluster
    massh hostfile verbose "mkdir -p /data/log/gphd/hadoop-mapreduce"
    massh hostfile verbose "chown mapred:hadoop /data/log/gphd/hadoop-mapreduce"

Changing Zookeeper log location

  1. cd clusterConfig_log_dir_change/zookeeper
  2. Modify the java.env file and add the following to the JVMFLAGS variable
    -Dzookeeper.log.dir=/data/log/gphd/zookeeper
  3. Therefore, if the original JVMFLAGS was
    export JVMFLAGS="-Xmx2048m"
  4. Change it to be
    export JVMFLAGS="-Xmx2048m -Dzookeeper.log.dir=/var/log/gphd/zookeeper/zk_test"
  5. Create the new directory on all the nodes before restarting the cluster
    massh hostfile verbose "mkdir -p /data/log/gphd/zookeeper"
    massh hostfile verbose "chown zookeeper:zookeeper /data/log/gphd/zookeeper"

Stop the cluster

[gpadmin@pccadmin ~]$ icm_client stop -l <your-cluster-id>
Stopping services
Stopping cluster
[====================================================================================================] 100%
Results:
hdm1.phd.local... [Success]
hdw1.phd.local... [Success]
hdw2.phd.local... [Success]
hdw3.phd.local... [Success]
Details at /var/log/gphd/gphdmgr/gphdmgr-webservices.log

Deploying the change

[gpadmin@pccadmin ~]$ icm_client reconfigure -c clusterConfig_log_dir_change/ -l <your-cluster-id>
Please make sure you have stopped the cluster. (Press 'y' to continue update, any other key to quit): y
Reconfiguring cluster (This might take a few mins)
Please enter the root password for the cluster nodes:
PCC creates a gpadmin user on the newly added cluster nodes (if any). Please enter a non-empty password to be used for the gpadmin user:
Verifying input
Starting update
[====================================================================================================] 100%
Results:
hdm1.phd.local... [Success]
hdw1.phd.local... [Success]
hdw2.phd.local... [Success]
hdw3.phd.local... [Success]
Details at /var/log/gphd/gphdmgr/gphdmgr-webservices.log

Verfication

[gpadmin@hdm1 ~]$ ll /data/log/gphd/hadoop-hdfs
total 290004
-rw-r--r-- 1 hdfs hadoop 26555916 Nov 19 09:56 hadoop-hdfs-namenode-hdm1.phd.local.log
-rw-r--r-- 1 hdfs hadoop 718 Nov 19 09:56 hadoop-hdfs-namenode-hdm1.phd.local.out
-rw-r--r-- 1 hdfs hadoop 718 Nov 19 09:55 hadoop-hdfs-namenode-hdm1.phd.local.out.1
-rw-r--r-- 1 hdfs hadoop 718 Nov 18 16:35 hadoop-hdfs-namenode-hdm1.phd.local.out.2
-rw-r--r-- 1 hdfs hadoop 718 Nov 18 16:32 hadoop-hdfs-namenode-hdm1.phd.local.out.3
-rw-r--r-- 1 hdfs hadoop 718 Oct 21 11:17 hadoop-hdfs-namenode-hdm1.phd.local.out.4
-rw-r--r-- 1 hdfs hadoop 26551 Oct 21 11:17 hadoop-hdfs-zkfc-hdm1.phd.local.log
-rw-r--r-- 1 hdfs hadoop 718 Oct 21 11:17 hadoop-hdfs-zkfc-hdm1.phd.local.out
-rw-r--r-- 1 hdfs hadoop 1898720 Nov 18 10:00 hdfs-audit.log
-rw-r--r-- 1 hdfs hadoop 268435551 Nov 18 06:11 hdfs-audit.log.1
-rw-r--r-- 1 hdfs hadoop 0 Oct 21 11:17 SecurityAuth-hdfs.audit

Comments

Powered by Zendesk