本文章僅作為個(gè)人筆記
CDH官網(wǎng)地址:https://www.cloudera.com/
CDH鏡像地址:
? ? cm5.11.1地址:http://archive.cloudera.com/cm5/repo-as-tarball/5.11.1/cm5.11.1-centos7.tar.gz
? ? ? ? http://archive.cloudera.com/cm5/repo-as-tarball/5.11.1/cm5.11.1-centos7.tar.gz.sha1
? ? cdh5.11.1地址:http://archive.cloudera.com/cdh5/parcels/5.11.1/CDH-5.11.1-1.cdh5.11.1.p0.4-el7.parcel
? ? ? ? http://archive.cloudera.com/cdh5/parcels/5.11.1/CDH-5.11.1-1.cdh5.11.1.p0.4-el7.parcel.sha1
? ? ? ? http://archive.cloudera.com/cdh5/parcels/5.11.1/manifest.json
? ? jdk1.8.121官網(wǎng)下載地址:http://download.oracle.com/otn/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-i586.rpm
? ? mysql5.6.36官網(wǎng)下載地址:https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
? ? mysql連接驅(qū)動(dòng)下載地址:https://dev.mysql.com/downloads/connector/j/
筆者使用VMware進(jìn)行模擬安裝程剥,為了滿足基礎(chǔ)配置昂羡,這里分配3臺(tái)虛擬機(jī)(hadoopb01(4g/4核/40g/192.168.75.136/master),hadoopb02(2g/2核/40g/192.168.75.144/slave),hadoopb03(2g/2核/40g/192.168.75.145/slave))蜘犁,另外wget下載文件非常緩慢并且不方便反復(fù)測(cè)試及安裝,筆者這里下載好所有資源文件放在本地(.sha1文件結(jié)尾的文件統(tǒng)一重命名為.sha)须误。(如果虛擬機(jī)開機(jī)后無網(wǎng)絡(luò)(使用net橋接方式),可與命令行運(yùn)行dhclient分配ip,若后續(xù)斷開了可運(yùn)行dhclient -r后再運(yùn)行dhclient)
在3臺(tái)服務(wù)器共同操作:
? ? 安裝基本工具: yum install vim wget net-tools unzip -y
? ? 關(guān)閉SELINUX:
? ? ? ? 運(yùn)行 setenforce 0 臨時(shí)關(guān)閉
? ? ? ? 永久關(guān)閉SELINUX:
? ? ? ? ? ? echo "SELINUX=disabled" > /etc/selinux/config
? ? ? ? ? ? echo "SELINUXTYPE=targeted" >> /etc/selinux/config
? ? 關(guān)閉iptables防火墻:
? ? ? ? 運(yùn)行 systemctl stop firewalld.service 停止防火墻
? ? ? ? 運(yùn)行 systemctl status firewalld.service 查看防火墻狀態(tài)
? ? ? ? 運(yùn)行 systemctl disable firewalld.service 關(guān)閉防火墻開機(jī)啟動(dòng)
? ? 更改主機(jī)名:
? ? ? ? 運(yùn)行 hostname hadoopb01 更改主機(jī)名,根據(jù)不同主機(jī)選擇不同主機(jī)名(hadoopb01/hadoopb02/hadoopb03)
? ? ? ? 運(yùn)行 echo "HOSTNAME=hadoopb01" > /etc/sysconfig/network 别凹,根據(jù)不同主機(jī)選擇不同主機(jī)名(hadoopb01/hadoopb02/hadoopb03)
? ? ? ? 運(yùn)行 echo "hadoopb01" > /etc/hostname 草讶,根據(jù)不同主機(jī)選擇不同主機(jī)名(hadoopb01/hadoopb02/hadoopb03)
? ? 安裝jdk(參考http://www.reibang.com/p/c5fc4dd47754)
? ? 密鑰生成:
? ? ? ? 運(yùn)行 ssh-keygen 一路回車回車生成
? ? ip與hostname綁定:
? ? ? ? echo "192.168.75.136 hadoopb01" >> /etc/hosts
? ? ? ? echo "192.168.75.144 hadoopb02" >> /etc/hosts
? ? ? ? echo "192.168.75.145 hadoopb03" >> /etc/hosts
? ? 運(yùn)行python --version 檢查python版本,如果不是python2.6.6建議改為python2.6.6
? ? 時(shí)間同步:
? ? ? ? 運(yùn)行 yum install ntp -y 安裝ntp服務(wù)
? ? ? ? 運(yùn)行 systemctl enable ntpd 使ntp服務(wù)開機(jī)啟動(dòng)
在從服務(wù)器操作(hadoopb02(2g/2核/40g/192.168.75.144/slave),hadoopb03(2g/2核/40g/192.168.75.145/slave):
? ? 配置時(shí)鐘同步:
? ? ? ? echo "driftfile /var/lib/ntp/ntp.drift" > /etc/ntp.conf
? ? ? ? echo "statistics loopstats peerstats clockstats" >> /etc/ntp.conf
? ? ? ? echo "filegen loopstats file loopstats type day enable" >> /etc/ntp.conf
? ? ? ? echo "filegen peerstats file peerstats type day enable" >> /etc/ntp.conf
? ? ? ? echo "filegen clockstats file clockstats type day enable" >> /etc/ntp.conf
? ? ? ? echo "server 192.168.75.136 prefer" >> /etc/ntp.conf
? ? ? ? echo "fudge 192.168.75.136 stratum 5" >> /etc/ntp.conf
? ? ? ? echo "restrict -4 default kod notrap nomodify nopeer noquery" >> /etc/ntp.conf
? ? ? ? echo "restrict -6 default kod notrap nomodify nopeer noquery" >> /etc/ntp.conf
? ? ? ? echo "restrict 127.0.0.1" >> /etc/ntp.conf
? ? ? ? echo "restrict ::1" >> /etc/ntp.conf
? ? 運(yùn)行 service ntpd restart 重啟ntpd并使配置生效
? ? 運(yùn)行 ntpdate –u 192.168.75.136 同步時(shí)間
在主服務(wù)器操作(hadoopb01(4g/4核/40g/192.168.75.136/master):
? ? 運(yùn)行 ssh-copy-id hadoopb01
? ? ? ? ssh-copy-id hadoopb02
? ? ? ? ssh-copy-id hadoopb03 完成各服務(wù)器免密登錄
? ? 配置時(shí)鐘同步:
? ? ? ? echo "driftfile /var/lib/ntp/ntp.drift" > /etc/ntp.conf
? ? ? ? echo "restrict 192.168.75.0 mask 255.255.255.0 nomodify notrap" >> /etc/ntp.conf
? ? ? ? echo "server 210.72.145.44" >> /etc/ntp.conf
? ? ? ? echo "server 202.112.10.36 perfer" >> /etc/ntp.conf
? ? ? ? echo "server 59.124.196.83" >> /etc/ntp.conf
? ? ? ? echo "restrict 210.72.145.44 nomodify notrap noquery" >> /etc/ntp.conf
? ? ? ? echo "restrict 202.112.10.36 nomodify notrap noquery" >> /etc/ntp.conf
? ? ? ? echo "restrict 59.124.196.83 nomodify notrap noquery" >> /etc/ntp.conf
? ? ? ? echo "server? 127.127.1.0" >> /etc/ntp.conf
? ? ? ? echo "fudge? 127.127.1.0 stratum 10" >> /etc/ntp.conf
? ? 運(yùn)行 service ntpd restart 重啟ntpd并使配置生效
? ? 運(yùn)行 ntpdate –u 202.112.10.36 同步時(shí)間
? ? 使用filezilla將上文所述文件傳輸至主服務(wù)器(放置于root用戶~目錄)
? ? 安裝配置mysql5.6(可參考http://www.reibang.com/p/c5fc4dd47754)
? ? ? ? 創(chuàng)建相關(guān)用戶及數(shù)據(jù)庫(kù):
? ? ? create database cmf default character set utf8
? ? ? ? grant all on cmf.* to 'cmf'@'localhost' identified by 'cmf_password'
? ? ? ? grant all on cmf.* to 'cmf'@'%' identified by 'cmf_password'
? ? ? ? grant all on cmf.* to 'cmf'@'${m_hosts[${c_index}]}' identified by 'cmf_password'
? ? ? ? drop database cmf
? ? ? ? create database cmf
? ? ? ? create database hive default character set utf8
? ? ? ? grant all on hive.* to 'hive'@'localhost' identified by 'hive_password'
? ? ? ? grant all on hive.* to 'hive'@'%' identified by 'hive_password'
? ? ? ? grant all on hive.* to 'hive'@'${m_hosts[${c_index}]}' identified by 'hive_password'
? ? ? ? drop database hive
? ? ? ? create database hive
? ? ? ? create database hue default character set utf8
? ? ? ? grant all on hue.* to 'hue'@'localhost' identified by 'hue_password'
? ? ? ? grant all on hue.* to 'hue'@'%' identified by 'hue_password'
? ? ? ? grant all on hue.* to 'hue'@'${m_hosts[${c_index}]}' identified by 'hue_password'
? ? ? ? drop database hue
? ? ? ? create database hue
? ? ? ? create database am default character set utf8
? ? ? ? grant all on am.* to 'am'@'localhost' identified by 'am_password'
? ? ? ? grant all on am.* to 'am'@'%' identified by 'am_password'
? ? ? ? grant all on am.* to 'am'@'${m_hosts[${c_index}]}' identified by 'am_password'
? ? ? ? drop database am
? ? ? ? create database am
? ? ? ? create database os default character set utf8
? ? ? ? grant all on os.* to 'os'@'localhost' identified by 'os_password'
? ? ? ? grant all on os.* to 'os'@'%' identified by 'os_password'
? ? ? ? grant all on os.* to 'os'@'${m_hosts[${c_index}]}' identified by 'os_password'
? ? ? ? drop database os
? ? ? ? create database os
? ? ? ? flush privileges
? ? 安裝并啟動(dòng)httpd服務(wù):
? ? ? ? 運(yùn)行 yum install -y httpd 安裝httpd服務(wù)
? ? ? ? 運(yùn)行 systemctl enable httpd 設(shè)置httpd服務(wù)開機(jī)啟動(dòng)
? ? ? ? 運(yùn)行 service httpd start 啟動(dòng)httpd服務(wù)
? ? 創(chuàng)建parcels服務(wù)(依次運(yùn)行如下命令):
? ? ? ? cd /var/www/html
? ? ? ? mkdir parcels
? ? ? ? cd parcels
? ? ? ? mv ~/CDH-5.11.1-1.cdh5.11.1.p0.4-el7.parcel ./
? ? ? ? mv ~/CDH-5.11.1-1.cdh5.11.1.p0.4-el7.parcel.sha ./
? ? ? ? mv ~/manifest.json ./
? ? 創(chuàng)建cm5服務(wù)(依次運(yùn)行如下命令):
? ? ? ? ?mkdir /opt/rpminstall
? ? ? ? ?cd /opt/rpminstall
? ? ? ? ?mv ~/cm5.11.1-centos7.tar.gz ./
? ? ? ? ?mv ~/cm5.11.1-centos7.tar.gz.sha ./
? ? ? ? ?tar -zxf cm5.11.1-centos7.tar.gz -C /var/www/html/
? ? ? ? ?cd /var/www/html/
? ? ? ? ?mkdir -p cm5/redhat/7/x86_64/
? ? ? ? ?mv cm cm5/redhat/7/x86_64/
? ? ? ? ?chown apache:apache -R /var/www/html
? ? ? ? ?cd /var/www/html/cm5/redhat/7/x86_64/cm/5/RPMS/x86_64
? ? ? ? ?yum install -y cloudera-manager-daemons-5.11.1-1.cm5111.p0.9.el7.x86_64.rpm
? ? ? ? ?yum install -y cloudera-manager-server-5.11.1-1.cm5111.p0.9.el7.x86_64.rpm
? ? ? ? ?mkdir /usr/share/java
? ? ? ? ?cd /usr/share/java
? ? ? ? ?mv ~/mysql-connector-java-5.1.42.zip ./
? ? ? ? ?unzip mysql-connector-java-5.1.42.zip
? ? ? ? ?cd mysql-connector-java-5.1.42
? ? ? ? ?cp mysql-connector-java-5.1.42-bin.jar ../mysql-connector-java.jar
? ? ? ? ?echo "com.cloudera.cmf.db.type=mysql" > /etc/cloudera-scm-server/db.properties
? ? ? ? ?echo "com.cloudera.cmf.db.host=localhost" >> /etc/cloudera-scm-server/db.properties
? ? ? ? ?echo "com.cloudera.cmf.db.name=cmf" >> /etc/cloudera-scm-server/db.properties
? ? ? ? ?echo "com.cloudera.cmf.db.user=cmf" >> /etc/cloudera-scm-server/db.properties
? ? ? ? ?echo "com.cloudera.cmf.db.password=cmf_password" >> /etc/cloudera-scm-server/db.properties
? ? 運(yùn)行 service cloudera-scm-server start 啟動(dòng) cloudera-scm 服務(wù)
? ? 運(yùn)行 tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log 查看運(yùn)行日志炉菲,待日志停止且顯示Started Jetty server.表示服務(wù)運(yùn)行完成堕战。
? ? 與瀏覽器輸入 http://192.168.75.136:7180開始正式的集群部署
至此完成安裝
文章的最后附上個(gè)人的腳本(吐槽下簡(jiǎn)書的書寫為了格式會(huì)導(dǎo)致粘貼部分文案行不對(duì)號(hào)记劈,如果要使用這個(gè)腳本需要更改( 主機(jī)ip,主機(jī)名)):
最后為了使腳本能夠運(yùn)行并巍,需要運(yùn)行 chmod +x filepath 為文件添加權(quán)限目木,運(yùn)行時(shí)執(zhí)行 bash filepath n 例如(bash cdh.sh 0),運(yùn)行此腳本可能mysql初始化不完全懊渡,如果可以刽射,最好還是弄懂所有的步驟。
====================================================================================================master
#!/bin/bash
c_index=$1
m_names=("master" "slave01" "slave02")
m_hosts=("192.168.1.131" "192.168.1.129" "192.168.1.226")
function auto_ssh_keygen(){
expect -c "set timeout -1;
spawn ssh-keygen;
expect {
*id_rsa* {
send \n\r;
exp_continue;
};
*Overwrite* {
send y\n\r;
exp_continue;
};
*passphrase* {
send \n\r;
exp_continue;
};
*again* {
send \n\r;
exp_continue;
};
};
"
}
function auto_ssh_copy(){
expect -c "set timeout -1;
spawn ssh-copy-id $1;
expect {
*yes/no* {
send yes\n\r;
exp_continue;
};
*password* {
send $2\n\r;
exp_continue;
};
};
"
}
#初始化必要工具
yum install expect -y
yum install unzip -y
#關(guān)閉selinux
setenforce 0
echo "SELINUX=disabled" > /etc/selinux/config
echo "SELINUXTYPE=targeted" >> /etc/selinux/config
#關(guān)閉防火墻
systemctl stop firewalld.service
systemctl status firewalld.service
systemctl disable firewalld.service
#定義主機(jī)名
hostname ${m_names[${c_index}]}
echo "HOSTNAME=${m_names[${c_index}]}" > /etc/sysconfig/network
#ip與hostname綁定
echo "${m_names[${c_index}]}" > /etc/hostname
t_index=0
for m_name in ${m_names[@]};
do
echo "${m_hosts[t_index]} $m_name" >> /etc/hosts
let t_index++
done
#時(shí)間同步
yum install ntp -y
systemctl enable ntpd
if [ ${c_index} == 0 ]
then
echo "driftfile /var/lib/ntp/ntp.drift" > /etc/ntp.conf
echo "restrict 192.168.75.0 mask 255.255.255.0 nomodify notrap" >> /etc/ntp.conf
echo "server 210.72.145.44" >> /etc/ntp.conf
echo "server 202.112.10.36 perfer" >> /etc/ntp.conf
echo "server 59.124.196.83" >> /etc/ntp.conf
echo "restrict 210.72.145.44 nomodify notrap noquery" >> /etc/ntp.conf
echo "restrict 202.112.10.36 nomodify notrap noquery" >> /etc/ntp.conf
echo "restrict 59.124.196.83 nomodify notrap noquery" >> /etc/ntp.conf
echo "server? 127.127.1.0" >> /etc/ntp.conf
echo "fudge? 127.127.1.0 stratum 10" >> /etc/ntp.conf
service ntpd restart
ntpdate –u 202.112.10.36
#免密登陸
for m_name in ${m_names[@]};
do
auto_ssh_copy $m_name root
done
else
echo "driftfile /var/lib/ntp/ntp.drift" > /etc/ntp.conf
echo "statistics loopstats peerstats clockstats" >> /etc/ntp.conf
echo "filegen loopstats file loopstats type day enable" >> /etc/ntp.conf
echo "filegen peerstats file peerstats type day enable" >> /etc/ntp.conf
echo "filegen clockstats file clockstats type day enable" >> /etc/ntp.conf
echo "server ${m_hosts[0]} prefer" >> /etc/ntp.conf
echo "fudge ${m_hosts[0]} stratum 5" >> /etc/ntp.conf
echo "restrict -4 default kod notrap nomodify nopeer noquery" >> /etc/ntp.conf
echo "restrict -6 default kod notrap nomodify nopeer noquery" >> /etc/ntp.conf
echo "restrict 127.0.0.1" >> /etc/ntp.conf
echo "restrict ::1" >> /etc/ntp.conf
service ntpd restart
ntpdate –u ${m_hosts[0]}
fi
#生成私鑰
rm -rf /root/.ssh/id_rsa
rm -rf /root/.ssh/id_rsa.pub
auto_ssh_keygen
#安裝jdk
rpm -Uvh jdk-8u121-linux-x64.rpm
echo "JAVA_HOME=/usr/java/jdk1.8.0_121" > /etc/profile.d/java.sh
echo "PATH=\$PATH:\$JAVA_HOME/bin" >> /etc/profile.d/java.sh
echo "CLASSPATH=.:\$JAVA_HOME/lib/jt.jar:\$JAVA_HOME/lib/tools.jar" >> /etc/profile.d/java.sh
echo "export JAVA_HOME PATH CLASSPATH" >> /etc/profile.d/java.sh
source /etc/profile
if [ ${c_index} == 0 ]
then
#安裝并初始化配置mysql
tar -zxvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz
mv mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/mysql
touch /etc/my.cnf
echo "[mysql]" > /etc/my.cnf
echo "default-character-set=utf8" >> /etc/my.cnf
echo "socket=/var/lib/mysql/mysql.sock" >> /etc/my.cnf
echo "[mysqld]" >> /etc/my.cnf
echo "skip-name-resolve" >> /etc/my.cnf
echo "port=3306" >> /etc/my.cnf
echo "socket=/var/lib/mysql/mysql.sock" >> /etc/my.cnf
echo "basedir=/usr/local/mysql" >> /etc/my.cnf
echo "datadir=/usr/local/mysql/data" >> /etc/my.cnf
echo "max_connections=200" >> /etc/my.cnf
echo "character-set-server=utf8" >> /etc/my.cnf
echo "default-storage-engine=INNODB" >> /etc/my.cnf
echo "lower_case_table_names=1" >> /etc/my.cnf
echo "max_allowed_packet=16M" >> /etc/my.cnf
mkdir -p /var/lib/mysql/mysql
groupadd mysql
useradd -g mysql mysql
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /var/lib/mysql
yum install -y perl-Module-Install.noarch
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql
chown -R mysql:mysql /usr/local/mysql
chown 777 /etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod +x /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
echo "export PATH=\$PATH:/usr/local/mysql/bin" > /etc/profile.d/mysql.sh
source /etc/profile
service mysqld restart
/usr/local/mysql/bin/mysql -e "delete from mysql.user where user = ''"
/usr/local/mysql/bin/mysql -e "update mysql.user set password = (select password('root')) where user = 'root'"
/usr/local/mysql/bin/mysql -e "create database cmf default character set utf8"
/usr/local/mysql/bin/mysql -e "grant all on cmf.* to 'cmf'@'localhost' identified by 'cmf_password'"
/usr/local/mysql/bin/mysql -e "grant all on cmf.* to 'cmf'@'%' identified by 'cmf_password'"
/usr/local/mysql/bin/mysql -e "grant all on cmf.* to 'cmf'@'${m_hosts[${c_index}]}' identified by 'cmf_password'"
/usr/local/mysql/bin/mysql -e "drop database cmf"
/usr/local/mysql/bin/mysql -e "create database cmf"
/usr/local/mysql/bin/mysql -e "create database hive default character set utf8"
/usr/local/mysql/bin/mysql -e "grant all on hive.* to 'hive'@'localhost' identified by 'hive_password'"
/usr/local/mysql/bin/mysql -e "grant all on hive.* to 'hive'@'%' identified by 'hive_password'"
/usr/local/mysql/bin/mysql -e "grant all on hive.* to 'hive'@'${m_hosts[${c_index}]}' identified by 'hive_password'"
/usr/local/mysql/bin/mysql -e "drop database hive"
/usr/local/mysql/bin/mysql -e "create database hive"
/usr/local/mysql/bin/mysql -e "create database hue default character set utf8"
/usr/local/mysql/bin/mysql -e "grant all on hue.* to 'hue'@'localhost' identified by 'hue_password'"
/usr/local/mysql/bin/mysql -e "grant all on hue.* to 'hue'@'%' identified by 'hue_password'"
/usr/local/mysql/bin/mysql -e "grant all on hue.* to 'hue'@'${m_hosts[${c_index}]}' identified by 'hue_password'"
/usr/local/mysql/bin/mysql -e "drop database hue"
/usr/local/mysql/bin/mysql -e "create database hue"
/usr/local/mysql/bin/mysql -e "create database am default character set utf8"
/usr/local/mysql/bin/mysql -e "grant all on am.* to 'am'@'localhost' identified by 'am_password'"
/usr/local/mysql/bin/mysql -e "grant all on am.* to 'am'@'%' identified by 'am_password'"
/usr/local/mysql/bin/mysql -e "grant all on am.* to 'am'@'${m_hosts[${c_index}]}' identified by 'am_password'"
/usr/local/mysql/bin/mysql -e "drop database am"
/usr/local/mysql/bin/mysql -e "create database am"
/usr/local/mysql/bin/mysql -e "create database os default character set utf8"
/usr/local/mysql/bin/mysql -e "grant all on os.* to 'os'@'localhost' identified by 'os_password'"
/usr/local/mysql/bin/mysql -e "grant all on os.* to 'os'@'%' identified by 'os_password'"
/usr/local/mysql/bin/mysql -e "grant all on os.* to 'os'@'${m_hosts[${c_index}]}' identified by 'os_password'"
/usr/local/mysql/bin/mysql -e "drop database os"
/usr/local/mysql/bin/mysql -e "create database os"
/usr/local/mysql/bin/mysql -e "flush privileges"
#安裝httpd服務(wù)
yum install -y httpd
systemctl enable httpd
service httpd restart
cd /var/www/html
mkdir parcels
cd parcels
mv ~/CDH-5.11.1-1.cdh5.11.1.p0.4-el7.parcel ./
mv ~/CDH-5.11.1-1.cdh5.11.1.p0.4-el7.parcel.sha ./
mv ~/manifest.json ./
mkdir /opt/rpminstall
cd /opt/rpminstall
mv ~/cm5.11.1-centos7.tar.gz ./
mv ~/cm5.11.1-centos7.tar.gz.sha ./
tar -zxf cm5.11.1-centos7.tar.gz -C /var/www/html/
cd /var/www/html/
mkdir -p cm5/redhat/7/x86_64/
mv cm cm5/redhat/7/x86_64/
chown apache:apache -R /var/www/html
cd /var/www/html/cm5/redhat/7/x86_64/cm/5/RPMS/x86_64
yum install -y cloudera-manager-daemons-5.11.1-1.cm5111.p0.9.el7.x86_64.rpm
yum install -y cloudera-manager-server-5.11.1-1.cm5111.p0.9.el7.x86_64.rpm
mkdir /usr/share/java
cd /usr/share/java
mv ~/mysql-connector-java-5.1.42.zip ./
unzip mysql-connector-java-5.1.42.zip
cd mysql-connector-java-5.1.42
cp mysql-connector-java-5.1.42-bin.jar ../mysql-connector-java.jar
echo "com.cloudera.cmf.db.type=mysql" > /etc/cloudera-scm-server/db.properties
echo "com.cloudera.cmf.db.host=localhost" >> /etc/cloudera-scm-server/db.properties
echo "com.cloudera.cmf.db.name=cmf" >> /etc/cloudera-scm-server/db.properties
echo "com.cloudera.cmf.db.user=cmf" >> /etc/cloudera-scm-server/db.properties
echo "com.cloudera.cmf.db.password=cmf_password" >> /etc/cloudera-scm-server/db.properties
service cloudera-scm-server restart
source /etc/profile
fi
======================================================================================================end
坑錦集:
1.腳本運(yùn)行完成后可能需要再次于master運(yùn)行source /etc/profile 使環(huán)境變量生效剃执。
2.如果遇到hive安裝失敗的問題可能需要再開個(gè)瀏覽器窗口訪問cdh搭建主網(wǎng)站更改hive配置柄冲,且需要使用獨(dú)立的mysql數(shù)據(jù)庫(kù)及用戶。
3.ntp時(shí)間同步服務(wù)如果報(bào)警忠蝗,可于crontab -e添加定時(shí)同步時(shí)間现横。
4.當(dāng)3臺(tái)機(jī)器服務(wù)時(shí),可將master也添加namenode節(jié)點(diǎn)阁最。