您好,登錄后才能下訂單哦!
1.基本環境:
操作系統:
Centos 7.2.1511
jdk環境
版本:jdk-8u45-linux-x64.rpm
mysql環境:
rpm包:http://ftp.ntu.edu.tw/MySQL/Downloads/MySQL-5.6/MySQL-5.6.33-1.linux_glibc2.5.x86_64.rpm-bundle.tar
jdbc鏈接包:http://101.96.10.72/cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.40.tar.gz
CDH安裝相關的包:
cloudera manager包:http://archive.cloudera.com/cm5/cm/5/cloudera-manager-centos7-cm5.8.3_x86_64.tar.gz
CDH包:http://archive.cloudera.com/cdh6/parcels/5.8.3/CDH-5.8.3-1.cdh6.8.3.p0.2-el7.parcel.sha1
http://archive.cloudera.com/cdh6/parcels/5.8.3/CDH-5.8.3-1.cdh6.8.3.p0.2-el7.parcel
http://archive.cloudera.com/cdh6/parcels/5.8.3/manifest.json
集群規劃
IP地址 主機名說明
192.168.50.123hadoop1主節點master,datanode
192.168.50.124hadoop2datanode
192.168.50.125hadoop3 datanode
開始安裝前配置
1.安裝jdk(每個機器都要裝)
安裝前要先卸載掉原有的jdk版本,避免造成沖突
2.修改三個機器上面的hosts
192.168.50.123 hadoop1
192.168.50.124 hadoop2
192.168.50.125 hadoop3
3.同步時間
ntpdate -s pool.ntp.org
4.關閉防火墻和selinux
sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config #重啟機器
systemctl stop firewalld
systemctl disable firewalld
5.配置ssh無密碼登陸
[root@localhost ~]# ssh-keygen -t rsa -P '' Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 62:b0:4c:aa:e5:37:92:89:4d:db:c3:38:e2:f1:2a:d6 root@admin-node The key's randomart p_w_picpath is: +--[ RSA 2048]----+ | | | | | o | | + o | | + o o S | | B B . . | |+.@ * | |oooE o | |oo.. | +-----------------+
ssh-copy-id hadoop1
ssh-copy-id hadoop2
ssh-copy-id hadoop3
6.安裝mysql
[root@hadoop1]#tar -xvf MySQL-5.6.33-1.linux_glibc2.5.x86_64.rpm-bundle.tar [root@hadoop1]#rpm -ivh MySQL-*.rpm 修改配置文件路徑:cp /usr/share/mysql/my-default.cnf /etc/my.cnf
#配置mysql
[root@hadoop1]#vim /etc/my.cnf [mysqld] default-storage-engine = innodb innodb_file_per_table collation-server = utf8_general_ci init-connect = 'SET NAMES utf8' character-set-server = utf8
#初始化數據庫
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --user=mysql >>/dev/null
#啟動mysql
service mysqld start chkconfig mysqld on
- 查看mysql root初始化密碼
[root@hadoop1]# cat /root/.mysql_secret # The random password set for the root user at Fri Sep 16 11:13:25 2016 (local time): 9mp7uYFmgt6drdq3 - 登錄進行去更改密碼 [root@hadoop1]# mysql -u root -p mysql> SET PASSWORD=PASSWORD('123456'); - 允許mysql遠程訪問 mysql> grant all on *.* to root@"%" Identified by "www.123"; Query OK, 1 row affected (0.05 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
創建cdh所需要的庫
create database hive DEFAULT CHARSET utf8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.00 sec) create database amon DEFAULT CHARSET utf8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.00 sec) create database hue DEFAULT CHARSET utf8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.00 sec) create database monitor DEFAULT CHARSET utf8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.00 sec) create database oozie DEFAULT CHARSET utf8 COLLATE utf8_general_ci; Query OK, 1 row affected (0.00 sec)
7.第三方依賴包安裝(所有節點都安裝)
yum install chkconfig python bind-utils psmisc libxslt zlib sqlite fuse fuse-libs redhat-lsb cyrus-sasl-plain cyrus-sasl-gssapi
注意這個地方依賴包不安裝完下面啟動集群的時候會死活啟動不了的,這是血的教訓啊!
在hadoop1上準備mysql的jar包
[root@hadoop1]# mkdir -p /usr/share/java 修改jar包的名字,并拷貝到/usr/share/java/目錄 [root@hadoop1]# cp mysql-connector-java-5.1.40-bin.jar /usr/share/java/mysql-connector-java.jar
8.安裝Cloudera-Manager
解壓cm包到指定目錄,所有服務器都要做
[root@hadoop1 ~]#mkdir /opt/cloudera-manager [root@hadoop1 ~]# tar -axvf cloudera-manager-centos7-cm5.8.3_x86_64.tar.gz -C /opt/cloudera-manager
創建cloudera-scm用戶(所有節點)
[root@hadoop1 ~]# useradd -r -d /opt/cloudera-manager/cm-5.8.3/run/cloudera-scm-server -M -c "Cloudera SCM User" cloudera-scm
在hadoop2和hadoop3配置agent
vim /opt/cloudera-manager/cm-5.8.3/etc/cloudera-scm-agent/config.ini 將server_host改為CMS所在的主機名即hadoop1
主節點中創建parcel-repo倉庫
[root@hadoop1 ~]# chown cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo [root@hadoop1 ~]# mv CDH-5.8.3-1.cdh6.8.3.p0.2-el7.parcel.sha1 CDH-5.8.3-1.cdh6.8.3.p0.2-el7.parcel.sha [root@hadoop1 ~]# cp CDH-5.8.3-1.cdh6.8.3.p0.2-el7.parcel CDH-5.8.3-1.cdh6.8.3.p0.2-el7.parcel.sha manifest.json /opt/cloudera/parcel-repo
解釋:Clouder-Manager將CDHs從主節點的/opt/cloudera/parcel-repo目錄中抽取出來,分發解壓激活到各個節點的/opt/cloudera/parcels目錄中
初始腳本配置數據庫scm_prepare_database.sh(在主節點上)
[root@hadoop1 ~]# /opt/cloudera-manager/cm-5.8.3/share/cmf/schema/scm_prepare_database.sh mysql -h hadoop1 -P 3306 -uroot -pwww.123 --scm-host master scm scm scm JAVA_HOME=/usr/java/jdk1.8.0_45 Verifying that we can write to /opt/cloudera-manager/cm-5.8.3/etc/cloudera-scm-server Creating SCM configuration file in /opt/cloudera-manager/cm-5.8.3/etc/cloudera-scm-server Executing: /usr/java/jdk1.8.0_45/bin/java -cp /usr/share/java/mysql-connector-java.jar:/usr/share/java/oracle-connector-java.jar:/opt/cloudera-manager/cm-5.8.3/share/cmf/schema/../lib/* com.cloudera.enterprise.dbutil.DbCommandExecutor /opt/cloudera-manager/cm-5.8.3/etc/cloudera-scm-server/db.properties com.cloudera.cmf.db. [ main] DbCommandExecutor INFO Successfully connected to database. All done, your SCM database is configured correctly!
說明:這個腳本就是用來創建和配置CMS需要的數據庫的腳本。各參數是指:
mysql:數據庫用的是mysql,如果安裝過程中用的oracle,那么該參數就應該改為oracle。
-hhadoop1:數據庫建立在hadoop1主機上面。也就是主節點上面。
-uroot:root身份運行mysql。-123456:mysql的root密碼是***。
--scm-host hadoop1:CMS的主機,一般是和mysql安裝的主機是在同一個主機上。
最后三個參數是:數據庫名,數據庫用戶名,數據庫密碼。
10.在各個節點啟動agent服務
/opt/cloudera-manager/cm-5.8.3/etc/init.d/cloudera-scm-agent start
在master啟動server服務
/opt/cloudera-manager/cm-5.8.3/etc/init.d/cloudera-scm-server start
瀏覽器訪問
http://192.168.50.123:7180/cmf/login 用戶名admin 密碼admin
問題1:
service cloudera-scm-server status
cloudera-scm-server dead but pid file exists
解決
[root@master cm-5.8.3]# rm /root/hadoop/cm-5.8.3/run/cloudera-scm-server.pid
[root@master hadoop]# ./cm-5.8.3/etc/init.d/cloudera-scm-server restart
cloudera-scm-server is already stopped
Starting cloudera-scm-server: [ OK ]
問題2:
2016-12-08 03:40:57,479 ERROR WebServerImpl:com.cloudera.server.web.cmf.search.components.SearchRepositoryManager: The server storage directory [/var/lib/cloudera-scm-server] doesn't exist.
2016-12-08 03:40:57,479 ERROR WebServerImpl:com.cloudera.server.web.cmf.search.components.SearchRepositoryManager: No read permission to the server storage directory [/var/lib/cloudera-scm-server]
2016-12-08 03:40:57,479 ERROR WebServerImpl:com.cloudera.server.web.cmf.search.components.SearchRepositoryManager: No write permission to the server storage directory [/var/lib/cloudera-scm-server]
解決:
創建目錄并加上權限以后成功
mkdir /var/lib/cloudera-scm-server
chown -R cloudera-scm.cloudera-scm /var/lib/cloudera-scm-server
問題3:在CDH檢查主機哪里會有兩個警告
解決:
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo 10 > /proc/sys/vm/swappiness
參考網址:
http://blog.csdn.net/shawnhu007/article/details/52579204
http://www.cnblogs.com/itboys/p/5955545.html
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。