linux cdh&k84 基本环境配置

一、基础环境

1.1 服务器 准备

系统类型 ip地址 CPU Memory 节点角色
centos7 192.168.111.100 1g 30G master
centos7 192.168.111.101 1g 30G worker
centos7 192.168.111.102 1g 30G worker

1.2 ip&主机名

ip查看

切换为 root用户 密码 hecore

      安装基础组件

  centos7 centos6
ip查看 ip addr ifconfig
yum yum配置阿里云  
wget yum install wget | yum -y install wget  
vim yum install vim  
     
     
     
1、打开centos的yum文件夹

输入命令
cd /etc/yum.repos.d/

2、用wget下载repo文件

输入命令
wget http://mirrors.aliyun.com/repo/Centos-7.repo

如果wget命令不生效,说明还没有安装wget工具,输入yum -y install wget 回车进行安装。

当前目录是/etc/yum.repos.d/,刚刚下载的Centos-7.repo也在这个目录上


3、备份系统原来的repo文件

mv CentOS-Base.repo CentOs-Base.repo.bak

即是重命名 CentOs-Base.repo -> CentOs-Base.repo.bak


4、替换系统原理的repo文件

mv Centos-7.repo CentOs-Base.repo

即是重命名 Centos-7.repo -> CentOs-Base.repo


5、执行yum源更新命令

yum clean all

yum makecache

yum update

1.3 静态ip设置

动态ip用于ssh

      如下:

 cd /etc/sysconfig/network-scripts
[root@localhost network-scripts]# vim ./ifcfg-ens33 

iiiTYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
#dhcp 动态配置     static静态配置
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=549aec0d-042b-4529-9c6a-d5a4349cce98
DEVICE=ens33
ONBOOT=yes    

nat 静态ip

iiiTYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
#BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=549aec0d-042b-4529-9c6a-d5a4349cce98
DEVICE=ens33
#ONBOOT=yes
#static assignment
NM_CONTROLLED=no #表示该接口将通过该配置文件进行设置,而不是通过网络管理器进行管理
ONBOOT=yes #开机启动
BOOTPROTO=static #静态IP
IPADDR=192.168.111.100 #本机地址
NETMASK=255.255.255.0 #子网掩码
GATEWAY=192.168.23.2 #nat网关
DNS1=8.8.8.8 #DNS1

ip生效

       执行:service network restart

1.3 主机名设置

version centos6 centos7
临时 hostname xx hostname xx
永久1   hostnamectl set-hostname NMServer-7.test.com
永久2 vi /etc/sysconfig/network vim /etc/hosts 更改HOSTNAME=whsir vi /etc/hostname

1.4 主机名与ip绑定

增加 /etc/hosts文件中

[root@slave01 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.111.100 master
192.168.111.101 salve01
192.168.111.102 salve02

1.5 防火墙

centos7

操作 命令
查看防火墙状态 firewall-cmd --state
停止firewall systemctl stop firewalld.service
禁止firewall开机启动 systemctl disable firewalld.service

centos6!

扫描二维码关注公众号,回复: 8973065 查看本文章
services iptables status|start|stop

  ①执行关闭防火墙命令:service iptables stop

验证:service iptables status

  ②执行关闭防火墙自动运行命令:chkconfig iptables off

  验证:chkconfig --list | grep iptables

1.6 时间同步

时间同步也是如此,利用大数据的互联网络传送标准时间信息,实现大数据系统内时间同步。

网络时间同步协议(NTP)是时间同步的技术基础。

rpm –qa | grep ntp  查看是否已经安装

yum install ntp

1)修改所有节点的/etc/ntp.conf

【命令】vi /etc/ntp.conf

【内容】

restrict 192.168.111.100 nomodify notrap nopeer noquery //当前节点IP地址

restrict 192.168.111.1 mask 255.255.255.0 nomodify notrap //集群所在网段的网关(Gateway),子网掩码(Genmask)

2)选择一个主节点,修改其/etc/ntp.conf

【命令】vi /etc/ntp.conf

【内容】在server部分添加一下部分,并注释掉server 0 ~ n

server 127.127.1.0

Fudge 127.127.1.0 stratum 10

3)主节点以外,继续修改/etc/ntp.conf

【命令】vi /etc/ntp.conf

【内容】在server部分添加如下语句,将server指向主节点。

server 192.168.111.100

Fudge 192.168.111.1 stratum 10

1.7 免密配置

多个机器都得互相配置

[root@spark01 etc]# ssh-keygen
[root@spark01 etc]# cd ~/.ssh
[root@spark01 .ssh]# ls
id_rsa  id_rsa.pub
[root@spark01 .ssh]# ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]
发布了49 篇原创文章 · 获赞 8 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_24935049/article/details/97272333
今日推荐