Hadoop之Linux修改虚拟本机地址
Hadoop是运行在Linux系统下的,但我们在windows下Eclipse远程访问Hadoop HDFS时,如果两个机子地址不在同一网段便无法相互访问。
windows测试是否可远程连接,只需Dos 执行ping即可。
为了统一网段,势必要对虚拟机设置网络地址:
1.root账户登录,修改interfaces
hadoop@HADOOP:~$ su root Password: root@HADOOP:/home/hadoop# vi /etc/network/interfaces
文件修改参考如下(按主机网段修改):
address 192.168.3.137 gateway 192.168.3.1 netmask 255.255.255.0
2.修改hosts
root@HADOOP:/home/hadoop# vi /etc/hosts
文件修改参考如下(按主机网段修改):
127.0.0.1 localhost 127.0.1.1 ubuntu 192.168.3.137 HADOOP.MAIN 192.168.1.135 HADOOP.SLAVE 192.168.1.136 HADOOP.SLAVE2 # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
3.ifconfig查看配置信息是否正确
hadoop@HADOOP:~$ ifconfig eth0 Link encap:Ethernet HWaddr 00:0c:29:42:d4:51 inet addr:192.168.3.137 Bcast:192.168.3.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:fe42:d451/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:29 errors:0 dropped:0 overruns:0 frame:0 TX packets:73 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:2531 (2.5 KB) TX bytes:12238 (12.2 KB) Interrupt:19 Base address:0x2024 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:24 errors:0 dropped:0 overruns:0 frame:0 TX packets:24 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1884 (1.8 KB) TX bytes:1884 (1.8 KB)
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。