信息安全从业人员^_^
一个未入门de情报学胖子(邮箱:tenghm1986@163.com)
Toggle navigation
信息安全从业人员^_^
主页
About Me
归档
标签
通过CM搭建CDH集群
2019-09-25 11:21:01
915
0
0
heming
# 0.参考 [1] [Cloudera Enterprise 5.7.x Documentation](https://www.cloudera.com/documentation/enterprise/5-7-x.html) [2] [CDH5 and Cloudera Manager 5 Requirements and Supported Versions](https://www.cloudera.com/documentation/enterprise/release-notes/topics/rn_consolidated_pcm.html#cm_cdh_compatibility) [3] [Installation in a Cloudera Manager deployment(recommended method)](https://www.cloudera.com/documentation/enterprise/5-7-x/topics/installation_installation.html#concept_qpf_2d2_2p) [4] [centos 7 离线安装Cloudera](https://blog.csdn.net/chenhai201/article/details/78856007) [5] [centos 7 yum 配置安装Mariadb数据库](https://blog.csdn.net/qq_39719589/article/details/81835330) [6] [centos下完全卸载mysql](https://www.cnblogs.com/wanghuaijun/p/6398240.html) [7] [Cloudera Manager卸载笔记](https://www.cnblogs.com/dolittle/p/5767337.html) [8] [Parcels方式离线安装CDH5](https://www.jianshu.com/p/0a323137fe4f) [9] [Enabling HDFS HA](https://docs.cloudera.com/documentation/enterprise/5-4-x/topics/cdh_hag_hdfs_ha_enabling.html#cmug_topic_5_12_1) [10] [namenode ha](https://blog.csdn.net/freedomboy319/article/details/46357495) # 0.1 foreword > CDH Requirements for Cloudera Manager(CDH与CM版本适配问题) Cloudera uses the following versioning convention(cloudera使用通常的版本规则):`major.minor.maintenance` for example `Cloudera Manager 5.14.0`,the `major version` is `5`,the `minor version` is `14`,and the `maintenance version` is `0` the `Cloudera Manager minor version` must always be `equal to` or `greater` than the `CDH minor version`. --- **满足如下规则:** CM.major = CDH.major CM.minor >= CDH.minor --- # 1.下载 > CM5.13.3 [cloudera-manager-centos7-cm5.13.3_x86_64.tar.gz](http://archive.cloudera.com/cm5/cm/5/) >CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel/CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel.sha1/manifest.json [CDH-5.7.0-1.cdh5.7.0.p0.45-el7](http://archive.cloudera.com/cdh5/parcels/5.7.0/) # 2.准备工作 ## 2.1 hostname修改及hosts(master and slave server) ``` hostnamectl --static set-hostname master ``` >/etc/hosts ``` 192.168.222.148 master 192.168.222.149 slave01 192.168.222.150 slave02 ``` ## 2.2 关闭防火墙(master and slave server) >关闭防火墙 ``` systemctl stop firewalld.service systemctl disable firewalld.service firewall-cmd --state ``` > 关闭selinux ``` vim /etc/selinux/config #找到SELINUX改为: SELINUX=disabled ``` ## 2.3 所有节点ssh无密码登录(master and slave server) master上执行: ``` ssh-keygen -t rsa ssh-copy-id -i ~/.ssh/id_rsa.pub root@master #将公钥拷贝到本机的authorized_keys上 ``` 其他节点分别执行: ``` ssh-keygen -t rsa ssh-copy-id -i ~/.ssh/id_rsa.pub root@master #将公钥拷贝到本机的authorized_keys上 ``` 在master上,将authorized_keys分发到其他节点服务器 ``` scp ~/.ssh/authorized_keys root@slave01:~/.ssh/ scp ~/.ssh/authorized_keys root@slave02:~/.ssh/ ``` ## 2.4 java 安装(master and slave server) - 1.卸载已安装java ``` rpm -qa | grep java rpm -e xxx --nodeps ``` - 2.下载[jdk-8u221-linux-x64.tar.gz](https://www.oracle.com/technetwork/java/javase/downloads/index.html) - 3.解压后拷贝/usr/java/(`cp -r ./jdk1.8.0_221 /usr/java/`) - 4.设置环境变量 > /etc/profile.d/java.sh ``` #!/bin/bash JAVA_HOME=/usr/java/jdk1.8.0_221 PATH=$JAVA_HOME/bin:$PATH export PATH JAVA_HOME export CLASSPATH=. ``` - 5.chmod +x java.sh - 6.source /etc/profile.d/java.sh ## 2.5 ntp时间同步 每台server上安装: ``` yum install ntp -y ``` > master上: ``` vim /etc/ntp.conf ``` 修改成如下配置: ``` server cn.pool.ntp.org prefer server 1.cn.pool.ntp.org iburst server 2.cn.pool.ntp.org iburst server 3.cn.pool.ntp.org iburst server 0.cn.pool.ntp.org iburst ``` > slave01-slave02 server修改/etc/ntp.conf ``` server master server 1.cn.pool.ntp.org iburst server 2.cn.pool.ntp.org iburst server 3.cn.pool.ntp.org iburst server 0.cn.pool.ntp.org iburst ``` > 常用时间同步命令 ``` ntpdate cn.pool.ntp.org ntpdate master ntpstat # 查看同步状态 ``` >开机启动 ``` systemctl start ntpd systemctl enable ntpd ``` ## 2.6 mysql(centos 7)(master server) ref:[How to install mysql on centos 7](https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-centos-7) >安装mysql ``` wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm sudo yum install mysql-server sudo systemctl start mysqld sudo systemctl status mysqld ``` 修改初始密码: ``` sudo grep 'password' /var/log/mysqld.log #获取初始密码 mysql -u root -p*** mysql>set password for 'root'@'localhost' = password('hadoop123'); mysql > grant all privileges on *.* to 'root'@'localhost' IDENTIFIED BY '你的密码'with grant option ; mysql > grant all privileges on *.* to 'root'@'%' identified by 'Hadoop-123' with grant option; #允许远程连接 mysql> flush privileges; ``` 启动: ``` sudo systemctl start mysqld sudo systemctl status mysqld ``` turn off mysql password validation ``` mysql -h localhost -u root -p uninstall plugin validate_password; ``` ``` SHOW VARIABLES LIKE 'validate_password%'; SET GLOBAL validate_password_length = 6; SET GLOBAL validate_password_number_count = 0; ``` --- **1.mysql 卸载** ``` rpm -qa | grep -i mysql rpm -e mysql** ``` **2.删除mysql服务** ``` chkconfig --list | grep -i mysql chkconfig --del mysql ``` **3.删除分散mysql文件夹** ``` whereis mysql # 寻找mysql相关目录 find / -name mysql rm -rf /usr/lib/mysql rm -rf /usr/share/mysql rm -rf /usr/my.cnf ``` --- # 3. CM配置 将cloudera-manager-centos7-cm5.13.3_x86_64.tar.gz包解压到`/opt`目录下 ## 3.1 mysql驱动安装 1.下载mysql jdbc驱动 ``` wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.46.tar.gz ``` 2.解压 ``` tar -xvzf mysql-connector-java-5.1.46.tar.gz ``` 3.拷贝并重命名 ``` cp mysql-connector-java-5.1.46-bin.jar /opt/cm-5.13.3/share/cmf/lib/mysql-connector-java.jar cp mysql-connector-java-5.1.46-bin.jar /usr/share/java/mysql-connector-java.jar #hive-metastore用 ``` ## 3.2 创建cloudera用的数据库/用户名(scm/scm/scm) **master节点执行:** ``` /opt/cm-5.13.3/share/cmf/schema/scm_prepare_database.sh mysql -h master -uroot -p1258521 --scm-host master scm scm scm ``` >广西人大 ``` /opt/cm-5.13.3/share/cmf/schema/scm_prepare_database.sh mysql -h rdbgt-zgdx-sjpt-app002 -uroot -pHadoop-123 --scm-host rdbgt-zgdx-sjpt-app002 scm scm scm useradd --system --home=/opt/cm‐5.13.3/run/cloudera-scmserver/ --no-create-home --shell=/bin/false --comment "Cloudera SCM-User" cloudera-scm # create mysql -u root -p #password:mysql@bigproxy mysql > use mysql; mysql > select host,user from user; mysql > update user set password=password('mysql@bigproxy') where user="root" and host="bg.qz.com-1"; flush privileges; ``` 相关命令解释 --- ``` scm_prepare_database.sh database-type [options] database-name username password ``` **Required Parameters** |Parameter|Description|comments| |:--|:--|:--| |database-type|mysql/oracle/PostgreSQL|| |database-name|CM用的数据库名称|| |username|CM用于数据库连接user,会自动创建|| |password|CM用于数据库连接的passwd,指定后创建|| **options** |Options|Description|comments| |:--|:--|:--| |--scm-host|the hostname where the CM server is installed|| |-h|the ip or hostname of the host where the database is installed|| |-u|the admin user name of database|| |-p|the admin passwd for the db application|| > demo ``` /opt/cm-5.13.3/share/cmf/schema/scm_prepare_database.sh mysql -h myhost1.sf.cloudera.com -utemp -ptemp --scm-host myhost2.sf.cloudera.com scm scm scm ``` ## 3.3 修改 /opt/cm-5.13.3/etc/cloudera-scm-agent/config.ini ``` server_host=master-heming ``` <br/> ## 3.4 将parcel文件放到/opt/cloudera/parcel-repo文件夹下 <center> ![parcel](https://leanote.com/api/file/getImage?fileId=5d8ac56cab64415547000353) </center> ``` cp CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel.sha1 CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel.sha ``` CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel.sha1 替换为 CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel.sha --- **tips:** 建议manifest.json 和 CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel.sha1采用wget下载,windows会有编码方式问题 --- ## 3.4 slave节点 ``` scp -r /opt/cm-5.13.3 root@slave01:/opt/ scp -r /opt/cm-5.13.3 root@slave01:/opt/ ``` ## 3.5 在所有节点创建cloudera-scm用户 ``` useradd --system --home=/opt/cm-5.13.3/run/cloudera-scmserver/ --no-create-home --shell=/bin/false --comment "Cloudera SCM-User" cloudera-scm userdel cloudera-scm #删除用户(备用) cat /etc/passwd #查看用户列表 ``` > 建立相关文件夹(optional): ``` mkdir /var/log/cloudera-scm-server chown cloudera-scm.cloudera-scm /var/log/cloudera-scm-server mkdir -p /opt/cloudera/parcel-repo sudo chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcel-repo/* mkdir /var/lib/cloudera-scm-server sha1sum CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel | awk '{ print $1 }' > CDH-6.0.0-1.cdh6.0.0.p0.339140-el7.parcel.sha ``` ## 3.6 所有节点安装psmisc ``` yum install psmisc -y ``` # 4.启动 > master ``` /opt/cm-5.13.3/etc/init.d/cloudera-scm-server start #最好等server完全启动完成再启动agent,about two min. /opt/cm-5.13.3/etc/init.d/cloudera-scm-agent start ``` >slave01-02 ``` /opt/cm-5.13.3/etc/init.d/cloudera-scm-agent start ``` --- **check cloudera-scm-server and cloudera-scm-agent status:** > 1.logs check ``` /opt/cm-5.13.3/log/cloudera-scm-server/cloudera-scm-server.log /opt/cm-5.13.3/log/cloudera-scm-agent/cloudera-scm-agent.log ``` > 2.status `agent` ``` ps -ef|grep cloudera-scm-agent #存在两个进程:cmf-agent and cmf-listener ``` <center> ![agent两个进程](https://leanote.com/api/file/getImage?fileId=5dba5d9fab644158ca00022d) </center> `server` ``` ps -ef | grep cloudera-scm-server ``` <center> ![server](https://leanote.com/api/file/getImage?fileId=5dba5e2bab644158ca00022e) </center> --- #5. CM-web页面配置安装(master:7180) > master:7180登录页面(admin/admin) <center> ![admin](https://leanote.com/api/file/getImage?fileId=5d8ac6acab6441574b00037d) </center> > node节点(`全选`) <center> ![node](https://leanote.com/api/file/getImage?fileId=5d8ac6acab6441574b00037c) </center> >parcel(如果parcel文件放的位置没有问题,会有下载的对应版本选项) <center> ![parcel](https://leanote.com/api/file/getImage?fileId=5d8ac6ceab64415547000361) </center> > 安装完成(放的parcel文件没问题,下载瞬间100%) <center> ![安装完成](https://leanote.com/api/file/getImage?fileId=5d8ac6edab64415547000362) </center> > 各组件版本 <center> ![版本](https://leanote.com/api/file/getImage?fileId=5d8aca2aab64415547000390) </center> > hadoop组件选择 <center> ![hadoop安装](https://leanote.com/api/file/getImage?fileId=5d8acd29ab644155470003b9) </center> > 各server组件分布 <center> ![各node分布](https://leanote.com/api/file/getImage?fileId=5d8acd3fab6441574b0003e3) </center> >hive/oozie指定数据库(须手动创建数据库名) <center> ![mysql数据库,须创建指定数据库](https://leanote.com/api/file/getImage?fileId=5d8acd5bab6441574b0003e4) </center> ``` #创建用户 mysql> create user 'hive' identified by 'hive123'; mysql> create user 'hive'@'localhost' identified by 'hive123'; mysql> create user 'hive'@'master-heming' identified by 'hive123'; mysql> create user 'hive'@'%' identified by 'hive123'; #step ok #授权 mysql> grant all on *.* to hive@'%' identified by 'hive123'; mysql> grant all privileges on *.* to 'hive'@'%'identified by 'hive123' with grant option; #step ok mysql> flush privileges; #查看用户 mysql> select Host,User,Password from mysql.user; #删除用户 mysql> use mysql; mysql> delete from user where User='hive'; ``` >首次运行 <center> ![首次运行](https://leanote.com/api/file/getImage?fileId=5d8acd7aab6441574b0003e6) </center> > 运行截图 <center> ![运行截图](https://leanote.com/api/file/getImage?fileId=5d8adb4aab6441574b0004e1) </center> > Namenode HA高可用配置 <center> ![配置入口](https://leanote.com/api/file/getImage?fileId=5dbb9b5fab644141d50001ec) </center> **设置journalnode的目录:** <center> ![start](https://leanote.com/api/file/getImage?fileId=5dbb9c7bab644143d10001f7) </center> **忽略此步的错误:** <center> ![忽略此步](https://leanote.com/api/file/getImage?fileId=5dbb9df0ab644143d10001ff) </center> <center> ![NN](https://leanote.com/api/file/getImage?fileId=5dbba0afab644143d100021c) </center> #6.tips 多次安装时(try 多次失败),注意hadoop安装目录,必要时清空安装目录 ``` /dfs/dn /dfs/snn /data/dfs/nn /ssd/dfs/nn /usr/hive/warehouse /var/lib/cloudera-host-monitor /var/lib/cloudera-service-monitor /yarn/nm /hbase ``` # 7.issues ## 7.1 `agent` ERROR Failed to connect to newly launched supervisor. Agent will exit >描述 <center> ![logs](https://leanote.com/api/file/getImage?fileId=5dba7dacab64415ac8000256) </center> >解决方法 ``` netstat -tupnl | grep 19001 kill -9 xx # wait a min. restart the client ``` ## 7.2 uninstall cloudera ``` rm -rf /var/run/cloudera-scm-agent rm -rf /usr/share/cmf /var/lib/cloudera* /var/log/cloudera* /var/run/cloudera* /etc/cloudera* rm -rf /var/lib/hadoop-* /var/lib/impala /var/lib/solr /var/lib/zookeeper /var/lib/hue /var/lib/oozie /var/lib/pgsql /var/lib/sqoop2 /data/dfs/ /data/impala/ /data/yarn/ /dfs/ /impala/ /yarn/ /var/run/hadoop-*/ /var/run/hdfs-*/ /usr/bin/hadoop* /usr/bin/zookeeper* /usr/bin/hbase* /usr/bin/hive* /usr/bin/hdfs /usr/bin/mapred /usr/bin/yarn /usr/bin/sqoop* /usr/bin/oozie /etc/hadoop* /etc/zookeeper* /etc/hive* /etc/hue /etc/impala /etc/sqoop* /etc/oozie /etc/hbase* /etc/hcatalog rm -rf /opt/cloudera/parcel-cache /opt/cloudera/parcels ``` ## 7.3 离线安装时识别不了/opt/cloudera/parcel-repo文件 --- **tips:** 常见问题,主要原因是hash校验不通过,check下载时是否下载全 --- manifest.json包含了下载版本的hash值,需要校验 CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel.sha 记录 sha1sum CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel ``` sha1sum CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel #此值应与CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel.sha 记录的相等 cat manifest.json | grep `sha1sum CDH-5.7.0-1.cdh5.7.0.p0.45-el7.parcel` #此值还应包含在manifest.json中 ``` <center> ![demo](https://leanote.com/api/file/getImage?fileId=5dba936eab644158ca0003d3) </center>
上一篇:
[cryptdb]2017/07/12--Guidelines for Using the CryptDB System Securely
下一篇:
hive权限
0
赞
915 人读过
新浪微博
微信
腾讯微博
QQ空间
人人网
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus
文档导航