Amazon Linux AMI 离线安装CDH6.0.0
1.配置HOSTNAME
登陆bigdata01.pro服务器
输入命令:
$ sudo vi /etc/hosts
在打开的hosts的文件中输入以下内容:
192.168.63.164 bigdata01.pro
192.168.63.173 bigdata02.pro
192.168.63.185 bigdata03.pro
输入命令:
$ sudo /etc/sysconfig/network
在打开的network的文件中修改HOSTNAME:
NETWORKING=yes
HOSTNAME=bigdata01.pro
NOZEROCONF=yes
重启服务器HOSTNAME配置生效(AMI默认内网地址)
其他两台服务器同上操作
2.服务器ssh免密登陆
登陆bigdata01.pro服务器
输入命令:
$ ssh-keygen -t rsa
一直回车,注意rsa存放路径
输入命令:
$ ssh-copy-id -i .ssh/id_rsa.pub [email protected]
其他几台机器同上
3.配置NTP服务器
所有节点 安装ntp服务,ntp主节点为bigdata.pro
输入安装命令:
$ sudo yum install ntp
设置开机启动:
$ sudo chkconfig ntpd on
查看是否安装成功:
$ sudo chkconfig --list ntpd
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
3.1主节点配置
输入命令:
$ sudo vi /etc/ntp.conf
在
# the administrative functions.
restrict 127.0.0.1
restrict ::1
下新增配置内容:
server cn.ntp.org.cn prefer
完整内容:
# the administrative functions.
restrict 127.0.0.1
restrict ::1
server cn.ntp.org.cn prefer
对时,输入以下命令:
$ sudo ntpdate -u cn.ntp.org.cn
16 Oct 08:20:57 ntpdate[3294]: adjust time server 182.92.12.11 offset 0.000161 sec
启动服务:
$ sudo service ntpd start
检查是否启动成功(有些机器可能比较慢):
$ sudo ntpstat
ynchronised to NTP server (169.254.169.123) at stratum 4
time correct to within 12 ms
polling server every 128 s
3.2 从节点配置
输入命令:
$ sudo vi /etc/ntp.conf
在
# the administrative functions.
restrict 127.0.0.1
restrict ::1
新增一行
server bigdata03.pro
完整配置如下:
# the administrative functions.
restrict 127.0.0.1
restrict ::1
server bigdata03.goldwind
启动服务:
$ sudo service ntpd start
其他从节点同3.2
4.JDK安装
所有节点
- 使用CDH自带jdk
- 使用Oracle下载地址
官网要求JDK安装路径:
The JDK must be installed at /usr/java/jdk-version.
本教程地址为:/usr/java/jdk1.8.0_181
把下载后的JDK解压缩到/usr/java目录下
配置环境变量:
输入命令:
$ vi /etc/profile
输入内容:
export JAVA_HOME=/usr/java/jdk1.8.0_181
export JRE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
环境变量生效:
source /etc/profile
查看安装的版本:
$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
注意:
需要卸载openjdk
查看是否安装:
$ rpm -qa|grep java
tzdata-java-2018c-1.70.amzn1.noarch
javapackages-tools-0.9.1-1.5.amzn1.noarch
java-1.7.0-openjdk-1.7.0.181-2.6.14.8.80.amzn1.x86_64
卸载:
$ yum -y remove java-1.7.0-openjdk-1.7.0.181-2.6.14.8.80.amzn1.x86_64
5.关闭防火墙
所有节点
对于firewalld防火墙关闭命令如下:
# el7
$ systemctl stop firewalld
#el6
$ service firewalld stop
对于iptables 关闭命令如下:
# el7
$ systemctl stop iptables
#el6
service iptables stop (临时关闭)
chkconfig iptables off (重启后生效)
6.设置SELinux模式
在所有节点
- 检查SELinux当前状态:getenforce
$ getenforce
Disabled
- 如果输出为Permissive或Disabled,那么就可以不用设置SELinux+ 的模式了。
- 如果输出是enforcing,接着做下一步
- vi /etc/selinux/config (有些系统是 /etc/sysconfig/selinux);将 SELINUX=enforcing 修改为 SELINUX=permissive,保存并退出;
- 使设置立即生效输入
$ setenforce 0
7.安装Mysql请参考
建立相关表scm hive
输入命令:
$ mysql -u root -p
Enter password:
在mysql中输入以下命令:
#Cloudera Manager Server
CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'scm'@'%' IDENTIFIED BY 'your password';
GRANT ALL ON scm.* TO 'scm'@'%' IDENTIFIED BY 'your password';
FLUSH PRIVILEGES;
#Activity Monitor
CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'amon'@'%' IDENTIFIED BY 'your password';
GRANT ALL ON amon.* TO 'amon'@'%' IDENTIFIED BY 'your password';
FLUSH PRIVILEGES;
#Reports Manager
CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'rman'@'%' IDENTIFIED BY 'your password';
GRANT ALL ON rman.* TO 'rman'@'%' IDENTIFIED BY 'your password';
FLUSH PRIVILEGES;
#Hue
CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'hue'@'%' IDENTIFIED BY 'your password';
GRANT ALL ON hue.* TO 'hue'@'%' IDENTIFIED BY 'your password';
FLUSH PRIVILEGES;
#Hive Metastore Server
CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'hive'@'%' IDENTIFIED BY 'your password';
GRANT ALL ON metastore.* TO 'hive'@'%' IDENTIFIED BY 'your password';
FLUSH PRIVILEGES;
#Sentry Server
CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'sentry'@'%' IDENTIFIED BY 'your password';
GRANT ALL ON sentry.* TO 'sentry'@'%' IDENTIFIED BY 'your password';
FLUSH PRIVILEGES;
#Cloudera Navigator Audit Server
CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'nav'@'%' IDENTIFIED BY 'your password';
GRANT ALL ON nav.* TO 'nav'@'%' IDENTIFIED BY 'your password';
FLUSH PRIVILEGES;
#Cloudera Navigator Metadata Server
CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'navms'@'%' IDENTIFIED BY 'your password';
GRANT ALL ON navms.* TO 'navms'@'%' IDENTIFIED BY 'your password';
FLUSH PRIVILEGES;
#Oozie
CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
CREATE USER 'oozie'@'%' IDENTIFIED BY 'your password';
GRANT ALL ON oozie.* TO 'oozie'@'%' IDENTIFIED BY 'your password';
FLUSH PRIVILEGES;
执行以下命令,确认数据库和对应的用户权限是否正确创建:
$ SHOW DATABASES;
$ SHOW GRANTS FOR ''@'%';
配置mysql驱动地址
$ sudo cp mysql-connector-java-5.1.47-bin.jar /usr/share/java/mysql-connector-java.jar
$ cd /usr/share/java
$ sudo chmod 777 mysql-connector-java.jar
8.Cloudera Manager安装
涉及安装文件如下(下载地址cdh6 cm6):
#cdh6
CDH-6.0.0-1.cdh6.0.0.p0.537114-el6.parcel
CDH-6.0.0-1.cdh6.0.0.p0.537114-el6.parcel.sha256
manifest.json
#cm6
cloudera-manager-agent-6.0.0-530873.el6.x86_64.rpm
cloudera-manager-daemons-6.0.0-530873.el6.x86_64.rpm
cloudera-manager-server-6.0.0-530873.el6.x86_64.rpm
cloudera-manager-server-db-2-6.0.0-530873.el6.x86_64.rpm
oracle-j2sdk1.8-1.8.0+update141-1.x86_64.rpm
8.1 安装http服务
输入命令:
$ sudo yum -y install httpd
启动服务:
$ sudo service httpd start
检查是否启动成功(web安装目录在/var/www)浏览器输入服务器地址:
8.3 制作本地repo
将下载后的cdh6放到 cdh6.0.0目录下
$ cd cdh6.0.0
$ ls
CDH-6.0.0-1.cdh6.0.0.p0.537114-el6.parcel
CDH-6.0.0-1.cdh6.0.0.p0.537114-el6.parcel.sha256
manifest.json
将下载后的cm6放到 放到cm6.0.0目录下
$ cd cm6.0.0
$ ls
cloudera-manager-agent-6.0.0-530873.el6.x86_64.rpm
cloudera-manager-daemons-6.0.0-530873.el6.x86_64.rpm
cloudera-manager-server-6.0.0-530873.el6.x86_64.rpm
cloudera-manager-server-db-2-6.0.0-530873.el6.x86_64.rpm
oracle-j2sdk1.8-1.8.0+update141-1.x86_64.rpm
制作repo
cd到cm6.0.0所在目录执行命令:
$ createrepo cm6.0.0/
$ ls
cloudera-manager-agent-6.0.0-530873.el6.x86_64.rpm
cloudera-manager-daemons-6.0.0-530873.el6.x86_64.rpm
cloudera-manager-server-6.0.0-530873.el6.x86_64.rpm
cloudera-manager-server-db-2-6.0.0-530873.el6.x86_64.rpm
oracle-j2sdk1.8-1.8.0+update141-1.x86_64.rpm
repodata
将cm6.0.0 与cdh6.0.0移到/var/www/html目录下:
$ sudo mv cdh6.0.0/ /var/www/html/
$ sudo mv cm6.0.0/ /var/www/html/
在浏览器中查看相遇目录
ip/cm6.0.0/
ip/cdh6.0.0/
输入命令:
$ sudo vi /etc/yum.repos.d/cm.repo
输入内容:
[cmrepo]
name = cm_repo
baseurl =http://ip/cm6.0.0/
enable = true
gpgcheck = false
输入命令:
$ yum repolist
8.4 安装CMS
输入命令:
$ sudo yum -y install cloudera-manager-server
8.5 初始化数据库
输入命令:
$ sudo /opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm scm yourpassword
命令解释官网:
sudo /opt/cloudera/cm/schema/scm_prepare_database.sh [options]
8.6 启动Cloudera Manager Server
输入命令:
$ sudo service cloudera-scm-server start
Starting cloudera-scm-server: [ OK ]
检查7180端口:
$ netstat -lnt | grep 7180
tcp 0 0 0.0.0.0:7180 0.0.0.0:* LISTEN
浏览器打开地址http://ip:7180/cmf/login
8.7 安装CDH
集群向导安装输入账号admin 密码admin登陆CM
选择试用60(到期后自动转为Express方式运行)如图所示
点击继续 一直继续直到Specify Hosts 输入ip或者主机名点击搜索如下图:
点击继续如下图:
点击更多选项删除所有url 输入本地cdh http://ip/cdh6.0.0 如下图所示:
点击继续:
不选择jdk
点击继续:
点击继续...
一直继续下去
安装成功
9. 总结及注意
未完待续...