Linux从零开始学搭建大数据平台(2)
前言:比较懒,回头再分开章节,如果需要,ctrl+F 搜索吧
第二章:系统配置-java-mysql-rundeck-clouderamanager
1.网络配置:
禁用IPV6
# vim /etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.1.23.60
GATEWAY=10.1.2.2
NETMASK=255.255.0.0
DNS1=8.8.8.8
DNS2=8.8.4.4
# vim /etc/resolv.conf
#Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4
/etc/init.d/network restart
修改主机名:
# vim /etc/sysconfig/network
HOSTNAME=bigdata_platform
# hostname bigdata_platform
# vim /etc/hosts
#127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
127.0.0.1 localhost bigdata_platform localhost4 localhost4.localdomain4
#bash
配置本地 hosts
# C盘 -- Windows -- System32 -- drivers -- etc -- hosts
10.1.23.60 bigdata_platform
设置用户最大可打开文件数,进程数,内存占用
# vim /etc/security/limits.conf
#* soft nofile 65536
#* hard nofile 65536
* soft nofile 409600
* hard nofile 409600
* soft nproc 409600
* hard nproc 409600
2.添加输入法
首先查看是否安装了中文语言支持组件
yum grouplist
3.配置 SSH 免密登录到 10.1.23.215 (root密码更新为: Abcd.1234)
10.1.23.60:
#ssh-keygen -t rsa -P ''
# chmod u+xid_rsa.pub
# scp id_rsa.pub 10.1.23.215:/root/.ssh/
10.1.23.215:
# cat id_rsa.pub >> .ssh/authorized_keys
4.修改 本机 语言显示
echo $LANG 查看当前语言
locale 查看是否有中文包
yum -y groupinstall chinese-support 没有的话安装
vim /etc/sysconfig/i18n
修改成 LANG="zh_CN.UTF-8"
解析:
1)请确认你的系统安装了中文语言包,Centos6.4在选择basic server的地方的最下面有个附加项,有个单选叫现在定制,进去里面选择语言包,全球语言都在,如果没有这样选,默认没有安装中文语言包,你再设置系统语言为UTF8还是GBK等都是没用的。。
2)确认安装了语言包,除了设置系统语言,还要设置环境变量,/etc/profile中的LANG.否则照样无效
3)linux在特殊模式下,比如救援模式,是不会加载语言包的,即使你安装了中文包(亲测)。
4)显示方框,一般是缺失语言包,因为乱码有两种,乱码和问号,乱码则是UTF8编码使用GBK解码的乱码,问号则是黑洞,意思是没有编码格式来显示这种字体,则系统默认将其编码为FFFFF,转换后也就是???。。。而在LINUX的命令行,?都给显示成了方框。。
http://www.cnblogs.com/CherishU/p/3400448.html
不过fbterm 的下载地址换了:
fbterm 参考网址:
http://www.cnblogs.com/CherishU/p/3400448.html
http://blog.csdn.net/flytreeleft/article/details/6679638
注意:fbterm 可以使电脑终端显示中文
其配置文件在: ~/.fbtemrc
字体目录在: /usr/share/fonts
然后 下载输入法的7Z格式解压包:
# wgethttps://jaist.dl.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2
5.关闭防火墙
(1)永久关闭SELinux(否则samba可能不能访问)
修改配置文件
# vi /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled
需要重启机器生效!!
(2)关闭防火墙
开启: chkconfig iptables on
关闭: chkconfig iptables off
6.安装 rz sz 命令
yum -y install lrzsz
7.上传jdk包 并解压
tar -zxf jdk-7u67-linux-x64.gz -C /opt/modules/
删除linux 自带openjdk
rpm -qa | grep java
rpm -e --nodeps java-1.7.0-openjdk-1.7.0.65-2.5.1.2.el6_5.x86_64
修改 /etc/profile
####################----BASIC------####################
#java jdk1.7.0_67
export JAVA_HOME=/opt/modules/jdk1.7.0_67
export JAVA_BIN=$JAVA_HOME/bin
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export CLASSPATH=.:$JAVA_HOME/lib/mysql-connector-java-5.1.26-bin.jar
export PATH=$PATH:$JAVA_HOME/bin
#export JAVA_LIBRARY_PATH=/opt/cloudera/parcels/CDH/lib/hadoop/lib/native
将mysql-connector-java-5.1.26-bin.jar 上传到 $JAVA_HOME/lib/
chmod +x mysql-connector-java-5.1.26-bin.jar
8.安装mysql
按照mysql安装教程走,完成操作
9.安装rundeck
1)调整java版本
考虑到需要Java8 支持,所以重新安装java8
上传jdk包 并解压
tar -zxf jdk-8u144-linux-x64.tar.gz -C /opt/modules/
2)准备rundeck目录及映射
mkdir /opt/modules/rundeck-2.9.3
vim /etc/profile
####################-----Rundeck-----######################
#RunDeck
export RDECK_BASE=/opt/modules/rundeck-2.9.3
3)安装和启动rundeck
cp rundeck-launcher-2.9.3.jar $RDECK_BASE
cd $RDECK_BASE
java -jar rundeck-launcher-2.9.3.jar
java -XX:MaxPermSize=256m -Xmx1024m -jar rundeck-launcher-2.9.3.jar
等待直到显示:类似
2017-09-28 18:23:37.711:INFO:oejs.ServerConnector:main: Started ServerConnector@4ad53dc3{HTTP/1.1}{0.0.0.0:4440}
表示启动成功,但是,这命令一直占着一个窗口,很烦,我就ctrl+c了。此时端口又失效了
不过,我们可以去rundeck的配置文件中启动即可
启动
$RDECK_BASE/server/sbin/rundeckd start
停止
$RDECK_BASE/server/sbin/rundeckd stop
更新shell环境:(这两个不太清楚处理在哪里运行,我放到/etc/profile里,也在环境中运行了)
PATH=$PATH:$RDECK_BASE/tools/bin
MANPATH=$MANPATH:$RDECK_BASE/docs/man
4)配置mysql数据库
mysql -uroot -p
Abcd1234
>>create database rundeck;
>>grant ALL on rundeck.* to 'rundeckadmin'@'%' identified by 'Abcd1234';
>>flush privileges;
>>revoke all on rundeck.* from 'rundeckadmin'@'%'; -此为回收权限
我们rundeck继续
10.修改rundeck配置文件
# vim /opt/modules/rundeck-2.9.3/server/config/rundeck-config.properties
1)配置mysql存储位置
包括:mysql库位置,执行用户名及密码
dataSource.url = jdbc:mysql://10.1.23.60:3306/rundeck?autoReconnect=true
dataSource.username = rundeckadmin
dataSource.password = Abcd1234
#dataSource.url = jdbc:h2:file:/opt/modules/rundeck-2.9.3/server/data/grailsdb;MVCC=true
添加JDBC连接包-检查是否有mysql链接包
# cd /opt/modules/rundeck-2.9.3/server/exp/webapp/WEB-INF/lib
# ll | grep "mysql"
2)配置邮件发送
包括:线程数,邮箱地址,端口,发件人,密码
quartz.props.threadPool.threadCount=50
grails.mail.host=smtp.staff.hexun.com #邮箱服务器
grails.mail.port=25
grails.mail.username=bigdata@staff.hexun.com
grails.mail.password=G#f92bqZhd
grails.mail.props=["mail.smtp.starttls.enable":"true","mail.smtp.port":"25"]#设置smtp的身份认证
grails.mail.default.from=bigdata@staff.hexun.com
feature.incubator.parallelWorkflowStrategy=true
3)配置登录用户
# vim /opt/modules/rundeck-2.9.3/server/config/realm.properties
#admin:[re343*q4d,user,admin,architect,deploy,build
#furenjie:QAZ!wsx@123,user,admin
admin:admin,user,admin
user:user,user
dp:dp,user,admin
4)增加 projects 并配置节点 默认是空的
cd /opt/modules/rundeck-2.9.3/projects/
5)使用rundeck 具体操作见其他手册 - 略
11.配置 Cloudera manager
参考网址:http://www.cnblogs.com/zhangyin6985/p/7357738.html
我们为了追求最先进的功能,我们选择最新版 5.12.0
-----------------------------------------------------------------------------------------------------------------------
需要支持:(这个是CentOS7的版本)
CM版本:cloudera-manager-centos7-cm5.12.0_x86_64.tar.gz
CDH版本:5.12.0
CDH-5.12.1-1.cdh5.12.1.p0.3-el7.parcel
CDH-5.12.1-1.cdh5.12.1.p0.3-el7.parcel.sha1
manifest.json
JDK1.8:jdk-8u144-linux-x64.tar.gz(已配置)
JDBC驱动:mysql-connector-java-5.1.35.jar(已准备)
CM下载网址:
http://archive.cloudera.com/cm5/cm/5/cloudera-manager-centos7-cm5.12.0_x86_64.tar.gz
CDH下载网址:
http://archive.cloudera.com/cdh5/parcels/latest/CDH-5.12.1-1.cdh5.12.1.p0.3-el7.parcel
http://archive.cloudera.com/cdh5/parcels/latest/CDH-5.12.1-1.cdh5.12.1.p0.3-el7.parcel.sha1
http://archive.cloudera.com/cdh5/parcels/latest/manifest.json
cd /opt/softwares/
# wgethttp://archive.cloudera.com/cm5/cm/5/cloudera-manager-centos7-cm5.12.0_x86_64.tar.gz
# wgethttp://archive.cloudera.com/cdh5/parcels/latest/CDH-5.12.1-1.cdh5.12.1.p0.3-el7.parcel
# wgethttp://archive.cloudera.com/cdh5/parcels/latest/CDH-5.12.1-1.cdh5.12.1.p0.3-el7.parcel.sha1
# wgethttp://archive.cloudera.com/cdh5/parcels/latest/manifest.json
------------------------------------------------------------------------------------------------
以上为版本选错了。
推荐安装网址:http://www.mamicode.com/info-detail-1980118.html
需要支持:
CM版本:cloudera-manager-el6-cm5.12.0_x86_64.tar.gz
CDH版本:5.12.0
CDH-5.12.0-1.cdh5.12.0.p0.29-el6.parcel
CDH-5.12.0-1.cdh5.12.0.p0.29-el6.parcel.sha1
manifest.json
JDK1.8:jdk-8u144-linux-x64.tar.gz(已配置)
JDBC驱动:mysql-connector-java-5.1.40-bin.jar(已准备)
CM下载网址:
http://archive.cloudera.com/cm5/cm/5/cloudera-manager-el6-cm5.12.0_x86_64.tar.gz
CDH下载网址:http://archive.cloudera.com/cdh5/parcels/latest/= 最新版
http://archive.cloudera.com/cdh5/parcels/5.12.0/CDH-5.12.0-1.cdh5.12.0.p0.29-el6.parcel
http://archive.cloudera.com/cdh5/parcels/5.12.0/CDH-5.12.0-1.cdh5.12.0.p0.29-el6.parcel.sha1
http://archive.cloudera.com/cdh5/parcels/5.12.0/manifest.json
# cd /opt/softwares/
# wgethttp://archive.cloudera.com/cm5/cm/5/cloudera-manager-el6-cm5.12.0_x86_64.tar.gz
# wgethttp://archive.cloudera.com/cdh5/parcels/5.12.0/CDH-5.12.0-1.cdh5.12.0.p0.29-el6.parcel
# wgethttp://archive.cloudera.com/cdh5/parcels/5.12.0/CDH-5.12.0-1.cdh5.12.0.p0.29-el6.parcel.sha1
# wgethttp://archive.cloudera.com/cdh5/parcels/5.12.0/manifest.json
以下操作均为管理员权限:
11.0 网络和主机名配置 (已配置,见1)
11.1 配置 SSH (已生成秘钥,见3)
# cd /root/.ssh/
# cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys
通过scp命令将认证文件拷贝到所有其他节点。(配置集群时)
11.2 安装java-jdk (已配置,见7)
CentOS自带OpenJdk,不过运行CDH5需要使用oracle的JDK。
11.3 安装配置 mysql(已配置,见8)
11.4 关闭防火墙和SELinux(已配置,见5)
所有节点都要求
11.5 所有节点配置NTP服务(待完成)
集群中所有主机必须保持时间同步,如果时间相差较大会引起各种问题。
所有节点安装相关组件:
# yum -y install ntp
完成后,配置开机启动:
# chkconfig ntpd on
以列表形式检查
#chkconfig --list ntpd
开启服务:
# service ntpd start
# ntpstat
检查是否成功,用ntpstat命令查看同步状态,出现以下状态代表启动成功:
unsynchronised
time server re-starting
polling server every 8 s
(or)
unsynchronised
polling server every 64 s
11.6正式安装
解压安装 (所有节点)
# tar -zxf cloudera-manager-el6-cm5.12.0_x86_64.tar.gz -C /opt/
创建cloudera-scm用户(所有节点)
# useradd --system --home=/opt/cm-5.12.0/run/cloudera-scm-server/ --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
修改 cloudera-scm 的用户所属组,增加新的次要组 root
# usermod -a -G root cloudera-scm
调整用户权限
# echo USER=\"cloudera-scm\" >> /etc/default/cloudera-scm-agent
# echo "Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin" >> /etc/sudoers
为Cloudera Manager 5建立数据库 并初始化(主节点)
先将JDBC驱动 mysql-connector-java-*.jar,放到/opt/cm-5.12.0/share/cmf/lib/中
# cp /opt/softwares/mysql-connector-java-5.1.40-bin.jar /opt/cm-5.12.0/share/cmf/lib/
注意: mysql-connector-java-5.1.40-bin.jar 后面的bin.jar,别下载错了。【犯过错】
注意修改属主chown -R
初始化,生成cm数据库
#/opt/cm-5.12.0/share/cmf/schema/scm_prepare_database.sh mysql cm -hlocalhost -uroot -pAbcd1234 --scm-host localhost scm scm scm
修改agent配置文件(所有节点)
修改/opt/cm-5.12.0/etc/cloudera-scm-agent/config.ini 中的参数
# vim /opt/cm-5.12.0/etc/cloudera-scm-agent/config.ini
server_host 为主节点的主机名 =bigdata_platform
parcel_dir 为parcel路径 =/opt/cloudera/parcels
准备Parcels,用以安装CDH5
# mkdir -p/opt/cloudera/parcels
将CHD5相关的Parcel包放到主节点的/opt/cloudera/parcel-repo/目录中
# cp /opt/softwares/cdh-5.12/CDH-5.12.0-1.cdh5.12.0.p0.29-el6.parcel /opt/cloudera/parcel-repo/
# cp /opt/softwares/cdh-5.12/CDH-5.12.0-1.cdh5.12.0.p0.29-el6.parcel.sha1 /opt/cloudera/parcel-repo/
# cp /opt/softwares/cdh-5.12/manifest.json /opt/cloudera/parcel-repo/
重命名 CDH-5.12.0-1.cdh5.12.0.p0.29-el6.parcel.sha1 为 ***.sha
# mv /opt/cloudera/parcel-repo/CDH-5.12.0-1.cdh5.12.0.p0.29-el6.parcel.sha1 /opt/cloudera/parcel-repo/CDH-5.12.0-1.cdh5.12.0.p0.29-el6.parcel.sha
修改属主
# mkdir /opt/cm-5.12.0/run/cloudera-scm-agent
# chown -R cloudera-scm:cloudera-scm/opt/cloudera/
# chown -R cloudera-scm:cloudera-scm/opt/cm-5.12.0/
分发给其他节点
scp -r -p /opt/cm-5.7.0/ 10.130.2.22:/opt/
11.7大体准备工作已经做完,准备开始启动环境:
先启动server
# /opt/cm-5.12.0/etc/init.d/cloudera-scm-server start
查看启动情况
# tail -f /opt/cm-5.12.0/log/cloudera-scm-server/cloudera-scm-server.log
在所有主机上启动cm agent
# /opt/cm-5.12.0/etc/init.d/cloudera-scm-agent start
查看启动情况
# tail -f /opt/cm-5.12.0/log/cloudera-scm-agent/cloudera-scm-agent.out
----------------------------------------------------------------------------------------------------------------
然后报错:Starting cloudera-scm-agent: [FAILED]
解决办法:
查看 log日志
# cd /opt/cm-5.12.0/log/cloudera-scm-agent/
# cat cloudera-scm-agent.out
/usr/bin/env: python2.7: No such file or directory
/usr/bin/env: python2.7: No such file or directory
安装python环境
# yum -y install python
再运行,还是不行
我们需要升级centos6.6 的Python环境,因为默认是python2.6.6
具体方法见python 的python2.7升级脚本
查看 cloudera-scm-server log日志
# cd /opt/cm-5.12.0/log/cloudera-scm-server/
# cat cloudera-scm-server.out
报错:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
解决办法:
使用jdk8的时候。字面意思是MaxPermSize不需要我们配置了,所以我就按照它的方法把default VM arguments中MaxPermSize参数给删掉就不会出现上面的提示了。
仍然有许多问题未解决
所以,我准备重新做:初步原因一、版本不同出问题
路径修改为 /opt/
删除Cloudera manager
参考网址http://www.cnblogs.com/chenfool/p/3738540.html
查看路径:
1.# /usr/share/cmf
2.# /var/lib/cloudera*
3.# /var/run/cloudera*
4.# /var/cache/yum/x86_64/6/cloudera*
5.# /var/log/cloudera*
6.卸载cloudera的rpm包
# rpm -qa | grep cloudera
# for f in `rpm -qa | grep cloudera ` ; do rpm -e ${f} ; done
----------------------------------------------------------------------------------------------------------------------------
设置 Web 服务器
4.查看 httpd 服务和启动状况,如果发现没有安装 httpd 服务,请先安装 sudo yum -y install httpd
[enmoedu@bigdata_platform softwares]$ rpm -qa | grep httpd
httpd-2.2.15-59.el6.centos.x86_64
httpd-tools-2.2.15-59.el6.centos.x86_64
[root@bigdata_platform softwares]# service httpd status
httpd is stopped
[root@bigdata_platform softwares]# service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.80.145 for ServerName [ OK ]
[root@bigdata_platform softwares]# service httpd status
httpd (pid 3002) is running...
安装CDH依赖
# yum -y install chkconfig python bind-utils psmisc libxslt zlib sqlite cyrus-sasl-plain cyrus-sasl-gssapi fuse portmap fuse-libs redhat-lsb
----------------------------------------------------------------------------------------------------------------------------
问题1:
service cloudera-scm-server status
cloudera-scm-server dead but pid file exists
解决1
# rm/opt/cm-5.12.0/run/cloudera-scm-server.pid
#/opt/cm-5.12.0/etc/init.d/cloudera-scm-serverrestart
问题2:
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]
解决2
# mkdir /var/lib/cloudera-scm-server
# chown -R cloudera-scm.cloudera-scm /var/lib/cloudera-scm-server
问题3:在CDH检查主机哪里会有两个警告
解决3:
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo 10 > /proc/sys/vm/swappiness
---------------------------------------------------------------------------------------------------------------------------