Monday, November 30, 2015

Ambari - configure email notification using sendmail (HDP)

  1. start sendmail on the host where ambari server runs
    1. service sendmail start
  2. ambari web -> alerts -> actions -> manage notifications -> "+"
  3. name
    1. test
  4. groups
    1. all
  5. use default value for others
  6. save
  7. test
    1. select one service/component and stop/start it

Manual Upgrade HDP 2.2 to 2.3

  1. option - local repository setting for HDP 2.2 update (temporary internet access)
    1. cd /etc/yum.repos.d
    2. rm -fambari* HDP*
    3. wget http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.1.0/ambari.repo
    4. wget http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.0.0/hdp.repo
    5. yum -y install yum-utils createrepo
    6. install and run web server
      1. HTTPD
    7. mkdir -p /var/www/html/
    8. cd /var/www/html/
    9. mkdir -p ambari/centos6
    10. cd ambari/centos6
    11. reposync -r Updates-ambari-2.1.0
    12. createrepo Updates-ambari-2.1.0
    13. cd /var/www/html/
    14. mkdir -p hdp/centos6
    15. cd hdp/centos6
    16. reposync -r HDP-2.3.0.0
    17. reposync -r HDP-UTILS-1.1.0.20
    18. createrepo HDP-2.3.0.0
    19. createrepo HDP-UTILS-1.1.0.20
    20. edit DocumentRoot and Directory at /usr/local/apache2/conf/httpd.conf or
      1. cd /usr/local/apache2/htdocs
      2. ln -s /var/www/html/ambari ambari
      3. ln -s /var/www/html/hdp hdp
    21. http://hostname/ambari/centos6/Updates-ambari-2.1.0
    22. http://hostname/hdp/centos6/HDP-2.3.0.0
    23. http://hostname/hdp/centos6/HDP-UTILS-1.1.0.20
    24. option (If you have multiple repositories configured in your environment)
      1. yum -y install yum-plugin-priorities
      2. vim /etc/yum/pluginconf.d/priorities.conf
        1. [main]
        2. enabled=1
        3. gpgcheck=0
    25. stop web server at the end
      1. /usr/local/apache2/bin/apachectl -k stop
  2. Upgrading ambari 2.0 to 2.1 (HDP)
    1. http://mungeol-heo.blogspot.kr/2015/11/upgrading-ambari-20-to-21-hdp.html
  3. Upgrading ambari metrics (HDP)
    1. http://mungeol-heo.blogspot.kr/2015/11/upgrading-ambari-metrics-hdp.html
  4. ambari web -> admin > stack and versions > manage versions > + register version
  5. enter 0.0
  6. enter 'http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.3.0.0' for HDP base URL
  7. enter 'http://public-repo-1.hortonworks.com/HDP-UTILS-1.1.0.20/repos/centos6' for HDP-UTILS base URL
  8. save
  9. go to dashboard > admin > stack and versions > verions > install packages > ok
  10. record component layoutbrowse to each Service except HDFS and ZooKeeper and perform Stop
    1. http://ambari.server:8080/api/v1/clusters/cluster.name/hosts?fields=host_components
  11. namenode (active) hostlog in to ambari
    1. cd <dfs.namenode.name.dir>
    2. Make sure that only a "/current" directory and no "/previous" directory exists
    3. cp -r current /home/hdfs/
    4. su hdfs
    5. cd
    6. hdfs fsck / -files -blocks -locations > dfs-old-fsck-1.log
    7. hdfs dfsadmin -report > dfs-old-report-1.log
    8. hdfs dfsadmin -safemode enter
    9. hdfs dfsadmin -saveNamespace
    10. hdfs dfsadmin -finalizeUpgrade
  12. Using Ambari Web, stop HDFS service and stop ZooKeeper service
  13. namenode (active) hosthdp-select set all 2.3.0.0-2557 (all hosts)
    1. cd <dfs.namenode.name.dir>/current
    2. hdfs oev -i edits_inprogress_* -o edits.out
    3. Verify edits.out file. It should only have OP_START_LOG_SEGMENT transaction
  14. mkdir -p /work/upgrade_hdp_2
  15. cd /work/upgrade_hdp_2
  16. curl -O https://raw.githubusercontent.com/apache/ambari/branch-2.1/ambari-server/src/main/python/upgradeHelper.py
  17. chmod 777 upgradeHelper.py
  18. curl -O https://raw.githubusercontent.com/apache/ambari/branch-2.1/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.2_to_2.3.json
  19. python upgradeHelper.py --hostname $HOSTNAME --user $USERNAME --password $PASSWORD --clustername $CLUSTERNAME --fromStack $FROMSTACK --toStack $TOSTACK --upgradeCatalog UpgradeCatalog_2.2_to_2.3.json update-configs [config-type]curl -O https://raw.githubusercontent.com/apache/ambari/branch-2.1/ambari-server/src/main/resources/upgrade/catalog/UpgradeCatalog_2.2_to_2.3_step2.json
    1. ariable
      Value
      $HOSTNAME
      Ambari Server hostname. This should be the FQDN for the host running the Ambari Server.
      $USERNAME
      Ambari Admin user.
      $PASSWORD
      Password for the user.
      $CLUSTERNAME
      Name of the cluster. This is the name you provided when you installed the cluster with Ambari. Login to Ambari and the name can be found in the upper-left of the Ambari Web screen. This is case-sensitive.
      $FROMSTACK
      The “from” stack. Forexample:2.2
      $TOSTACK
      The “to” stack. Forexample:2.3
      config-type
      Optional: the config-type to upgrade. For example:hdfs-site. By default, all configurations are updated.
  20. upgrade zookeeper
    1. start it at ambari web
    2. mv /etc/zookeeper/conf /etc/zookeeper/conf.saved
    3. ln -s /usr/hdp/current/zookeeper-client/conf /etc/zookeeper/conf
  21. upgrade HDFS
    1. \cp -r /etc/hadoop/conf/* /etc/hadoop/2.3.0.0-2557/0/
    2. mv /etc/hadoop/conf /etc/hadoop/conf.saved
    3. ln -s /usr/hdp/current/hadoop-client/conf /etc/hadoop/conf
    4. su -l hdfs -c "/usr/hdp/current/hadoop-client/sbin/hadoop-daemon.sh start namenode -upgrade"
    5. ps -ef | grep -i NameNode
    6. su -l hdfs -c "/usr/hdp/current/hadoop-client/sbin/hadoop-daemon.sh start datanode"
    7. ps -ef | grep DataNode
    8. ambari web > services > HDFS > restart all
    9. run service check
    10. su -l hdfs -c "hdfs dfsadmin -safemode get"
      1. safe mode is off
  22. upgrade YARN and MR2note that you may have to upgrade other services to complete the upgrading which depends on your cluster configuration
    1. su -l hdfs -c "hdfs dfs -mkdir -p /hdp/apps/2.3.0.0-2557/mapreduce/"
    2. su -l hdfs -c "hdfs dfs -put /usr/hdp/current/hadoop-client/mapreduce.tar.gz /hdp/apps/2.3.0.0-2557/mapreduce/."
    3. su -l hdfs -c "hdfs dfs -put /usr/hdp/current/hadoop-mapreduce-client/hadoop-streaming.jar /hdp/apps/2.3.0.0-2557/mapreduce/."
    4. su -l hdfs -c "hdfs dfs -chown -R hdfs:hadoop /hdp" 
    5. su -l hdfs -c "hdfs dfs -chmod -R 555 /hdp/apps/2.3.0.0-2557/mapreduce" 
    6. su -l hdfs -c "hdfs dfs -chmod -R 444 /hdp/apps/2.3.0.0-2557/mapreduce/mapreduce.tar.gz" 
    7. su -l hdfs -c "hdfs dfs -chmod -R 444 /hdp/apps/2.3.0.0-2557/mapreduce/hadoop-streaming.jar"
    8. su -l yarn -c "yarn resourcemanager -format-state-store"
    9. start YARN and MR2 from ambari web
    10. run service check for YARN and MR2
  23. sudo su -l hdfs -c "hdfs dfsadmin -finalizeUpgrade"
  24. ambari-server set-current --cluster-name=dev --version-display-name=HDP-2.3.0.0
  25. option
    1. If your cluster includes Ranger
      1. cd /work/upgrade_hdp_2
        1. python upgradeHelper.py --hostname $HOSTNAME --user $USERNAME --password $PASSWORD --clustername $CLUSTERNAME --fromStack $FROMSTACK --toStack $TOSTACK --upgradeCatalog UpgradeCatalog_2.2_to_2.3_step2.json update-configs [config-type]

Upgrading ambari 2.0 to 2.1 (HDP)

  1. stop Ambari Metrics
  2. ambari-server stop
  3. all hosts
    1. ambari-agent stop
    2. cd /etc/yum.repos.d
    3. rm -f ambari* HDP*
    4. wget -nv http://public-repo-1.hortonworks.com/ambari/centos6/2.x/updates/2.1.0/ambari.repo -O /etc/yum.repos.d/ambari.repo
  4. yum clean all; yum -y upgrade ambari-server
  5. Confirm there is only one ambari-server*.jar file in /usr/lib/ambari-server. If there is more than one JAR file with name ambari-server*.jar, move all JARs except ambari-server-2.1.0.*.jar to /tmp before proceeding with upgrade
  6. all hosts
    1. yum -y upgrade ambari-agent
    2. rpm -qa | grep ambari-agent
  7. ambari-server upgrade
  8. ambari-server start
  9. ambari-agent start (each host)
  10. http://<your.ambari.server>:8080
  11. restart services
  12. note that you may have to perform other processes to complete the upgrading which depends on your cluster configuration

Upgrading ambari metrics (HDP)

  1. stop ambari metrics
  2. all hosts
    1. yum clean all
    2. yum -y upgrade ambari-metrics-monitor ambari-metrics-hadoop-sink
    3. yum -y upgrade ambari-metrics-collector
  3. start ambari metircs
  4. restart related services

HDP - verifying memory configuration

  1. https://github.com/hortonworks/hdp-configuration-utils
  2. unzip master
  3. cd hdp-configuration-utils-master/2.1
  4. ./hdp-configuration-utils.py -h

HDP - log archival process

#!/bin/sh
# Command Line params
# ACTUAL at this time:
# $1 = Interval Days to remove.
DAY_ARCHIVE_THRESHOLD=${1-30}
#!/bin/bash
# Cleaning hadoop logs older than 30 days in all hadoop related folders on /var/log
LOG_BASE=/var/log
COMPONENTS="accumulo ambari-agent ambari-server falcon hadoop hadoop-hdfs hadoop-mapreduce hadoop-yarn hbase hive hive-cataglog hue knox nagios oozie storm webhcat zookeeper"
echo "Reviewing Logs for $COMPONENTS"
for i in $COMPONENTS; do
if [ -d $LOG_BASE/$i ]; then
echo "Removing logs for $LOG_BASE/$i that are $DAY_ARCHIVE_THRESHOLD (or more) days old"
find $LOG_BASE/$i -mtime +$DAY_ARCHIVE_THRESHOLD -exec rm -f {} \;
popd
else
echo "Component $i logs not found on this server"
fi
done
# Cleanup OS Components
OS_COMPONENTS="messages maillog secure spooler"
for i in $OS_COMPONENTS; do
if [ -d $LOG_BASE/$i ]; then
echo "Removing logs for $LOG_BASE/$i that are $DAY_ARCHIVE_THRESHOLD (or more) days old"
find $LOG_BASE/$i-* -mtime +$DAY_ARCHIVE_THRESHOLD -exec rm -f {} \;
popd
else
echo "Component $i logs not found on this server"
fi
done

HDP - HDFS performance test

  1. sudo su hdfs -l -c 'yarn jar /usr/hdp/2.3.0.0-2557/hadoop-mapreduce/hadoop-mapreduce-client-jobclient-tests.jar TestDFSIO -write -nrFiles 10 -fileSize 1000'
  2. sudo su hdfs -l -c 'yarn jar /usr/hdp/2.3.0.0-2557/hadoop-mapreduce/hadoop-mapreduce-client-jobclient-tests.jar TestDFSIO -read -nrFiles 10 -fileSize 1000'
  3. sudo su hdfs -l -c 'yarn jar /usr/hdp/2.3.0.0-2557/hadoop-mapreduce/hadoop-mapreduce-client-jobclient-tests.jar TestDFSIO -clean'