-
-
Save mikeharding/1d100866104aa7563a586e6ce9c124d6 to your computer and use it in GitHub Desktop.
CM Path B Installation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
source ./control.sh | |
function getMySQLRepo() { | |
cd /tmp | |
wget --quiet —-no-check-certificate https://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm | |
yum -y localinstall mysql-community-release-el6-5.noarch.rpm | |
cd - | |
} | |
function getClouderaManagerRepo() { | |
cd /etc/yum.repos.d | |
wget --quiet http://archive.cloudera.com/cm5/redhat/6/x86_64/cm/cloudera-manager.repo | |
cd - | |
} | |
function getRepos() { | |
say "Installing MySQL yum repo from dev.msql.com" | |
getMySQLRepo | |
say "Installing latest Cloudera Manager repo" | |
getClouderaManagerRepo | |
} | |
getRepos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
source ./control.sh | |
function cleanYUM() { | |
yum clean all | |
rm -Rf /var/cache/yum/x86_64 | |
yum makecache | |
} | |
function verifyRepo() { | |
yum repolist enabled | grep Cloudera | |
yum repolist enabled | grep MySQL | |
} | |
function prepRepos() { | |
say "Refreshing YUM metadata" | |
cleanYUM | |
say "Verifying utility repos" | |
verifyRepo | |
} | |
prepRepos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
source ./control.sh | |
function install() { | |
yum info $1 | |
yum -y install $1 | |
} | |
function addJDK() { | |
install oracle-j2sdk1.7.x86_64 | |
} | |
function addCMServer() { | |
install cloudera-manager-server | |
} | |
function addMySQL() { | |
install mysql-community-server | |
} | |
function installPkgs() { | |
say "Installing JDK 1.7..." | |
addJDK | |
say "Installing Cloudera Manager server" | |
addCMServer | |
say "Installing MySQL server" | |
addMySQL | |
} | |
installPkgs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
source ./control.sh | |
function getConnector() { | |
cd /tmp | |
wget --quiet http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.35.tar.gz | |
} | |
function extractJAR() { | |
gunzip /tmp/mysql-connector-java-5.1.35.tar.gz | |
tar xvf /tmp/mysql-connector-java-5.1.35.tar | |
} | |
function placeJAR() { | |
cd /tmp/mysql-connector-java-5.1.35/ | |
mkdir -p /usr/share/java | |
cp mysql-connector-java-5.1.35-bin.jar /usr/share/java | |
cd /usr/share/java | |
ln mysql-connector-java-5.1.35-bin.jar mysql-connector-java.jar | |
} | |
function integrateConnector() { | |
# Assumes Cloudera Manager server package is installed | |
cm_config=/etc/default/cloudera-scm-server | |
jar_name=`grep CMF_JDBC_DRIVER_JAR ${cm_config}` | |
echo "${cm_config}: ${jar_name}" | |
} | |
function installConnector() { | |
say "Installing MySQL JDBC connector..." | |
getConnector | |
extractJAR | |
placeJAR | |
say "Configuring CM Server with MySQL JDBC..." | |
integrateConnector | |
} | |
installConnector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
source ./control.sh | |
function startMySQL() { | |
service mysqld start | |
} | |
function secureMySQL() { | |
mysql_secure_installation | |
} | |
function noIPV6User() { | |
mysql -u root -p <<EOC | |
DELETE FROM mysql.user WHERE host='::1'; | |
FLUSH PRIVILEGES; | |
EOC | |
} | |
function createDB() { | |
db=$1 | |
user=$2 | |
node=$3 | |
pass=$4 | |
echo "Creating database ${db}" | |
echo "Granting access to ${user} on ${node}" | |
mysql -u root -p <<EOC | |
CREATE DATABASE ${db}; | |
GRANT ALL ON ${db}.\* TO \"${user}\"@\"${node}\" IDENTIFIED BY \"${pass}\"; | |
EOC | |
} | |
function createDBs() { | |
admin=`hostname -f` | |
edge=${admin} | |
createDB scm scm ${admin} cloudera | |
createDB rman rman ${admin} cloudera | |
createDB hive hive ${admin} cloudera | |
createDB oozie oozie ${edge} cloudera | |
createDB hue hue ${edge} cloudera | |
createDB sentry sentry ${admin} cloudera | |
} | |
function integrateDB() { | |
path=/usr/share/cmf/schema | |
${path}/scm_prepare_database.sh mysql -h $(hostname -f) --scm-host $(hostname -f) scm scm | |
} | |
function configureMySQL() { | |
startMySQL | |
say "Securing your MySQL server..." | |
secureMySQL | |
noIPV6User | |
say "Creating databases for CM and CDH services..." | |
createDBs | |
say "Verifying and writing db connection string for CM..." | |
integrateDB | |
} | |
configureMySQL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
source ./control.sh | |
function initCM() { | |
service cloudera-scm-server start | |
} | |
function testAPI() { | |
AUTH="admin:admin" | |
# JSON="Content-type: application/json" | |
API_URL="http://$(hostname -f):7180/api" | |
say "CM API URL Base: ${API_URL}" | |
VER=`curl -u ${AUTH} "${API_URL}/version" --silent` | |
say "Latest API version is ${VER}" | |
echo | |
greeting="Greetings!" | |
say "Testing API echo..." | |
curl -X GET -u ${AUTH} --silent -i "${API_URL}/${VER}/tools/echo?message=$greeting" | |
} | |
function verifyCM() { | |
say "Initializing Cloudera Manager service..." | |
initCM | |
say "Wait until the Jetty service is started to browse" | |
say "Use tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log | grep 'Started Jetty server'" | |
say "Sleeping for 45 seconds before testing REST API" | |
sleep 45 | |
say "Verifying CM API version..." | |
testAPI | |
} | |
verifyCM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r='\e[31m' | |
g='\e[32m' | |
n='\e[0m' | |
function say() { | |
echo -e "${g}$1${n}" | |
} | |
# say "${r}This is red, ${g}this is green, and ${n}this is normal" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment