linux hadoop修改主机名

来源:互联网 发布:淘宝网运费设置模板 编辑:程序博客网 时间:2024/05/14 04:41

硬件环境
共有3台机器,虚拟机里面使用桥接模式,直接获得真实IP地址,IP配置如下:
master:192.168.1.108
slave1:192.168.1.109
slave2:192.168.1.110

这里有一点需要强调的就是,务必要确保每台机器的主机名和IP地址之间能正确解析

一个很简单的测试办法就是ping一下主机名,比如在master上pingslave1,如果能ping通就OK!若不能正确解析,可以修改/etc/hosts文件,如果该台机器作Namenode用,则需要在hosts文件中加上集群中所有机器的IP地址及其对应的主机名;如果该台机器作Datanode用,则只需要在hosts文件中加上本机IP地址和Namenode机器的IP地址。

#192.168.1.108#

sudo vi /etc/hostname

master

#192.168.1.109#

sudo vi /etc/hostname

slave1

#192.168.1.110#

sudo vi /etc/hostname

slave2



以本文为例,master中的/etc/hosts文件看起来就应该是这样的:
127.0.0.0         localhost     localhost
192.168.1.108    master      master
192.168.1.109   slave1       slave1
192.168.1.110     slave12      slave2

slave1中的/etc/hosts文件看起来就应该是这样的:
127.0.0.0         localhost     localhost
192.168.1.108     master       master
192.168.1.109    slave1        slave1

slave2中的/etc/hosts文件看起来就应该是这样的:
127.0.0.0         localhost     localhost
192.168.1.108     master       master
192.168.1.110    slave2       slave2

原创粉丝点击