Cloudera Manager 6.2.1安装
1. 环境准备
1.1. 处理Linux环境
a) 确保各主机拥有root权限
主要是为了避免安装过程中的权限问题
b) 关闭防火墙
[root@abc] systemctl stop firewalld [root@abc] systemctl disable firewalld
c) 确保如下端口是开放的
https://www.cloudera.com/documentation/enterprise/6/6.1/topics/cm_ig_ports.html
d) 关闭SELinux
[root@abc] getenforce
如果输出为Disabled,则不需要修改配置,如果为enforcing,则需要做如下配置
[root@abc] vim /etc/selinux/config #----------------------------------- SELINUX=disabled #----------------------------------- :wq [root@abc] setenforce 0
e) 调整交换内存阀值
[root@abc] sysctl vm.swappiness=10 && echo "vm.swappiness=10" >> /etc/sysctl.conf
f) 关闭大内存页配置
[root@abc] echo never > /sys/kernel/mm/transparent_hugepage/defrag && echo never > /sys/kernel/mm/transparent_hugepage/enabled [root@abc] chmod +x /etc/rc.d/rc.local [root@abc] echo "echo never > /sys/kernel/mm/transparent_hugepage/defrag" >> /etc/rc.local [root@abc] echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >> /etc/rc.local
1.2. 配置HOSTNAME
主机规划:
IP |
主机名 |
配置 |
服务 |
10.6.222.85 |
txznwltesthadoop1 |
8c16g |
ClouderaManagerServer、ClouderaManagerAgent、ClouderaManagerService、HistoryServer(Spark)、JobHistoryServer(YARN)、HDFSBalancer |
10.6.222.86 |
txznwltesthadoop2 |
8c16g |
ClouderaManagerAgent、NameNode、ResourceManager、HMaster |
10.6.222.87 |
txznwltesthadoop3 |
24c48g |
ClouderaManagerAgent、DataName、NodeManager、HRegionServer、SparkGateway |
10.6.222.88 |
txznwltesthadoop4 |
24c48g |
ClouderaManagerAgent、DataName、NodeManager、HRegionServer、SparkGateway |
10.6.222.89 |
txznwltesthadoop5 |
24c48g |
ClouderaManagerAgent、DataName、NodeManager、HRegionServer、SparkGateway |
10.6.222.90 |
txznwltesthadoop6 |
8c16g |
ClouderaManagerAgent、ZooKeeper、KafkaBroker |
10.6.222.91 |
txznwltesthadoop7 |
8c16g |
ClouderaManagerAgent、ZooKeeper、KafkaBroker |
10.6.222.92 |
txznwltesthadoop8 |
8c16g |
ClouderaManagerAgent、ZooKeeper、KafkaBroker |
[root@abc] vim /etc/hostname #---------------------------------------- txznwltesthadoop1 # 对应的主机设置对应的主机名 #---------------------------------------- :wq [root@abc] vim /etc/sysconfig/network #---------------------------------------- HOSTNAME=txznwltesthadoop1 # 对应的主机设置对应的主机名 #---------------------------------------- :wq [root@abc] hostname txznwltesthadoop1 # 对应的主机设置对应的主机名 [root@abc] vim /etc/hosts #---------------------------------------- 10.6.222.85 txznwltesthadoop1 10.6.222.86 txznwltesthadoop2 10.6.222.87 txznwltesthadoop3 10.6.222.88 txznwltesthadoop4 10.6.222.89 txznwltesthadoop5 10.6.222.90 txznwltesthadoop6 10.6.222.91 txznwltesthadoop7 10.6.222.92 txznwltesthadoop8 #---------------------------------------- :wq
注意:这里必须设置,并且主机名不能有下划线
1.3. 配置SSH免密
使用ssh-copy-id进行免密配置
[root@abc] ssh-keygen -t rsa # 不需要设置密码,直接全部回车 [root@abc] ssh-copy-id -p 60028 root@10.6.222.85
或者直接在其他机器上配置公钥
# 在主机器上生成RSA密钥对 [root@abc] ssh-keygen -t rsa # 在需要背面密的机器上做如下操作 [root@abc] mkdir ~/.ssh && chmod 700 ~/.ssh && cd ~/.ssh [root@abc] echo "公钥<id_rsa.pub>内容" > authorized_keys && chmod 600 authorized_keys
1.4. JDK版本要求
JDK把版本必须符合以下: https://docs.cloudera.com/documentation/enterprise/6/6.1/topics/cm_intro_primer.html
注:需要先卸载与OpenJDK相关的所有包
1.5. NTP服务器配置
需要在所有节点上配置ntpd服务
[root@abc] yum -y install ntp [root@abc] vim /etc/ntp.conf #------------------------------------------------------- # 添加如下的server配置 server time1.aliyum.com prefer server time2.aliyum.com prefer server time3.aliyum.com prefer server time4.aliyum.com prefer server time5.aliyum.com prefer server time6.aliyum.com prefer server time7.aliyum.com prefer server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst #------------------------------------------------------- :wq [root@abc] systemctl enable ntpd.service && systemctl start ntpd.service
1.6. 其他环境
1. 必须安装python2.7,CentOS7自带可以忽略
2. 最好保证设备上只有一个网卡同时工作
3. 如果/tmp目录单独挂在了一个分区或者逻辑卷,则大小必须大于5G
2. 安装Cloudera Manager
2.1. Cloudera Manager部分的安装
YUM方式安装Cloudera Manager
[root@abc] wget https://archive.cloudera.com/cm6/6.1.1/redhat7/yum/cloudera-manager.repo -P /etc/yum.repos.d/ [root@abc] rpm --import https://archive.cloudera.com/cm6/6.1.1/redhat7/yum/RPM-GPG-KEY-cloudera [root@abc] yum list | grep cloudera [root@abc] yum install -y oracle-j2sdk1.8 cloudera-manager-daemons cloudera-manager-agent cloudera-manager-server [root@abc] echo "" >> /etc/profile && \ echo "export JAVA_HOME=/usr/local/jdk" >> /etc/profile && \ echo "export CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar" >> /etc/profile && \ echo "export PATH=\$PATH:\$JAVA_HOME/bin" >> /etc/profile && \ source /etc/profile [root@abc] java -version
注:由于安装包太大,所以不建议进行网络模式安装,最好提前下载好RPM包,然后使用下面的本地RPM方式进行安装;
本地RPM包进行安装
### 所有节点执行如下操作 [root@abc] wget https://archive.cloudera.com/cm6/6.1.1/redhat7/yum/RPMS/x86_64/cloudera-manager-daemons-6.1.1-853290.el7.x86_64.rpm -P /opt/src/ [root@abc] wget https://archive.cloudera.com/cm6/6.1.1/redhat7/yum/RPMS/x86_64/cloudera-manager-agent-6.1.1-853290.el7.x86_64.rpm -P /opt/src/ [root@abc] wget https://archive.cloudera.com/cm6/6.1.1/redhat7/yum/RPMS/x86_64/ oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm -P /opt/src/ [root@abc] yum -y localinstall /opt/src/oracle-j2sdk1.8-1.8.0+update181-1.x86_64.rpm –nogpgcheck [root@abc] ln -s /usr/java/jdk1.8.0_181-cloudera /usr/local/jdk [root@abc] echo "" >> /etc/profile && \ echo "export JAVA_HOME=/usr/local/jdk" >> /etc/profile && \ echo "export CLASSPATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar" >> /etc/profile && \ echo "export PATH=\$PATH:\$JAVA_HOME/bin" >> /etc/profile && \ source /etc/profile [root@abc] java -version [root@abc] yum -y localinstall /opt/src/cloudera-manager-daemons-6.1.1-853290.el7.x86_64.rpm --nogpgcheck [root@abc] yum -y localinstall /opt/src/cloudera-manager-agent-6.1.1-853290.el7.x86_64.rpm –nogpgcheck ### 仅Master主控节点需要指向如下操作 [root@abc] wget https://archive.cloudera.com/cm6/6.1.1/redhat7/yum/RPMS/x86_64/cloudera-manager-server-6.1.1-853290.el7.x86_64.rpm -P /opt/src/ [root@abc] yum -y localinstall /opt/src/cloudera-manager-server-6.1.1-853290.el7.x86_64.rpm --nogpgcheck
注:注意安装顺序,包之间是有依赖的
2.2. 预先准备CDH Parcel相关文件
[root@abc] wget https://archive.cloudera.com/cdh6/6.1.1/parcels/manifest.json -P /opt/src/ [root@abc] wget https://archive.cloudera.com/cdh6/6.1.1/parcels/CDH-6.1.1-1.cdh6.1.1.p0.875250-el7.parcel -P /opt/src/ # 如果 /opt/cloudera/parcel-repo/ 目录存在,则不需要创建 [root@abc] mkdir /opt/cloudera/parcel-repo/ [root@abc] cp /opt/src/parcel/manifest.json /opt/cloudera/parcel-repo/ [root@abc] cp /opt/src/parcel/CDH-6.1.1-1.cdh6.1.1.p0.875250-el7.parcel /opt/cloudera/parcel-repo/ [root@abc] sha1sum /opt/src/parcel/CDH-6.1.1-1.cdh6.1.1.p0.875250-el7.parcel [root@abc] echo "生成的SHA1字符串" >> /opt/cloudera/parcel-repo/CDH-6.1.1-1.cdh6.1.1.p0.875250-el7.parcel.sha [root@abc] chown cloudera-scm:cloudera-scm -R /opt/cloudera/parcel-repo/
2.3. 安装MySQL
MySQL版本为:mysql-5.7.24-el7-x86_64
[root@abc] wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.24-el7-x86_64.tar.gz -P /opt/src/ [root@abc] groupadd mysql && useradd mysql -g mysql [root@abc] tar -zxvf /opt/src/mysql-5.7.24-el7-x86_64.tar.gz -C /opt/app/ [root@abc] ln -s /opt/app/mysql-5.7.24-el7-x86_64 /usr/local/mysql [root@abc] mkdir -p /opt/data/mysql/{data,logs} [root@abc] chown mysql:mysql -R /opt/app/mysql-5.7.24-el7-x86_64 /usr/local/mysql /opt/data/mysql
配置MySQL
[root@abc] cp /etc/my.cnf /etc/my_sample.cnf [root@abc] vim /etc/my.cnf #----------------------------------------------------------------------------- [client] port=3306 [mysql] socket=/opt/data/mysql/mysqld.sock [mysqld] basedir=/usr/local/mysql datadir=/opt/data/mysql/data socket=/opt/data/mysql/mysqld.sock transaction-isolation = READ-COMMITTED # Disabling symbolic-links is recommended to prevent assorted security risks; # to do so, uncomment this line: 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 #expire_logs_days = 10 #max_binlog_size = 100M #log_bin should be on a disk with enough free space. #Replace '/var/lib/mysql/mysql_binary_log' with an appropriate path for your #system and chown the specified folder to the mysql user. log_bin=/opt/data/mysql/mysql_binary_log #In later versions of MySQL, if you enable the binary log and do not set #a server_id, MySQL will not start. The server_id must be unique within #the replicating group. server_id=1 binlog_format = mixed read_buffer_size = 2M read_rnd_buffer_size = 16M sort_buffer_size = 8M join_buffer_size = 8M # InnoDB settings innodb_file_per_table = 1 innodb_flush_log_at_trx_commit = 2 innodb_log_buffer_size = 64M innodb_buffer_pool_size = 2G innodb_thread_concurrency = 8 innodb_flush_method = O_DIRECT innodb_log_file_size = 512M [mysqld_safe] log-error=/opt/data/mysql/logs/mysqld_safe.log pid-file=/opt/data/mysql/logs/mysqld_dafe.pid sql_mode=STRICT_ALL_TABLES #----------------------------------------------------------------------------- :wq
初始化数据库
[root@abc] ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/opt/data/mysql/data
# 注意打印出的日志里面的 root 用户的初始密码,没有密码不能登录,之后会修改密码
配制成SystemCTL服务
[root@abc] vim /usr/lib/systemd/system/mysqld.service #------------------------------------------------------------ [Unit] Description=mysql After=network.target remote-fs.target nss-lookup.target [Service] User=mysql Group=mysql Type=forking ExecStart=/usr/local/mysql/support-files/mysql.server start ExecReload=/usr/local/mysql/support-files/mysql.server restart ExecStop=/usr/local/mysql/support-files/mysql.server stop #PrivateTmp=true [Install] WantedBy=multi-user.target #------------------------------------------------------------ :wq ##注意:启动、重启、停止命令全部要求使用绝对路径 [root@abc] chmod +x /usr/lib/systemd/system/mysqld.service [root@abc] systemctl daemon-reload & systemctl enable mysqld.service & systemctl start mysqld.service
登录修改密码
[root@abc] mysql -uroot -p Enter password: -> alter user 'root'@'localhost' identified by 'root'; -> use mysql -> update user set host='%' where user='root'; -> flush privileges; -> quit;
创建Cloudera Manager需要的数据库
[root@abc] mysql -uroot -p Enter password: -> CREATE DATABASE scm DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; -> CREATE DATABASE amon DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; -> CREATE DATABASE rman DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; -> CREATE DATABASE hue DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; -> CREATE DATABASE metastore DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; -> CREATE DATABASE sentry DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; -> CREATE DATABASE nav DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; -> CREATE DATABASE navms DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; -> CREATE DATABASE oozie DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; > CREATE DATABASE hive DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; -> quit;
主节点下载并配置MySQL驱动
[root@abc] wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz -P /opt/src/ [root@abc] mkdir -p /usr/share/java/ [root@abc] tar -zxvf /opt/src/mysql-connector-java-5.1.46.tar.gz -C /opt/src/ [root@abc] cp /opt/src/mysql-connector-java-5.1.46/mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar
注:Cloudera Manager是用的MySQL驱动版本必须是5.1
初始化Cloudera Manager Database(MySQL)
[root@abc] /opt/cloudera/cm/schema/scm_prepare_database.sh mysql scm root root # 解释: # /opt/cloudera/cm/schema/scm_prepare_database.sh 数据库类型 数据库名 用户名 密码 # Cloudera Manager Database默认名为scm,默认用户名为scm (具体请以你建库时的设计为准)。
2.4. 启动Cloudera Manager
[root@abc] systemctl enable cloudera-scm-server && systemctl start cloudera-scm-server
3. 开始使用并配置Cloudera Manager
3.1. Cloudera Manager 欢迎页
初始默认账号和密码为:admin/admin
注:当前安装版本为6.2.1,这里图片是以前安装6.1.1时截的,差别不大。
3.2. Cloudera Manager用户协议
3.3. 选择Cloudera Manager版本(免费版还是商业版)
3.4. Cloudera Manager集群安装欢迎页
3.5. 配置集群主机节点
3.6. 选择CDH版本并下载
注:当前安装版本为6.2.1,直接选择6.2.1的cdh即可,上图为以前安装6.1.1时截的图。
3.7. Java安装
注:由于之前已经安装好了JDK所以这里不用勾选
3.8. 提供SSH登入凭据
注:私钥文件需要将上传服务器上的id_rsa文件。由于生成rsa密钥对的时候没有输入密码,说以这里也不需要输入密码。由于只有8个节点,所以同时安装数输入8就够了;
3.9. 开始所有主机的相关服务安装
注意:
1.如果只是出现上述问题,说明软件后已经安装成功,那么可以忽略进入下一步;
2.如果各个节点安装详细信息出现 Delta RPMs disabled because /usr/bin/applydeltarpm not installed.错误
则需要:
[root@abc] yum provides '*/applydeltarpm' && yum install deltarpm
3.在执行之前,最好自己先在从节点安装好cloudera-manager-daemons和cloudera-manager-agent服务,这样既可以不用等待太长时间
3.10. 开始CDH的下载和分发
如果出现:
则需要删除问题节点的/var/lib/cloudera-scm-agent/cm_guid文件,然后重启问题节点的cloudera-scm-agent服务
3.11. 检查各个主机环境
如果有警告问题可按页面提示进行操作,解决问题
3.12. 开始CDH相关服务的安装
选择自定义服务,这里部署HBase、HDFS、Kafka、Spark、YARN、Hive、ZooKeeper等服务
3.13. 配置Hive MetaStore数据库
这里cloudera默认会给一个服务在集群中的分布情况,自己也可以进行修改
这里需要修改数据存储目录,和填写邮箱,host monitor和service monitor存储目录,目录在启动时自己创建;
3.14. 集群搭建成功