标签:windows mirror 安装jdk exp app 输入密码 form 完全分布式 集群部署
超详细从零记录Ubuntu16.04.1 3台服务器上Hadoop2.7.3完全分布式集群部署过程。包含,Ubuntu服务器创建、远程工具连接配置、Ubuntu服务器配置、Hadoop文件配置、Hadoop格式化、启动。(首更时间2016年10月27日)
主机名/hostname | IP | 角色 |
---|---|---|
hadoop1 | 192.168.193.131 | ResourceManager/NameNode/SecondaryNameNode |
hadoop2 | 192.168.193.132 | NodeManager/DataNode |
hadoop3 | 192.168.193.133 | NodeManager/DataNode |
文件
然后 新建虚拟机
建立好的虚拟机如下
通过ipconfig命令查看服务器ip地址
IP 192.168.193.131 默认主机名ubuntu
IP 192.168.193.132 默认主机名ubuntu
IP 192.168.193.133 默认主机名ubuntu
下一步会修改主机名hostname
ssh-keygen
。打开终端或者服务器版命令行
查看是否安装(ssh)openssh-server,否则无法远程连接。
sshd
sudo apt install openssh-server
同样三个虚拟机建立连接
在Hadoop1、Hadoop2、Hadoop3中
xiaolei@ubuntu:~$ sudo vi /etc/apt/sources.list
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
更新源
xiaolei@ubuntu:~$ sudo apt update
sudo apt install vim
更新系统(服务器端更新量小,桌面版Ubuntu更新量较大,可以暂时不更新)
sudo apt-get upgrade
#在192.168.193.131
xiaolei@ubuntu:~$ sudo hostname hadoop1
#在192.168.193.131
xiaolei@ubuntu:~$ sudo hostname hadoop2
#在192.168.193.131
xiaolei@ubuntu:~$ sudo hostname hadoop3
#断开远程连接,重新连接即可看到已经改变了主机名。
在Hadoop1,2,3中
xiaolei@hadoop1:~$ sudo vim /etc/hosts
192.168.193.131 hadoop1
192.168.193.132 hadoop2
192.168.193.133 hadoop3
xiaolei@hadoop1:~$ date
Wed Oct 26 02:42:08 PDT 2016
xiaolei@hadoop1:~$ sudo tzselect
根据提示选择Asia
China
Beijing Time
yes
最后将Asia/Shanghai shell scripts 复制到/etc/localtime
xiaolei@hadoop1:~$ sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
xiaolei@ubuntu:~$ date
Wed Oct 26 17:45:30 CST 2016
xiaolei@hadoop1:~$ tar -zxf jdk-8u111-linux-x64.tar.gz
hadoop1@hadoop1:~$ sudo mv jdk1.8.0_111 /opt/
[sudo] password for hadoop1:
xiaolei@hadoop1:~$
编写环境变量脚本并使其生效
xiaolei@hadoop1:~$ sudo vim /etc/profile.d/jdk1.8.sh
输入内容(或者在我的github上下载jdk环境配置脚本源码)
#!/bin/sh
# author:wangxiaolei 王小雷
# blog:http://blog.csdn.net/dream_an
# date:20161027
export JAVA_HOME=/opt/jdk1.8.0_111
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
xiaolei@hadoop1:~$ source /etc/profile
xiaolei@hadoop1:~$ java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
也可通过scp命令
#注意后面带 : 默认是/home/xiaolei路径下
xiaolei@hadoop1:~$ scp jdk-8u111-linux-x64.tar.gz hadoop2:
命令解析:scp
远程复制 -r
递归 本机文件地址
app是文件,里面包含jdk、Hadoop包 远程主机名@远程主机ip:远程文件地址
sudo apt install ssh
sudo apt install rsync
xiaolei@ubuntu:~$ ssh-keygen -t rsa //一路回车就好
ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop1
ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop2
ssh-copy-id -i ~/.ssh/id_rsa.pub hadoop3
#不需要输入密码
ssh hadoop2
在hadoop1上配置完成后将Hadoop包直接远程复制scp
到其他Linux主机即可。
Linux主机Hadoop集群完全分布式分配
xiaolei@hadoop2:~$ sudo vim /etc/profile.d/hadoop2.7.3.sh
输入
#!/bin/sh
# Author:wangxiaolei 王小雷
# Blog:http://blog.csdn.net/dream_an
# Github:https://github.com/wxiaolei
# Date:20161027
# Path:/etc/profile.d/hadoop2.7.3.sh
export HADOOP_HOME="/opt/hadoop-2.7.3"
export PATH="$HADOOP_HOME/bin:$PATH"
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export YARN_CONF_DIR=$HADOOP_HOME/etc/hadoop
export JAVA_HOME=/opt/jdk1.8.0_111
<configuration>
<!-- 指定hdfs的nameservice为ns1 -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://Hadoop1:9000</value>
</property>
<!-- Size of read/write buffer used in SequenceFiles. -->
<property>
<name>io.file.buffer.size</name>
<value>131072</value>
</property>
<!-- 指定hadoop临时目录,自行创建 -->
<property>
<name>hadoop.tmp.dir</name>
<value>/home/xiaolei/hadoop/tmp</value>
</property>
</configuration>
<configuration>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>hadoop1:50090</value>
</property>
<property>
<name>dfs.replication</name>
<value>2</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/home/xiaolei/hadoop/hdfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/home/xiaolei/hadoop/hdfs/data</value>
</property>
</configuration>
<configuration>
<!-- Site specific YARN configuration properties -->
<!-- Configurations for ResourceManager -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.resourcemanager.address</name>
<value>hadoop1:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>hadoop1:8030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>hadoop1:8031</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address</name>
<value>hadoop1:8033</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>hadoop1:8088</value>
</property>
</configuration>
<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>hadoop1:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>hadoop1:19888</value>
</property>
</configuration>
xiaolei@hadoop1:~$ scp -r hadoop-2.7.3 hadoop3:
将每个Hadoop包sudo mv
移动到/opt/路径下。不要sudo cp
,注意权限。
xiaolei@hadoop1:sudo mv hadoop-2.7.3 /opt/
在hadoop1上执行
xiaolei@hadoop1:/opt/hadoop-2.7.3$ hdfs namenode -format
### 5.3.1. 在Hadoop1上执行
xiaolei@hadoop1:/opt/hadoop-2.7.3/sbin$ ./start-all.sh
jps
http://192.168.193.131:8088/
权限问题:
chown -R xiaolei:xiaolei hadoop-2.7.3
解析:将hadoop-2.7.3文件属主、组更换为xiaolei:xiaolei
chmod 777 hadoop
解析:将hadoop文件权限变成421 421 421 可写、可读可、执行即 7 7 7
查看是否安装openssh-server
ssd
或者
ps -e|grep ssh
安装 openssh-server
sudo apt install openssh-server
问题解决:
问题
Network error: Connection refused
解决安装
Network error: Connection refused
标签:windows mirror 安装jdk exp app 输入密码 form 完全分布式 集群部署
原文地址:http://blog.csdn.net/dream_an/article/details/52946840