Skip to content

Instantly share code, notes, and snippets.

@seanorama
Last active August 29, 2015 14:12
Show Gist options
  • Save seanorama/e4fb94a7f4ecad05d0ae to your computer and use it in GitHub Desktop.
Save seanorama/e4fb94a7f4ecad05d0ae to your computer and use it in GitHub Desktop.
patches
From: Sean Roberts <[email protected]>
Date: Fri, 9 Jan 2015 18:04:32 +0000
Subject: [PATCH 1/1] public_hostname_script & fix java_home
- gave Ambari a public_hostname_script to detect the public IP of each instance. This will make links in the Ambari UI use the public IP rather than the private IP which would not be routable unless you are on the 10.x network
- changed JAVA_HOME to point directly to /etc/alternatives/java_sdk. The previous method was finding the exact JAVA_HOME meaning that upgrades of java would require many changes, and potentially be risking if the packages removed a version. Use of alternatives is much easier.
---
platforms/hdp/install_ambari.sh | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/platforms/hdp/install_ambari.sh b/platforms/hdp/install_ambari.sh
index a6790be..7f9a05c 100644
--- a/platforms/hdp/install_ambari.sh
+++ b/platforms/hdp/install_ambari.sh
@@ -27,13 +27,22 @@ service iptables stop
yum install -y java7-devel
# Get Repo
-curl -O http://public-repo-1.hortonworks.com/ambari/centos6/1.x/updates/${AMBARI_VERSION}/ambari.repo
-cp ambari.repo /etc/yum.repos.d/
+curl -o /etc/yum.repos.d/ambari.repo http://public-repo-1.hortonworks.com/ambari/centos6/1.x/updates/${AMBARI_VERSION}/ambari.repo
-JAVA_HOME=$(dirname $(dirname $(readlink -e $(which javac))))
+JAVA_HOME=/etc/alternatives/java_sdk
yum install -y ambari-agent
sed -i "s/^.*hostname=localhost/hostname=${MASTER_HOSTNAME}/" \
/etc/ambari-agent/conf/ambari-agent.ini
+
+# script to detect public address of google compute instances
+cat > /etc/ambari-agent/conf/public-hostname.sh <<-'EOF'
+#!/usr/bin/env bash
+curl -Ls -m 5 http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip -H "Metadata-Flavor: Google"
+exit 0
+EOF
+chmod +x /etc/ambari-agent/conf/public-hostname.sh
+sed -i "/\[agent\]/ a public_hostname_script=\/etc\/ambari-agent\/conf\/public-hostname.sh" /etc/ambari-agent/conf/ambari-agent.ini
+
service ambari-agent start
if [[ $(hostname) == ${MASTER_HOSTNAME} ]]; then
--
2.2.1
From c60fdded89ff8ef1b6acf8f6213c5a02cbdc2275 Mon Sep 17 00:00:00 2001
From: Sean Roberts <[email protected]>
Date: Sun, 28 Dec 2014 19:40:11 +0000
Subject: [PATCH] Milestone - All HDP services deployed via Ambari
This applies to release: bdutil-1.0.1-tt-SNAPSHOT-20141219-r0-20141219-143527.tar
Fixed #2 - Set JAVA HOME to JDK
- Set JAVA_HOME to JDK root by searching on 'javac' binary
- Replace 'sed' with 'dirname' for more reliable parsing of path
Fixed #3 - nagios-env for Ambari configuration
Fixed #4 - Deploy all AMBARI_SERVICES
---
platforms/hdp/ambari_env.sh | 2 +-
platforms/hdp/configuration.json | 3 +++
platforms/hdp/install_ambari.sh | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/platforms/hdp/ambari_env.sh b/platforms/hdp/ambari_env.sh
index 3d52ee8..6cead1f 100644
--- a/platforms/hdp/ambari_env.sh
+++ b/platforms/hdp/ambari_env.sh
@@ -30,7 +30,7 @@ UPLOAD_FILES=(
HDP_VERSION='2.2'
AMBARI_VERSION='1.7.0'
-AMBARI_SERVICES='FLUME GANGLIA HBASE HDFS HIVE KERBEROS MAPREDUCE2 OOZIE PIG SLIDER SQOOP TEZ YARN ZOOKEEPER'
+AMBARI_SERVICES='FLUME GANGLIA HBASE HDFS HIVE KERBEROS MAPREDUCE2 OOZIE PIG SLIDER SQOOP TEZ YARN ZOOKEEPER KAFKA STORM FALCON KNOX NAGIOS'
GCS_CACHE_CLEANER_USER='hdfs'
GCS_CACHE_CLEANER_LOG_DIRECTORY="/var/log/hadoop/${GCS_CACHE_CLEANER_USER}"
diff --git a/platforms/hdp/configuration.json b/platforms/hdp/configuration.json
index ea2d878..dd335aa 100644
--- a/platforms/hdp/configuration.json
+++ b/platforms/hdp/configuration.json
@@ -15,6 +15,9 @@
},
"hive-site" : {
"javax.jdo.option.ConnectionPassword" : "admin"
+ },
+ "nagios-env" : {
+ "nagios_contact" : "admin@localhost"
}
}
}
diff --git a/platforms/hdp/install_ambari.sh b/platforms/hdp/install_ambari.sh
index 58c7526..a6790be 100644
--- a/platforms/hdp/install_ambari.sh
+++ b/platforms/hdp/install_ambari.sh
@@ -30,7 +30,7 @@ yum install -y java7-devel
curl -O http://public-repo-1.hortonworks.com/ambari/centos6/1.x/updates/${AMBARI_VERSION}/ambari.repo
cp ambari.repo /etc/yum.repos.d/
-JAVA_HOME=$(readlink -f $(which java) | sed "s|/bin/java||")
+JAVA_HOME=$(dirname $(dirname $(readlink -e $(which javac))))
yum install -y ambari-agent
sed -i "s/^.*hostname=localhost/hostname=${MASTER_HOSTNAME}/" \
/etc/ambari-agent/conf/ambari-agent.ini
--
2.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment