-
-
Save MrMaynard/a8ed9b6d24179cf6e9c3769155885c12 to your computer and use it in GitHub Desktop.
CM Path B Installation
This file contains hidden or 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 | |
function getRepoMySQL() { | |
cd /tmp | |
wget —-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 getRepoClouderaManager() { | |
# Download repo to latest version of Cloudera Manager | |
cd /etc/yum.repos.d | |
wget http://archive.cloudera.com/cm5/redhat/6/x86_64/cm/cloudera-manager.repo | |
cd - | |
} | |
function getRepos() { | |
getRepoMySQL | |
getRepoClouderaManager | |
} | |
getRepos |
This file contains hidden or 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 | |
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 | |
} | |
cleanYUM | |
verifyRepo |
This file contains hidden or 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 | |
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() { | |
yum install -y mysql-server | |
} | |
function installPkgs() { | |
addJDK | |
addCMServer | |
addMySQL | |
} | |
installPkgs |
This file contains hidden or 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 | |
function getConnector() { | |
cd /tmp | |
wget 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 configureConnector() { | |
# 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's JAR path is ${jar_name}" | |
} | |
function installConnector() { | |
getConnector | |
extractJAR | |
placeJAR | |
configureConnector | |
} | |
installConnector |
This file contains hidden or 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 | |
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 createCMDatabase() { | |
mysql -u root -p <<EOC | |
CREATE DATABASE scm; | |
GRANT ALL ON scm.* TO 'scm'@"$(hostname -f)" IDENTIFIED BY "cloudera"; | |
EOC | |
} | |
function verifyCM_DBConfig() { | |
path=/usr/share/cmf/schema | |
${path}/scm_prepare_database.sh mysql -h $(hostname -f) --scm-host $(hostname -f) scm scm | |
} | |
function create_db() { | |
db=$1 | |
user=$2 | |
node=$3 | |
pass=$4 | |
mysql -u root -p <<EOC | |
CREATE DATABASE $1; | |
GRANT ALL ON ${1}.* TO "$2"@"$3" IDENTIFIED BY "$4"; | |
EOC | |
} | |
function cdh_db() { | |
admin=`hostname -f` | |
edge=### | |
create_db rman rman $admin cloudera | |
create_db hive hive $admin cloudera | |
create_db oozie oozie $edge cloudera | |
create_db hue hue $edge cloudera | |
create_db sentry sentry $admin cloudera | |
} | |
function configureMySql(){ | |
startMySQL | |
secureMySQL | |
noIPV6User | |
createCMDatabase | |
verifyCM_DBConfig | |
create_db | |
cdh_db | |
} | |
configureMySql |
This file contains hidden or 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
function startCM() { | |
service cloudera-scm-server start | |
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log | grep "Started Jetty server" | |
} | |
function testAPI() { | |
AUTH="admin:admin" | |
JSON="Content-type: application/json" | |
URL4API="http://$(hostname -f):7180/api/" | |
echo CM API URL Base: ${URL4API} | |
VER=`curl -u ${AUTH} "${URL4API}/version"` | |
curl -X GET -u ${AUTH} -i "${URL4API}/${VER}/tools/echo?message=testing" | |
} | |
startCM | |
testAPI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment