最近发现,公司的的大数据环境,空间有不足的情况,集群的计算能力也下降, 此时需要对将大数据的集群环境进行扩容 增加计算节点。
集群示意图:
配置hadoop账号,ssh免密,关掉防火墙,磁盘挂载
useradd hadoop
su hadoop
ssh-keygen -t rsa
#复制到所有datanode,并测试ssh登陆
cp id_rsa.pub authorized_key
把原先的/usr/local/hadoop复制到/home/hadoop下,并修改配置文件中hadoop_home相关的地址。
修改dfs.name.dir,dfs.data.dir,mapred.system.dir,mapred.local.dir等相关目录的权限。
chown -R hadoop:hadoop [dir]
hadoop dfs -chown -R hadoop:hadoop /
root用户执行命令,安装chrony:
yum install -y chrony*
echo "server 192.168.4.11 iburst" >> /etc/chrony.conf
启动chrony.service
/bin/systemctl restart chronyd.service
/bin/systemctl enable chronyd.service
chronyc sources -v
hwclock --localtime -w
关闭firewalld iptables 和禁用selinux,关闭iptables
systemctl stop firewalld.service
systemctl disable firewalld.service
firewall-cmd --state
关闭iptables
iptables -F
systemctl stop iptables.service
service iptables save
禁用 selinux
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0
getenforce 0
sestatus
重启机器
reboot
修改文件系统的最大连接数,以root用户执行:
vim /etc/security/limits.conf
* soft nofile 32728
* hard nofile 1029345
* soft nproc unlimited
* hard nproc unlimited
* soft memlock unlimited
* hard memlock unlimited
配置新增节点服务器的无密钥认证登录,做root用户无密钥认证
ssh-keygen ---一直敲回车到最后
cat id_rsa.pub >> authorized_keys
将所有节点的公钥导入authorized_keys 分发到 所有的 机器的.ssh/ 下面
chmod 600 .ssh/authorized_keys
然后进行无密钥登录认证测试!
yum -y install chkconfig python bind-utils psmisc libxslt zlib sqlite cyrus-sasl-plain cyrus-sasl-gssapi fuse fuse-libs redhat-lsb
创建CM 的安装目录,root 用户执行命名:
mkdir /opt/cloudera-manager
wget http://archive.cloudera.com/cm5/cm/5/cloudera-manager-centos7-cm5.12.0_x86_64.tar.gz
解压CM包到/opt/cloudera-manager,以root用户执行命令:
tar -zxvf cloudera-manager-centos7-cm5.12.0_x86_64.tar.gz -C /opt/cloudera-manager
以root用户执行命令:
cd /opt/cloudera-manager/cm-5.12.0/etc/cloudera-scm-agent
vim config.ini
server_host=NN01.sge.com.cn
useradd --system --home=/opt/cloudera-manager/cm-5.12.0/run/cloudera-scm-server --no-create-home --shell=/bin/false --comment "Cloudera SCM User" cloudera-scm
vim /etc/sudoers
在root 权限下面 增加 一行:
cloudera-scm ALL=(ALL) ALL
以root用户执行下面的命令:
mkdir -p /opt/cloudera/parcels
chown -R cloudera-scm:cloudera-scm /opt/cloudera/parcels/
新建目录:
mkdir -p /var/lib/cloudera-scm-server
mkdir -p /var/lib/cloudera-scm-agent
chown -R cloudera-scm:cloudera-scm /var/lib/cloudera-scm-server/
chown -R cloudera-scm:cloudera-scm /var/lib/cloudera-scm-agent/
启动CM-server的agent 端
cd /opt/cloudera-manager/cm-5.12.0/etc/init.d
./cloudera-scm-agent start
以root 用户执行命令
echo "10" > /proc/sys/vm/swappiness
echo never > /sys/kernel/mm/transparent_hugepage/defrag
echo never > /sys/kernel/mm/transparent_hugepage/enabled
vim /etc/rc.local
ps -ef | grep supervisord | xargs kill -9
sudo service cloudera-scm-agent restart
登陆cm(如:http://192.168.16.32:8010/pages/viewpage.action?pageId=16094086)
在Cluster1中选择“添加服务”
在“添加服务至Cluster1”,选择服务类型:
自定义角色分配
添加节点完成
[DNS6@fleapx ~]$ hadoop fs -ls /
[DNS6@fleapx ~]$ hbase shell
[DNS6@fleapx ~]$ hive
[DNS6@fleapx ~]$ hadoop jar /opt/cloudera/parcels/CDH/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar pi 5 5
友情链接:https://blog.51cto.com/flyfish225/2118098