Hadoop2.6集群环境搭建(HDFS HA+YARN)原来4G内存也能任性一次。
准备工作:
1、笔记本4G内存 ,操作系统WIN7 (屌丝的配置)
2、工具VMware Workstation
3、虚拟机:CentOS6.4共四台
每台机器:内存512M,硬盘40G,网络适配器:NAT模式
选择高级,新生成虚机Mac地址(克隆虚拟机,Mac地址不会改变,每次最后手动重新生成)
编辑虚拟机网络:
点击NAT设置,查看虚机网关IP,并记住它,该IP在虚机的网络设置中非常重要。
NAT设置默认IP会自动生成,但是我们的集群中IP需要手动设置。
本机Win7 :VMnet8 网络设置
Ip |
hostname |
role |
192.168.249.130 |
SY-0130 |
ActiveNameNode |
192.168.249.131 |
SY-0131 |
StandByNameNode |
192.168.249.132 |
SY-0132 |
DataNode1 |
192.168.249.133 |
SY-0133 |
DataNode2 |
1、新建用户如:hadoop。不建议使用root用户搭建集群(root权限过大)
2、使得hadoop用户获得sudo权限。
[root@SY-0130 ~]# vi /etc/sudoers ## Allow root to run any commands anywhere root ALL=(ALL) ALL hadoop ALL=(ALL) ALL
3、查看当前虚机当前网络使用网卡设备
[root@SY-0130 hadoop]# ifconfig eth2 Link encap:Ethernet HWaddr 00:50:56:35:8E:E8 inet addr:192.168.249.130 Bcast:192.168.249.255 Mask:255.255.255.0 inet6 addr: fe80::250:56ff:fe35:8ee8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:877059 errors:0 dropped:0 overruns:0 frame:0 TX packets:597769 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:865720294 (825.6 MiB) TX bytes:324530557 (309.4 MiB) 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:1354 errors:0 dropped:0 overruns:0 frame:0 TX packets:1354 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:196675 (192.0 KiB) TX bytes:196675 (192.0 KiB)
[root@SY-0130 ~]# cat /proc/net/dev,当前网卡,我的为eth2
[root@SY-0130 ~]# cat /proc/net/dev Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo: 196675 1354 0 0 0 0 0 0 196675 1354 0 0 0 0 0 0 eth2:865576893 875205 0 0 0 0 0 0 324425517 596433 0 0 0 0 0 0
4、查看当前网卡对应的Mac地址
[root@SY-0130 ~]# cat /etc/udev/rules.d/70-persistent-net.rules # This file was automatically generated by the /lib/udev/write_net_rules # program, run by the persistent-net-generator.rules rules file. # # You can modify it, as long as you keep each rule on a single # line, and change only the value of the NAME= key. # PCI device 0x1022:0x2000 (vmxnet) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:b5:fd:bb", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1" # PCI device 0x1022:0x2000 (vmxnet) SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:35:8e:e8", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"
5、Network Configuration
[root@SY-0130 ~]# setup
选择eth2,进行设置,更改为当前网卡设备eth2,并且进行IP、网管、DNS设置。
DNS Server 与Win7的网络中的DNS Server一致,这样虚拟机也可以连接Internet网了,方便下载安装软件。
另外还有将防火墙关闭。
6、修改hostname
[root@SY-0130 ~]# vi /etc/sysconfig/network NETWORKING=yes HOSTNAME=SY-0130
7、修改hosts
[hadoop@SY-0130 ~]$ sudo vi /etc/hosts
#添加如下内容
192.168.249.130 SY-0130 192.168.249.131 SY-0131 192.168.249.132 SY-0132 192.168.249.133 SY-0133
8、重启虚机. reboot