Hadoop伪分布式安装
1.安装centos
30G空间
/boot 300M
swap 2048
/ Fill
2.修改IP地址
vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
DEVICE=eno16777736
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.121.150
GATEWAY=192.168.121.2
NETMASK=255.255.255.0
DNS1=8.8.8.8
DNS2=114.114.114.114
systemctl restart network
ping www.baidu.com
ping 本机ip
3.修改主机映射
hostnamectl set-hostname single
vi /etc/sysconfig/network
HOSTNAME=single
reboot
4.修改IP映射
vi /etc/hosts
#添加 ip 名字
192.168.121.150 single
5.查看防火墙和selinux,确认关闭
systemctl status firewalld
#输出如下
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
sestatus
#输入如下
SELinux status: disabled
6.密钥
ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
ssh-copy-id single
[root@single .ssh]# ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.121.150
The authenticity of host '192.168.121.150 (192.168.121.150)' can't be established.
ECDSA key fingerprint is 7e:62:21:88:c3:41:ba:83:44:54:a9:63:6e:93:8f:67.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
如果 是报的这个错:
Host key verification failed.
vi /etc/ssh/sshd_config
修改 PasswordAuthentication no
为 PasswordAuthentication yes
重启 sudo systemctl restart sshd
如果 是报的是 publickey,gssapi-keyex,gssapi-with-mic
passwd root 下
最近再给登陆的用户设置个密码,就解决了
7.上传文件到/export/software
tar -xzvf hadoop-2.7.4.tar.gz -C /export/servers
tar -xzvf jdk-8u301-linux-x64.tar.gz -C /export/servers
cd /export/servers
ln -s jdk1.8.0_301 jdk
ls -s hadoop-2.7.4 hadoop
8.配置环境变量
touch /etc/profile.d/hadoop_env.sh
vi /etc/profile.d/hadoop_env.sh
export JAVA_HOME=/export/servers/jdk
export HADOOP_HOME=/export/servers/hadoop
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
9.修改配置文件
9.1 hadoop-env.sh
vi /export/servers/hadoop/etc/hadoop/hadoop-env.sh
JAVA_HOME=/export/servers/jdk
9.2 修改core-site.xml
vi /export/servers/hadoop/etc/hadoop/core-site.xml
<!--指定HDFS中NameNode的地址-->
<property>
<name>fs.defaultFS</name>
<value>hdfs://single:9000</value>
</property>
<!--指定Hadoop运行时产生文件的存储目录-->
<property>
<name>hadoop.tmp.dir</name>
<value>/export/servers/hadoop/tmp</value>
</property>
9.3 修改hdfs-site.xml
vi /export/servers/hadoop/etc/hadoop/hdfs-site.xml
<!--指定HDFS中副本的数量-->
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
9.4 修改mapred-site.xml
cp /export/servers/hadoop/etc/hadoop/mapred-site.xml.template /export/servers/hadoop/etc/hadoop/mapred-site.xml
vi /export/servers/hadoop/etc/hadoop/mapred-site.xml
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
9.5 修改yarn-env.sh
yarn-env.sh用来保证YARN的守护进程ResourceManager和NodeManager,这个文件需要修改JAVA_HOME
vi /export/servers/hadoop/etc/hadoop/yarn-env.sh
#修改内容如下
export JAVA_HOME=/export/servers/jdk
9.6 修改yarn-site.xml
vi /export/servers/hadoop/etc/hadoop/yarn-site.xml
#配置内容如下
<configuration>
<!-- Reducer获取数据的方式 -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<!-- 指定YARN的ResourceManager的地址 -->
<property>
<name>yarn.resourcemanager.hostname</name>
<value>single</value>
</property>
</configuration>
10.开启集群
hdfs namenode -format
start-all.sh
#也可以使用
hadoop-daemon.sh start namenode
hadoop-daemon.sh start datanode
测试启动的进程
[root@single sbin]# jps
15264 NodeManager
14853 DataNode
15013 SecondaryNameNode
15670 Jps
14729 NameNode
15163 ResourceManager
11.访问网址
访问
http://single:50070/
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
文章由极客之音整理,本文链接:https://www.bmabk.com/index.php/post/140771.html