配置静态IP
- 修改
/etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
....
ONBOOT=yes
IPADDR=192.168.0.116
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
DNS1=192.168.0.1
DNS2=8.8.8.8
NM_CONTROLLED=no
- 重启网络:
systemctl restart network
关闭防火墙
systemctl status firewalld.service 查看firewall状态
systemctl stop firewalld.service 停⽌止firewall
systemctl disable firewalld.service 禁⽌止firewall开机启动
修改主机名
- 永久修改立即生效:
hostnamectl set-hostname os1
- 添加hosts映射:
vi /etc/hosts
192.168.0.116 os1
- 修改网络配置文件:
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=os1
- 重启网络:
systemctl restart network
ping os1
配置免密
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh-copy-id -i ~/.ssh/id_dsa.pub {IP}
安装同步工具rsync
yum install -y rsync
#!/bin/bash
#1 获取命令输入参数的个数,如果个数为0,直接退出命令
paramnum=$#
if((paramnum==0)); then
echo no params;
exit;
fi
#2 根据传入参数获取文件名称
p1=$1
file_name=`basename $p1`
echo fname=$file_name
#3 获取输入参数的绝对路径
pdir=`cd -P $(dirname $p1); pwd`
echo pdir=$pdir
#4 获取用户名称
user=`whoami`
#5 循环执行rsync
_n=`os`
for((host=2; host<4; host++)); do
echo ------------------- $_n$host --------------
rsync -rvl $pdir/$file_name $user@$_n$host:$pdir
done
java环境
tar -zxvf jdk-8u231-linux-x64.tar.gz -C ../services/
#java
export JAVA_HOME=/opt/servers/jdk1.8
export PATH=:$JAVA_HOME/bin:$PATH
hadoop
##HADOOP_HOME
export HADOOP_HOME=/opt/servers/hadoop-2.9.2
export PATH=$PATH:$HADOOP_HOME/bin
export PATH=$PATH:$HADOOP_HOME/sbin
网友评论