您好,登錄后才能下訂單哦!
大數據集群管理方式分為手工方式(Apache hadoop)和工具方式(Ambari + hdp 和Cloudera Manger + CDH)
主機:
192.168.0.32:Server+agent
192.168.0.33:agent
192.168.0.34:agent
安裝之前準備環境:
網絡名稱
CDH需要IPv4。不支持IPv6。
按如下方式配置群集中的每個主機,以確保所有成員可以相互通信:
將主機名設置為唯一名稱(不是 本地主機)。
sudo hostnamectl set-hostname hadoop01.youe.com
編輯 / etc / hosts文件使用群集中每個主機的IP地址和完全限定的域名(FQDN)。您也可以添加非限定名稱。
192.168.0.32 hadoop01.youe.com
192.168.0.33 hadoop02.youe.com
192.168.0.34 hadoop03.youe.com
每個主機的規范名稱 / etc / hosts文件 必須是FQDN(例如myhost-1.example.com),而不是不合格的主機名(例如 為myhost-1)。規范名稱是IP地址后的第一個條目。
不要使用別名 / etc / hosts文件 或者配置DNS。
不合格的主機名(短名稱)在Cloudera Manager實例中必須是唯一的。例如,您不能同時擁有由同一Cloudera Manager Server管理的host01.example.com和host01.standby.example.com。
編輯 /etc/sysconfig/network 僅限此主機的FQDN:
HOSTNAME = hadoop01.youe.com
禁用防火墻和selinux(所有會話)
NTP(所有會話)
CDH要求您在群集中的每臺計算機上配置網絡時間協議(NTP)服務。要啟動NTP并將其配置為在重新引導時自動運行,請在群集中的每個節點上執行以下步驟。
yum -y install ntp
編輯 /etc/ntp.conf文件添加NTP服務器
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
啟動ntp
systemctl enable ntpd
systemctl start ntpd
同步節點
ntpdate -u 0.pool.ntp.org
同步系統時鐘
hwclock --systohc
python版本
python2.7(centos7默認python2.7)
ssh免秘鑰登錄:生成私鑰和公鑰(所有節點)
ssh-keygen -t rsa -P ''
ssh-copy-id root@192.168.0.33
ssh-copy-id root@192.168.0.34
ssh-copy-id root@192.168.0.32
Master可以通過ssh連接到32 33 34
安裝cloudera manager server
安裝存儲庫(所有節點)
wget https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/cloudera-manager.repo -P /etc/yum.repos.d/
導入存儲庫簽名GPG密鑰:
rpm --import https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPM-GPG-KEY-cloudera
安裝jdk配置環境變量(所有會話)
* The JDK must be 64-bit. Do not use a 32-bit JDK.
* The installed JDK must be a supported version as documented in Java Requirements.
* The same version of the Oracle JDK must be installed on each cluster host.
* The JDK must be installed at /usr/java/jdk-version.
為Cloudera Manager配置存儲庫后,可以使用軟件包管理器在Cloudera Manager Server主機上安裝Oracle JDK,如下所示:
yum -y install oracle-j2sdk1.8
如果手動安裝jdk,必須安裝到/usr/java/目錄下
安裝cloudera manager包
Master節點:
yum -y install cloudera-manager-agent cloudera-manager-daemons cloudera-manager-server
Node節點:
yum -y install cloudera-manager-agent cloudera-manager-daemons
cloudera-manager-daemons是server和agent必須安裝的,大概有1.3G大小。
也可以提前去下載rpm包進行安裝:https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/
wget https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/cloudera-manager-daemons-6.0.0-530873.el7.x86_64.rpm
wget https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/cloudera-manager-server-6.0.0-530873.el7.x86_64.rpm
wget https://archive.cloudera.com/cm6/6.0.0/redhat7/yum/RPMS/x86_64/cloudera-manager-agent-6.0.0-530873.el7.x86_64.rpm
如果用rpm包安裝,先安裝cloudera-manager-daemons,然后在安裝cloudera-manager-server和cloudera-manager-agent
啟用Auto-TLS以自動創建證書:(后面配置麻煩,如果不開啟https,可以跳過此項)
https://www.cloudera.com/documentation/enterprise/6/latest/topics/auto_tls.html#auto_tls
注意: Auto-TLS支持兩種選擇:
* 選項1:使用Cloudera Manager生成內部證書頒發機構和相應的證書
* 選項2:使用現有的證書頒發機構和相應的證書
這里使用選項1,使auto-TLS能夠使用由Cloudera Manager創建和管理的內部證書頒發機構(CA)。要使用受信任的公共CA(選項2),必須首先獲取群集主機的證書。
必須在新安裝過程中啟用Auto-TLS 。無法在現有群集上啟用自動TLS。在將任何主機添加到Cloudera Manager之前,必須啟用Auto-TLS。
在Cloudera Manager Server主機上安裝 Cloudera Manager Agent 之后,在啟動Cloudera Manager之前,請按如下所示啟用auto-TLS。
JAVA_HOME=/usr/java/jdk1.8.0_141 /opt/cloudera/cm-agent/bin/certmanager setup --configure-services
將JDK版本替換為適合您環境的正確路徑。如果要將文件存儲在默認目錄以外的目錄中( /var/lib/cloudera-scm-server/certmanager),添加 --location選項如下:
JAVA_HOME=/usr/java/jdk1.8.0_121 /opt/cloudera/cm-agent/bin/certmanager --location /opt/cloudera/CMCA setup --configure-services
/opt/cloudera/CMCA此目錄是自動創建的,在運行該命令之前不得存在。檢查/var/log/cloudera-scm-agent/certmanager.log 日志文件以確認目錄已創建。
安裝mysql:
https://www.cloudera.com/documentation/enterprise/6/latest/topics/cm_ig_mysql.html#cmig_topic_5_5_2
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
yum -y install mysql-community-release-el7-5.noarch.rpm
yum -y update
yum -y install mysql-server
* 對于MySQL 5.6和5.7,必須安裝MySQL-shared-compat或MySQL-shared軟件包。這是Cloudera Manager Agent軟件包安裝所必需的。
* 如果在MySQL中啟用了基于GTID的復制,則Cloudera Manager安裝將失敗。
1. Move old InnoDB log files /var/lib/mysql/ib_logfile0 and /var/lib/mysql/ib_logfile1 out of /var/lib/mysql/ to a backup location.
rm -rf /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile1
如果要對現有數據庫進行更改,請確保在繼續之前停止使用該數據庫的任何服務。
vim /etc/my.cnf
#官方推薦配置文件
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
transaction-isolation = READ-COMMITTED
symbolic-links = 0
key_buffer_size = 32M
max_allowed_packet = 32M
thread_stack = 256K
thread_cache_size = 64
query_cache_limit = 8M
query_cache_size = 64M
query_cache_type = 1
max_connections = 550
log_bin=/var/lib/mysql/mysql_binary_log
server_id=1
binlog_format = mixed
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
innodb_file_per_table = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 64M
innodb_buffer_pool_size = 4G
innodb_thread_concurrency = 8
innodb_flush_method = O_DIRECT
innodb_log_file_size = 512M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
sql_mode=STRICT_ALL_TABLES
systemctl enable mysqld
systemctl start mysqld
初始化Mysql
/usr/bin/mysql_secure_installation
[...]
Enter current password for root (enter for none):Asd@12345
OK, successfully used password, moving on...
[...]
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
[...]
Disallow root login remotely? [Y/n] N
[...]
Remove test database and access to it [Y/n] Y
[...]
Reload privilege tables now? [Y/n] Y
All done!
安裝MySQL JDBC驅動程序
wget https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz
tar zxvf mysql-connector-java-5.1.46.tar.gz
mkdir -p /usr/share/java/
cd mysql-connector-java-5.1.46
cp mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar
為Cloudera軟件創建數據庫:https://www.cloudera.com/documentation/enterprise/6/latest/topics/prepare_cm_database.html
必須配置數據庫以支持MySQL UTF8 字符集編碼。
mysql -u root -pAsd@12345
create database scm default character set utf8 default collate utf8_general_ci;
grant all on scm.* to 'scm'@'%' identified by 'Admin@123';
create database amon default character set utf8 default collate utf8_general_ci;
grant all on amon.* to 'amon'@'%' identified by 'Admin@123';
create database rman default character set utf8 default collate utf8_general_ci;
grant all on rman.* to 'rman'@'%' identified by 'Admin@123';
create database hue default character set utf8 default collate utf8_general_ci;
grant all on hue.* to 'hue'@'%' identified by 'Admin@123';
create database metastore default character set utf8 default collate utf8_general_ci;
grant all on metastore.* to 'hive'@'%' identified by 'Admin@123';
create database sentry default character set utf8 default collate utf8_general_ci;
grant all on sentry.* to 'sentry'@'%' identified by 'Admin@123';
create database nav default character set utf8 default collate utf8_general_ci;
grant all on nav.* to 'nav'@'%' identified by 'Admin@123';
create database oozie default character set utf8 default collate utf8_general_ci;
grant all on oozie.* to 'oozie'@'%' identified by 'Admin@123';
flush privileges;
設置Cloudera Manager數據庫
mysql在本地時執行:
rm -rf /etc/cloudera-scm-server/db.mgmt.properties
/opt/cloudera/cm/schema/scm_prepare_database.sh <databaseType> <databaseName> <databaseUser> <datapasswd>
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm
會生成/etc/cloudera-scm-server/db.properties,里面是數據庫的連接信息,如果這個文件有誤,或者不存在,后面的服務無法啟動。
可能會報錯:無法在這個主機上找到兼容的Java版本,要么是因為javahome沒有被設置,要么是因為Java的兼容版本沒有安裝。
解決方法:JAVA_HOME路徑以/opt/cloudera/cm-agent/service/common/cloudera-config.sh里面配置的路徑為準
mysql不在本地時執行:
在Cloudera Manager Server主機上運行腳本(cm01.example.com)并連接到遠程MySQL主機(db01.example.com):
/opt/cloudera/cm/schema/scm_prepare_database.sh mysql -h db01.example.com --scm-host cm01.example.com scm scm
如果要安裝CDH 6,請不要選擇KAFKA,KUDU或SPARK包裹,因為它們包含在CDH 6中
手動下載地址:
wget https://archive.cloudera.com/cdh7/6.0.0/parcels/CDH-6.0.0-1.cdh7.0.0.p0.537114-el7.parcel
wget https://archive.cloudera.com/cdh7/6.0.0/parcels/CDH-6.0.0-1.cdh7.0.0.p0.537114-el7.parcel.sha256
wget https://archive.cloudera.com/cdh7/6.0.0/parcels/manifest.json
將CHD6相關的Parcel包放到主節點的/opt/cloudera/parcel-repo/目錄中,如果沒有此目錄,可以自己創建。
注意:最后將CDH-6.0.0-1.cdh7.0.0.p0.537114-el7.parcel.sha256,重命名為CDH-6.0.0-1.cdh7.0.0.p0.537114-el7.parcel.sha,這點必須注意,否則系統會重新下載CDH-6.0.0-1.cdh7.0.0.p0.537114-el7.parcel文件。
重要!--->在manifest.json文件中,找到對應版本的秘鑰,復制到.sha文件中。如果manifest.json文件中秘鑰錯誤,系統也會重新下載CDH包。
chown cloudera-scm:cloudera-scm /opt/cloudera/ -R
chown cloudera-scm:cloudera-scm /var/log/cloudera-scm-agent -R
禁用透明大頁面壓縮
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
并將上面的兩條命令寫入開機自啟動
vim /etc/rc.local
優化交換分區:https://blog.csdn.net/lufeisan/article/details/53339991
vim /etc/sysctl.conf
vm.swappiness = 10
sysctl -p /etc/sysctl.conf
設置Cloudera Manager數據庫后,啟動Cloudera Manager Server,然后登錄Cloudera Manager Admin Console:
啟動Cloudera Manager Server:
systemctl start cloudera-scm-server
可以查看啟動日志
tail -f /var/log/cloudera-scm-server/cloudera-scm-server.log
看到此條信息,說明啟動完成
INFO WebServerImpl:com.cloudera.server.cmf.WebServerImpl: Started Jetty server.
登錄
在Web瀏覽器中,轉到 192.168.0.32:7180,其中<server_host> 是運行Cloudera Manager Server的主機的FQDN或IP地址。
如果您啟用了自動TLS,則會重定向到https://<server_host>:7183,并顯示安全警告。您可能需要表明您信任該證書,或單擊以繼續執行Cloudera Manager Server主機。
登錄Cloudera Manager Admin Console。默認憑據為:
Username: admin
Password: admin
安裝過程中報錯1: could not contact scm server at localhost:7182, giving up
BEGIN python -c 'import socket; import sys; s = socket.socket(socket.AF_INET); s.settimeout(5.0); s.connect((sys.argv[1], int(sys.argv[2]))); s.close();' localhost 7182
解決方法: 將連不上的機器 /usr/bin/host 文件刪掉, 這樣Cloudera Manager就會直接使用 ip進行連接。
報錯2:
解決方法:查看這個進程,然后殺死進程,重新啟動就可以了
ps -ef | grep supervisord
kill -9 <processID>
systemctl restart cloudera-scm-agent
如果部署失敗,可以卸載刪除Cloudera Manger環境,重新部署。
systemctl stop cloudera-scm-server
systemctl stop cloudera-scm-agent
yum -y remove 'cloudera-manager-*'
yum clean all
umount cm_processes
umount /var/run/cloudera-scm-agent/process
rm -Rf /usr/share/cmf /var/lib/cloudera* /var/cache/yum/cloudera* /var/log/cloudera* /var/run/cloudera*
rm -rf /tmp/.scm_prepare_node.lock
rm -Rf /var/lib/flume-ng /var/lib/hadoop* /var/lib/hue /var/lib/navigator /var/lib/oozie /var/lib/solr /var/lib/sqoop* /var/lib/zookeeper
rm -Rf data_drive_path/dfs data_drive_path/mapred data_drive_path/yarn
systemctl stop mysqld
yum -y remove mysql
rm -rf /var/lib/mysql
rm -rf /var/log/mysqld.log
rm -rf /var/lib/mysql/mysql
rm -rf /usr/lib64/mysql
rm -rf /usr/share/mysql
rm -rf /opt/cloudera/cm/cloudera-navigator-audit-server/schema/mysql
rm -rf /opt/cloudera/cm/cloudera-navigator-server/schema/mysql
rm -rf /opt/cloudera/cm/schema/mysql
rpm -qa | grep -i mysql
yum -y remove MySQL-python-1.2.5-1.el7.x86_64
yum -y remove mysql-community-libs-5.7.23-1.el7.x86_64
yum -y remove mysql57-community-release-el7-10.noarch
yum -y remove mysql-community-common-5.7.23-1.el7.x86_64
yum -y remove mysql-community-libs-compat-5.7.23-1.el7.x86_64
yum -y remove mysql-connector-java-5.1.25-3.el7.noarch
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。