CDH集群安装配置(二)- 公共环境的配置和虚拟机的克隆

时间:2023-03-09 07:28:56
CDH集群安装配置(二)- 公共环境的配置和虚拟机的克隆

1. 配置网络-ip地址设置静态

vi /etc/sysconfig/network-scripts/ifcfg-eth33

增加如下配置

ONBOOT=yes
BOOTPROTO=static
IPADDR=10.224.86.101
GATEWAY=10.224.86.1
NETMASK=255.255.255.0
DNS1=128.128.128.128

重启网卡

systemctl restart network

查看是否可以联网

ping baidu.com

2. 修改IP和主机名称的映射

vim /etc/hosts添加以下代码

10.224.86.101   cdh1
10.224.86.102 cdh2
10.224.86.103 cdh3 source /etc/profile

3. 禁用IPV6

echo "alias net-pf-10 off" >> /etc/modprobe.d/dist.conf
echo "alias ipv6 off" >> /etc/modprobe.d/dist.conf

4. 增加普通用户

    命令:useradd hadoop(增加用户)
命令:passwd hadoop (修改用户密码)

5. 为新增用户sudo权限

   命令:vi /etc/sudoers
hadoop ALL=(root)NOPASSWD:ALL

6. 关闭防火墙

关闭: systemctl stop firewalld
开机禁用 : systemctl disable firewalld
启动: systemctl start firewalld
查看状态: systemctl status firewalld
开机启用 : systemctl enable firewalld

7.禁用Selinux

vi /etc/sysconfig/selinux
SELINUX=disabled

8.设置文件打开数量和用户最大进程数

vi /etc/security/limits.conf
增加以下内容:
* soft nofile
* hard nofile
* soft nproc
* hard nproc

9. yum源更换

9.1  更换163中国区的yum码

cd /etc/yum.repos.d

        yum install -y wget (下载资源命令)
rename .repo .repo.bak *
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
yum clean all
yum makecache
yum install lrzsz

9.2 添加cloudera-manager.repo源

cd /etc/yum.repos.d/
vi cloudera-manager.repo 添加以下内容后保存退出

[cloudera-manager]
# Packages for Cloudera Manager, Version 5, on RedHat or CentOS 6 x86_64
name=Cloudera Manager
baseurl=https://archive.cloudera.com/cm6/6.1.0/redhat7/yum/
gpgkey =https://archive.cloudera.com/cm6/6.1.0/redhat7/yum/RPM-GPG-KEY-cloudera
gpgcheck = 1


10. 卸载Centos自带的openjdk

java -version (查看现有版本)

rpm -qa | grep java(查看安装位置)
java-1.8.-openjdk-headless-1.8.0.101-.b13.el7_2.x86_64
tzdata-java-2016f-.el7.noarch
java-1.8.-openjdk-1.8.0.101-.b13.el7_2.x86_64
javapackages-tools-3.4.-.el7.noarch
java-1.7.-openjdk-headless-1.7.0.111-2.6.7.2.el7_2.x86_64
java-1.7.-openjdk-1.7.0.111-2.6.7.2.el7_2.x86_64
python-javapackages-3.4.-.el7.noarc rpm -e --nodeps 名字 (删除全部)
rpm -e --nodeps java-1.8.-openjdk-headless-1.8.0.101-.b13.el7_2.x86_64
rpm -e --nodeps java-1.8.-openjdk-1.8.0.101-.b13.el7_2.x86_64
rpm -e --nodeps java-1.7.-openjdk-headless-1.7.0.111-2.6.7.2.el7_2.x86_64
rpm -e --nodeps java-1.7.-openjdk-1.7.0.111-2.6.7.2.el7_2.x86_64

11 安装JDK

yum install oracle-j2sdk1.8
修改环境变量
vim /etc/profile
export JAVA_HOME=/usr/java/jdk1..0_141-cloudera
export PATH=$PATH:$JAVA_HOME/bin
root用户执行
echo "JAVA_HOME=/usr/java/jdk1.8.0_141-cloudera" >> /etc/environment

12.设置将 /proc/sys/vm/swappiness 设置为 0 (修改swap空间的swappiness,降低对硬盘的缓存 )

(root用户)输入:echo "vm.swappiness=0"  >> /etc/sysctl.conf )        

-----以上12步,设置好了公共资源的配置,下面克隆cdh2,cdh3

13. 克隆cdh1,配置网络

13.1 用虚拟机向导基于cdh1克隆出cdh2,cdh3.

13.2 修改主机名

vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=cdh2

13.3 修改网络

vi  /etc/sysconfig/network-scripts/ifcfg-ens33
删掉UUID HWADDR
配置静态地址 rm -rf  /etc/udev/rules.d/-persistent-net.rules
reboot