centos一键安装hadoop脚本
本帖最后由 袅袅系秋风 于 2019-9-28 14:48 编辑刚从电脑里面翻出来的去年的课程设计,正好好久没有发帖了,发出来分享一下,大家互相学习吧
录的脚本执行视频,不会用的可以看一下
https://www.bilibili.com/video/av69259968/
#Hadoop install Script
#Define
HadoopLink='http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.9.2/hadoop-2.9.2.tar.gz'
#echo -e "\033[0;31m\033[0m" 32绿 31红 34蓝
#Functions
installJDK() #安装JDK
{
echo -e "\033[0;34m正在安装jdk...\033[0m"
sleep 1.5
rpm -e --nodeps java-1.8.0-openjdk-headless
rpm -e --nodeps java-1.8.0-openjdk
rpm -e --nodeps tzdata-java
rpm -e --nodeps python-javapackages
rpm -e --nodeps javapackages-tools
rm -rf /var/run/yum.pid
yum install -y java-1.7.0-openjdk java-1.7.0-openjdk-devel
if [ $? -ne 0 ] ; then
echo -e "\033[0;31mJDK安装失败!\n\033[0m"
exit 2
fi
echo -e "\033[0;32mJDK安装完成!\n \033[0m"
}
InstallHadoop() #安装hadoop
{
cd ~
ls -l | grep hadoop-2.9.2.tar.gz
if [ $? -ne 0 ] ; then
echo -e "\033[0;34m正在下载Hadoop\033[0m"
sleep 1.5
wget echo $HadoopLink
echo -e "\033[0;34m下载完成 正在安装Hadoop...\033[0m"
sleep 1.5
fi
tar -zxvf hadoop-2.9.2.tar.gz-C /usr/local
cd /usr/local
mv hadoop-2.9.2/ hadoop
chown -R hadoop ./hadoop
#配置环境变量
echo 'export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.231-2.6.19.2.el7_7.x86_64/' >> ~/.bashrc
source ~/.bashrc
echo "export HADOOP_HOME=/usr/local/hadoop" >> /etc/profile
echo "alias cdha='cd /usr/local/hadoop'">> /etc/profile
echo "export PATH=.:$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin" >> /etc/profile
sed -ie 's/export JAVA_HOME=${JAVA_HOME}/export JAVA_HOME=\/usr\/lib\/jvm\/java-1.7.0-openjdk-1.7.0.231-2.6.19.2.el7_7.x86_64/g' /usr/local/hadoop/etc/hadoop/hadoop-env.sh
source /etc/profile
cd /usr/local/hadoop
./bin/hadoop version
echo -e "\033[0;32mHadoop安装完成!\n\033[0m"
sleep 1.5
}
setSSHWithoutCode() #设置ssh免密登陆
{
echo -e "\033[0;34m正在设置SSH免密登录...\033[0m"
sleep 1.5
rm -rf /var/run/yum.pid
yum install openssh-server -y&&yum install openssh-clients -y
#ssh localhost
cd ~/.ssh/
if [ $? -ne 0 ] ; then
echo -e "\033[0;31m请先执行命令ssh localhost 后重试\033[0m"
exit 1
fi
echo -e "\033[0;34m请按三次回车\033[0m"
ssh-keygen -t rsa
cat ./id_rsa.pub >> ./authorized_keys
#ssh localhost
echo -e "\033[0;32m免密设置完成! \033[0m"
sleep 1.5
}
creatAccount() #创建新用户
{
echo -e "\033[0;34m正在创建hadoop用户...\033[0m"
sleep 1.5
userdel -r hadoop
echo '创建新用户 :hadoop'
echo '请输入密码 :'
sudo useradd -m hadoop -s /bin/bash
sudo passwd hadoop
echo "hadoop ALL=(ALL)ALL" >>/etc/sudoers
echo -e "\033[0;32m用户创建完成! \033[0m"
sleep 1.5
}
SetHadoop() #配置hadoop
{
echo -e "\033[0;34m正在配置Hadoop...\033[0m"
sleep 1.5
echo "# Hadoop Environment Variables
export HADOOP_HOME=/usr/local/hadoop
export HADOOP_INSTALL=$HADOOP_HOME
export HADOOP_MAPRED_HOME=$HADOOP_HOME
export HADOOP_COMMON_HOME=$HADOOP_HOME
export HADOOP_HDFS_HOME=$HADOOP_HOME
export YARN_HOME=$HADOOP_HOME
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin" >> ~/.bashrc
source ~/.bashrc
cd /usr/local/hadoop/etc/hadoop/
echo "<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/usr/local/hadoop/tmp</value>
<description>Abase for other temporary directories.</description>
</property>
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>" > core-site.xml
echo "<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/usr/local/hadoop/tmp/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/usr/local/hadoop/tmp/dfs/data</value>
</property>
</configuration>" >hdfs-site.xml
mv mapred-site.xml.template mapred-site.xml
echo "<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>" >mapred-site.xml
echo "<configuration>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
</configuration>" > yarn-site.xml
cd /usr/local/hadoop/
echo -e "\033[0;34m正在执行 NameNode 的格式化...\033[0m"
./bin/hdfs namenode -format
echo -e "\033[0;34m正在开启 NaneNode 和 DataNode 守护进程...\033[0m"
./sbin/start-dfs.sh #启动dfs
echo -e "\033[0;34m正在启动YARN...\033[0m"
./sbin/start-yarn.sh #启动YARN
./sbin/mr-jobhistory-daemon.sh start historyserver #开启历史服务器,才能在Web中查看任务运行情况
if [ $? -ne 0 ] ; then
echo -e "\033[0;32mHadoop配置失败 \033[0m"
exit 2;
fi
echo -e "\033[0;32mHadoop配置并启动成功 请至http://localhost:50070和http://localhost:8088/cluster查看\033[0m"
sleep 1.5
}
StartHadoop()
{
cd /usr/local/hadoop/
echo -e "\033[0;34m正在开启 NaneNode 和 DataNode 守护进程...\033[0m"
./sbin/start-dfs.sh #启动dfs
echo -e "\033[0;34m正在启动YARN...\033[0m"
./sbin/start-yarn.sh #启动YARN
./sbin/mr-jobhistory-daemon.sh start historyserver # 开启历史服务器,才能在Web中查看任务运行情况
}
StopHadoop()
{
echo -e "\033[0;34m正在关闭Hadoop...\033[0m"
cd /usr/local/hadoop/
./sbin/stop-dfs.sh
./sbin/stop-yarn.sh
./sbin/mr-jobhistory-daemon.sh stop historyserver
}
RestartHadoop()
{
echo -e "\033[0;34m正在重启Hadoop...\033[0m"
cd /usr/local/hadoop/
./sbin/stop-dfs.sh
./sbin/stop-yarn.sh
./sbin/mr-jobhistory-daemon.sh stop historyserver
echo -e "\033[0;34m正在开启 NaneNode 和 DataNode 守护进程...\033[0m"
./sbin/start-dfs.sh #启动dfs
echo -e "\033[0;34m正在启动YARN...\033[0m"
./sbin/start-yarn.sh #启动YARN
./sbin/mr-jobhistory-daemon.sh start historyserver # 开启历史服务器,才能在Web中查看任务运行情况
}
MyMain()
{
echo "请选择功能"
echo "1. 一健安装Hadoop(请先执行ssh localhost)"
echo "2. 执行ssh localhost"
echo "3. 启动Hadoop"
echo "4. 关闭Hadoop"
echo "5. 重启Hadoop"
echo "q. 退出本脚本"
read a
case $a in
1) creatAccount #创建新用户
setSSHWithoutCode #设置ssh免密登录
installJDK #安装jdk
InstallHadoop #安装hadoop
SetHadoop;; #配置hadoop
2) ssh localhost
exit;;
3) StartHadoop;;
4) StopHadoop;;
5) RestartHadoop;;
q) exit 0;;
*) echo -e "\033[0;31m没有此选项\033[0m";;
esac
}
MyMain 本帖最后由 fanfoxle 于 2019-9-27 11:46 编辑
我用的是centos 6.6 i386 虚拟机,一键安装出现如下问题,请问有没有一个简单的使用说明?
谢谢
# sh ./ins.sh
请选择功能
1. 一健安装Hadoop(请先执行ssh localhost)
2. 执行ssh localhost
3. 启动Hadoop
4. 关闭Hadoop
5. 重启Hadoop
q. 退出本脚本
2
The authenticity of host 'localhost (::1)' can't be established.
RSA key fingerprint is 83:1e:29:f0:ae:3b:65:54:c7:02:7d:0c:7a:f9:a6:ac.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
root@localhost's password:
# sl
-bash: sl: command not found
# ls
anaconda-ks.cfginstall.loginstall.log.syslog
# cd ./..
# ls
binbootdevetchomeliblost+foundmediamntoptprocrootsbinselinuxsrvsystmpusrvar
# cd home
# ls
ffl
# cd ffl
# ls
DesktopDocumentsDownloadsMusicPicturesPublicTemplatesVideos
# de Desktop/
-bash: de: command not found
# cd Desktop/
# ls
ins~ins.sh
# sh ./ins
sh: ./ins: No such file or directory
# sh ./ins.sh
请选择功能
1. 一健安装Hadoop(请先执行ssh localhost)
2. 执行ssh localhost
3. 启动Hadoop
4. 关闭Hadoop
5. 重启Hadoop
q. 退出本脚本
1
正在创建hadoop用户...
userdel: user 'hadoop' does not exist
创建新用户 :hadoop
请输入密码 :
Changing password for user hadoop.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
用户创建完成!
正在设置SSH免密登录...
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Determining fastest mirrors
* base: mirrors.huaweicloud.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.huaweicloud.com
Resolving Dependencies
--> Running transaction check
---> Package openssh-server.i686 0:5.3p1-104.el6 will be updated
---> Package openssh-server.i686 0:5.3p1-124.el6_10 will be an update
--> Processing Dependency: openssh = 5.3p1-124.el6_10 for package: openssh-server-5.3p1-124.el6_10.i686
--> Running transaction check
---> Package openssh.i686 0:5.3p1-104.el6 will be updated
--> Processing Dependency: openssh = 5.3p1-104.el6 for package: openssh-clients-5.3p1-104.el6.i686
--> Processing Dependency: openssh = 5.3p1-104.el6 for package: openssh-askpass-5.3p1-104.el6.i686
---> Package openssh.i686 0:5.3p1-124.el6_10 will be an update
--> Running transaction check
---> Package openssh-askpass.i686 0:5.3p1-104.el6 will be updated
---> Package openssh-askpass.i686 0:5.3p1-124.el6_10 will be an update
---> Package openssh-clients.i686 0:5.3p1-104.el6 will be updated
---> Package openssh-clients.i686 0:5.3p1-124.el6_10 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Updating:
openssh-server i686 5.3p1-124.el6_10 updates 328 k
Updating for dependencies:
openssh i686 5.3p1-124.el6_10 updates 280 k
openssh-askpass i686 5.3p1-124.el6_10 updates 61 k
openssh-clients i686 5.3p1-124.el6_10 updates 450 k
Transaction Summary
=============================================================================================================================================================
Upgrade 4 Package(s)
Total download size: 1.1 M
Downloading Packages:
(1/4): openssh-5.3p1-124.el6_10.i686.rpm | 280 kB 00:00
(2/4): openssh-askpass-5.3p1-124.el6_10.i686.rpm |61 kB 00:00
(3/4): openssh-clients-5.3p1-124.el6_10.i686.rpm | 450 kB 00:00
(4/4): openssh-server-5.3p1-124.el6_10.i686.rpm | 328 kB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 355 kB/s | 1.1 MB 00:03
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
Package: centos-release-6-6.el6.centos.12.2.i686 (@anaconda-CentOS-201410241409.i386/6.6)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : openssh-5.3p1-124.el6_10.i686 1/8
Updating : openssh-askpass-5.3p1-124.el6_10.i686 2/8
Updating : openssh-clients-5.3p1-124.el6_10.i686 3/8
Updating : openssh-server-5.3p1-124.el6_10.i686 4/8
Cleanup : openssh-server-5.3p1-104.el6.i686 5/8
Cleanup : openssh-clients-5.3p1-104.el6.i686 6/8
Cleanup : openssh-askpass-5.3p1-104.el6.i686 7/8
Cleanup : openssh-5.3p1-104.el6.i686 8/8
Verifying: openssh-askpass-5.3p1-124.el6_10.i686 1/8
Verifying: openssh-clients-5.3p1-124.el6_10.i686 2/8
Verifying: openssh-server-5.3p1-124.el6_10.i686 3/8
Verifying: openssh-5.3p1-124.el6_10.i686 4/8
Verifying: openssh-askpass-5.3p1-104.el6.i686 5/8
Verifying: openssh-5.3p1-104.el6.i686 6/8
Verifying: openssh-clients-5.3p1-104.el6.i686 7/8
Verifying: openssh-server-5.3p1-104.el6.i686 8/8
Updated:
openssh-server.i686 0:5.3p1-124.el6_10
Dependency Updated:
openssh.i686 0:5.3p1-124.el6_10 openssh-askpass.i686 0:5.3p1-124.el6_10 openssh-clients.i686 0:5.3p1-124.el6_10
Complete!
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.huaweicloud.com
Package openssh-clients-5.3p1-124.el6_10.i686 already installed and latest version
Nothing to do
请按三次回车
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
1d:a0:c2:c8:f2:f1:f6:99:1b:32:f4:14:3e:14:f7:f0 root@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
| . + |
| . o + = |
|. + o + E |
| o o + . . . |
|. + + S . |
| o + + |
| o * |
| o o |
| . |
+-----------------+
免密设置完成!
正在安装jdk...
error: package java-1.8.0-openjdk-headless is not installed
error: package java-1.8.0-openjdk is not installed
error: package tzdata-java is not installed
error: package python-javapackages is not installed
error: package javapackages-tools is not installed
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirrors.huaweicloud.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.huaweicloud.com
Resolving Dependencies
--> Running transaction check
---> Package java-1.7.0-openjdk.i686 1:1.7.0.231-2.6.19.1.el6_10 will be installed
--> Processing Dependency: nss(x86-32) >= 3.36.0 for package: 1:java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686
--> Processing Dependency: jpackage-utils >= 1.7.3-1jpp.2 for package: 1:java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686
--> Processing Dependency: copy-jdk-configs >= 3.3-9 for package: 1:java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686
--> Processing Dependency: xorg-x11-fonts-Type1 for package: 1:java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686
--> Processing Dependency: tzdata-java for package: 1:java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686
--> Processing Dependency: libsctp.so.1(VERS_1) for package: 1:java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686
--> Processing Dependency: libsctp.so.1 for package: 1:java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686
--> Processing Dependency: libpcsclite.so.1 for package: 1:java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686
--> Processing Dependency: libgif.so.4 for package: 1:java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686
---> Package java-1.7.0-openjdk-devel.i686 1:1.7.0.231-2.6.19.1.el6_10 will be installed
--> Running transaction check
---> Package copy-jdk-configs.noarch 0:3.3-9.el6 will be installed
---> Package giflib.i686 0:4.1.6-3.1.el6 will be installed
---> Package jpackage-utils.noarch 0:1.7.5-3.16.el6 will be installed
---> Package lksctp-tools.i686 0:1.0.10-7.el6 will be installed
---> Package nss.i686 0:3.16.1-14.el6 will be updated
--> Processing Dependency: nss = 3.16.1-14.el6 for package: nss-sysinit-3.16.1-14.el6.i686
--> Processing Dependency: nss(x86-32) = 3.16.1-14.el6 for package: nss-tools-3.16.1-14.el6.i686
---> Package nss.i686 0:3.36.0-9.el6_10 will be an update
--> Processing Dependency: nss-util >= 3.36.0 for package: nss-3.36.0-9.el6_10.i686
--> Processing Dependency: nss-softokn(x86-32) >= 3.14.3-22 for package: nss-3.36.0-9.el6_10.i686
--> Processing Dependency: nspr >= 4.19.0 for package: nss-3.36.0-9.el6_10.i686
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.33) for package: nss-3.36.0-9.el6_10.i686
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.31) for package: nss-3.36.0-9.el6_10.i686
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.24) for package: nss-3.36.0-9.el6_10.i686
--> Processing Dependency: libnssutil3.so(NSSUTIL_3.21) for package: nss-3.36.0-9.el6_10.i686
---> Package pcsc-lite-libs.i686 0:1.5.2-16.el6 will be installed
---> Package tzdata-java.noarch 0:2019b-2.el6 will be installed
---> Package xorg-x11-fonts-Type1.noarch 0:7.2-11.el6 will be installed
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.2-11.el6.noarch
--> Processing Dependency: ttmkfdir for package: xorg-x11-fonts-Type1-7.2-11.el6.noarch
--> Running transaction check
---> Package nspr.i686 0:4.10.6-1.el6_5 will be updated
---> Package nspr.i686 0:4.19.0-1.el6 will be an update
---> Package nss-softokn.i686 0:3.14.3-17.el6 will be updated
---> Package nss-softokn.i686 0:3.14.3-23.3.el6_8 will be an update
--> Processing Dependency: nss-softokn-freebl(x86-32) >= 3.14.3-23.3.el6_8 for package: nss-softokn-3.14.3-23.3.el6_8.i686
---> Package nss-sysinit.i686 0:3.16.1-14.el6 will be updated
---> Package nss-sysinit.i686 0:3.36.0-9.el6_10 will be an update
---> Package nss-tools.i686 0:3.16.1-14.el6 will be updated
---> Package nss-tools.i686 0:3.36.0-9.el6_10 will be an update
---> Package nss-util.i686 0:3.16.1-3.el6 will be updated
---> Package nss-util.i686 0:3.36.0-1.el6 will be an update
---> Package ttmkfdir.i686 0:3.0.9-32.1.el6 will be installed
--> Running transaction check
---> Package nss-softokn-freebl.i686 0:3.14.3-17.el6 will be updated
---> Package nss-softokn-freebl.i686 0:3.14.3-23.3.el6_8 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
java-1.7.0-openjdk i686 1:1.7.0.231-2.6.19.1.el6_10 updates 28 M
java-1.7.0-openjdk-devel i686 1:1.7.0.231-2.6.19.1.el6_10 updates 9.5 M
Installing for dependencies:
copy-jdk-configs noarch 3.3-9.el6 base 21 k
giflib i686 4.1.6-3.1.el6 base 37 k
jpackage-utils noarch 1.7.5-3.16.el6 base 60 k
lksctp-tools i686 1.0.10-7.el6 base 77 k
pcsc-lite-libs i686 1.5.2-16.el6 base 28 k
ttmkfdir i686 3.0.9-32.1.el6 base 41 k
tzdata-java noarch 2019b-2.el6 updates 188 k
xorg-x11-fonts-Type1 noarch 7.2-11.el6 base 520 k
Updating for dependencies:
nspr i686 4.19.0-1.el6 base 117 k
nss i686 3.36.0-9.el6_10 updates 871 k
nss-softokn i686 3.14.3-23.3.el6_8 base 270 k
nss-softokn-freebl i686 3.14.3-23.3.el6_8 base 157 k
nss-sysinit i686 3.36.0-9.el6_10 updates 53 k
nss-tools i686 3.36.0-9.el6_10 updates 468 k
nss-util i686 3.36.0-1.el6 base 72 k
Transaction Summary
=============================================================================================================================================================
Install 10 Package(s)
Upgrade 7 Package(s)
Total download size: 40 M
Downloading Packages:
(1/17): copy-jdk-configs-3.3-9.el6.noarch.rpm |21 kB 00:00
(2/17): giflib-4.1.6-3.1.el6.i686.rpm |37 kB 00:00
(3/17): java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686.rpm |28 MB 00:18
(4/17): java-1.7.0-openjdk-devel-1.7.0.231-2.6.19.1.el6_10.i686.rpm | 9.5 MB 00:06
(5/17): jpackage-utils-1.7.5-3.16.el6.noarch.rpm |60 kB 00:00
(6/17): lksctp-tools-1.0.10-7.el6.i686.rpm |77 kB 00:00
(7/17): nspr-4.19.0-1.el6.i686.rpm | 117 kB 00:00
(8/17): nss-3.36.0-9.el6_10.i686.rpm | 871 kB 00:00
(9/17): nss-softokn-3.14.3-23.3.el6_8.i686.rpm | 270 kB 00:00
(10/17): nss-softokn-freebl-3.14.3-23.3.el6_8.i686.rpm | 157 kB 00:00
(11/17): nss-sysinit-3.36.0-9.el6_10.i686.rpm |53 kB 00:00
(12/17): nss-tools-3.36.0-9.el6_10.i686.rpm | 468 kB 00:00
(13/17): nss-util-3.36.0-1.el6.i686.rpm |72 kB 00:00
(14/17): pcsc-lite-libs-1.5.2-16.el6.i686.rpm |28 kB 00:00
(15/17): ttmkfdir-3.0.9-32.1.el6.i686.rpm |41 kB 00:00
(16/17): tzdata-java-2019b-2.el6.noarch.rpm | 188 kB 00:00
(17/17): xorg-x11-fonts-Type1-7.2-11.el6.noarch.rpm | 520 kB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.4 MB/s |40 MB 00:29
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : nspr-4.19.0-1.el6.i686 1/24
Updating : nss-util-3.36.0-1.el6.i686 2/24
Updating : nss-softokn-freebl-3.14.3-23.3.el6_8.i686 3/24
Installing : tzdata-java-2019b-2.el6.noarch 4/24
Installing : copy-jdk-configs-3.3-9.el6.noarch 5/24
Installing : jpackage-utils-1.7.5-3.16.el6.noarch 6/24
Updating : nss-softokn-3.14.3-23.3.el6_8.i686 7/24
Updating : nss-sysinit-3.36.0-9.el6_10.i686 8/24
Updating : nss-3.36.0-9.el6_10.i686 9/24
Installing : giflib-4.1.6-3.1.el6.i686 10/24
Installing : ttmkfdir-3.0.9-32.1.el6.i686 11/24
Installing : xorg-x11-fonts-Type1-7.2-11.el6.noarch 12/24
Installing : pcsc-lite-libs-1.5.2-16.el6.i686 13/24
Installing : lksctp-tools-1.0.10-7.el6.i686 14/24
Installing : 1:java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686 15/24
Installing : 1:java-1.7.0-openjdk-devel-1.7.0.231-2.6.19.1.el6_10.i686 16/24
Updating : nss-tools-3.36.0-9.el6_10.i686 17/24
Cleanup : nss-tools-3.16.1-14.el6.i686 18/24
Cleanup : nss-sysinit-3.16.1-14.el6.i686 19/24
Cleanup : nss-3.16.1-14.el6.i686 20/24
Cleanup : nss-softokn-3.14.3-17.el6.i686 21/24
Cleanup : nss-util-3.16.1-3.el6.i686 22/24
Cleanup : nspr-4.10.6-1.el6_5.i686 23/24
Cleanup : nss-softokn-freebl-3.14.3-17.el6.i686 24/24
Verifying: 1:java-1.7.0-openjdk-1.7.0.231-2.6.19.1.el6_10.i686 1/24
Verifying: nss-softokn-freebl-3.14.3-23.3.el6_8.i686 2/24
Verifying: nss-util-3.36.0-1.el6.i686 3/24
Verifying: lksctp-tools-1.0.10-7.el6.i686 4/24
Verifying: nss-tools-3.36.0-9.el6_10.i686 5/24
Verifying: jpackage-utils-1.7.5-3.16.el6.noarch 6/24
Verifying: pcsc-lite-libs-1.5.2-16.el6.i686 7/24
Verifying: 1:java-1.7.0-openjdk-devel-1.7.0.231-2.6.19.1.el6_10.i686 8/24
Verifying: nss-sysinit-3.36.0-9.el6_10.i686 9/24
Verifying: copy-jdk-configs-3.3-9.el6.noarch 10/24
Verifying: tzdata-java-2019b-2.el6.noarch 11/24
Verifying: nspr-4.19.0-1.el6.i686 12/24
Verifying: xorg-x11-fonts-Type1-7.2-11.el6.noarch 13/24
Verifying: ttmkfdir-3.0.9-32.1.el6.i686 14/24
Verifying: giflib-4.1.6-3.1.el6.i686 15/24
Verifying: nss-softokn-3.14.3-23.3.el6_8.i686 16/24
Verifying: nss-3.36.0-9.el6_10.i686 17/24
Verifying: nss-sysinit-3.16.1-14.el6.i686 18/24
Verifying: nss-softokn-freebl-3.14.3-17.el6.i686 19/24
Verifying: nss-softokn-3.14.3-17.el6.i686 20/24
Verifying: nss-util-3.16.1-3.el6.i686 21/24
Verifying: nss-3.16.1-14.el6.i686 22/24
Verifying: nss-tools-3.16.1-14.el6.i686 23/24
Verifying: nspr-4.10.6-1.el6_5.i686 24/24
Installed:
java-1.7.0-openjdk.i686 1:1.7.0.231-2.6.19.1.el6_10 java-1.7.0-openjdk-devel.i686 1:1.7.0.231-2.6.19.1.el6_10
Dependency Installed:
copy-jdk-configs.noarch 0:3.3-9.el6 giflib.i686 0:4.1.6-3.1.el6 jpackage-utils.noarch 0:1.7.5-3.16.el6 lksctp-tools.i686 0:1.0.10-7.el6
pcsc-lite-libs.i686 0:1.5.2-16.el6 ttmkfdir.i686 0:3.0.9-32.1.el6 tzdata-java.noarch 0:2019b-2.el6 xorg-x11-fonts-Type1.noarch 0:7.2-11.el6
Dependency Updated:
nspr.i686 0:4.19.0-1.el6 nss.i686 0:3.36.0-9.el6_10 nss-softokn.i686 0:3.14.3-23.3.el6_8nss-softokn-freebl.i686 0:3.14.3-23.3.el6_8
nss-sysinit.i686 0:3.36.0-9.el6_10nss-tools.i686 0:3.36.0-9.el6_10nss-util.i686 0:3.36.0-1.el6
Complete!
JDK安装完成!
正在下载Hadoop
--2019-09-26 20:35:54--http://echo/
Resolving echo... failed: Temporary failure in name resolution.
wget: unable to resolve host address “echo”
--2019-09-26 20:36:09--http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.9.2/hadoop-2.9.2-src.tar.gz
Resolving mirrors.hust.edu.cn... 202.114.18.160
Connecting to mirrors.hust.edu.cn|202.114.18.160|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 39119388 (37M)
Saving to: “hadoop-2.9.2-src.tar.gz”
100%[===================================================================================================================>] 39,119,3881.77M/s in 19s
2019-09-26 20:36:30 (1.99 MB/s) - “hadoop-2.9.2-src.tar.gz” saved
FINISHED --2019-09-26 20:36:30--
Downloaded: 1 files, 37M in 19s (1.99 MB/s)
下载完成 正在安装Hadoop...
tar (child): hadoop-2.9.2.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
mv: cannot stat `hadoop-2.9.2/': No such file or directory
chown: cannot access `./hadoop': No such file or directory
sed: can't read /usr/local/hadoop/etc/hadoop/hadoop-env.sh: No such file or directory
./ins.sh: line 43: cd: /usr/local/hadoop: No such file or directory
./ins.sh: line 44: ./bin/hadoop: No such file or directory
Hadoop安装完成!
正在配置Hadoop...
./ins.sh: line 97: cd: /usr/local/hadoop/etc/hadoop/: No such file or directory
mv: cannot stat `mapred-site.xml.template': No such file or directory
./ins.sh: line 139: cd: /usr/local/hadoop/: No such file or directory
正在执行 NameNode 的格式化...
./ins.sh: line 141: ./bin/hdfs: No such file or directory
正在开启 NaneNode 和 DataNode 守护进程...
./ins.sh: line 143: ./sbin/start-dfs.sh: No such file or directory
正在启动YARN...
./ins.sh: line 145: ./sbin/start-yarn.sh: No such file or directory
./ins.sh: line 146: ./sbin/mr-jobhistory-daemon.sh: No such file or directory
Hadoop配置失败
正在执行 NameNode 的格式化...
./ins.sh: line 141: ./bin/hdfs: No such file or directory
正在开启 NaneNode 和 DataNode 守护进程...
./ins.sh: line 143: ./sbin/start-dfs.sh: No such file or directory
正在启动YARN...
./ins.sh: line 145: ./sbin/start-yarn.sh: No such file or directory
./ins.sh: line 146: ./sbin/mr-jobhistory-daemon.sh: No such file or directory
Hadoop配置失败
请问一下这是什么问题啊??
请选择功能
1. 一健安装Hadoop(请先执行ssh localhost)
2. 执行ssh localhost
3. 启动Hadoop
4. 关闭Hadoop
5. 重启Hadoop
q. 退出本脚本
3
正在开启 NaneNode 和 DataNode 守护进程...
/usr/local/hadoop/bin/hdfs:行319: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.231-2.6.19.2.el7_7.x86_64/bin/java: 没有那个文件或目录
Starting namenodes on []
localhost: starting namenode, logging to /usr/local/hadoop/logs/hadoop-root-namenode-localhost.localdomain.out
localhost: /usr/local/hadoop/bin/hdfs:行319: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.231-2.6.19.2.el7_7.x86_64/bin/java: 没有那个文件或目录
localhost: starting datanode, logging to /usr/local/hadoop/logs/hadoop-root-datanode-localhost.localdomain.out
localhost: /usr/local/hadoop/bin/hdfs:行319: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.231-2.6.19.2.el7_7.x86_64/bin/java: 没有那个文件或目录
/usr/local/hadoop/bin/hdfs:行319: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.231-2.6.19.2.el7_7.x86_64/bin/java: 没有那个文件或目录
正在启动YARN...
starting yarn daemons
starting resourcemanager, logging to /usr/local/hadoop/logs/yarn-scien-resourcemanager-localhost.localdomain.out
/usr/local/hadoop/bin/yarn:行386: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.231-2.6.19.2.el7_7.x86_64/bin/java: 没有那个文件或目录
localhost: starting nodemanager, logging to /usr/local/hadoop/logs/yarn-root-nodemanager-localhost.localdomain.out
localhost: /usr/local/hadoop/bin/yarn:行386: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.231-2.6.19.2.el7_7.x86_64/bin/java: 没有那个文件或目录
starting historyserver, logging to /usr/local/hadoop/logs/mapred-scien-historyserver-localhost.localdomain.out
/usr/local/hadoop/bin/mapred:行177: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.231-2.6.19.2.el7_7.x86_64/bin/java: 没有那个文件或目录
感谢分享 这个真的强 我当时配了好久 哇哈哈,超有用!!! fanfoxle 发表于 2019-9-27 11:38
我用的是centos 6.6 i386 虚拟机,一键安装出现如下问题,请问有没有一个简单的使用说明?
谢谢
明天我再看看吧,今天太晚了 fanfoxle 发表于 2019-9-27 11:38
我用的是centos 6.6 i386 虚拟机,一键安装出现如下问题,请问有没有一个简单的使用说明?
谢谢
代码已经修改好了,你再试一下 袅袅系秋风 发表于 2019-9-27 23:07
明天我再看看吧,今天太晚了
几个问题。
1. HadoopLink='http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.9.2/hadoop-2.9.2-src.tar.gz',这里应该是http://mirrors.hust.edu.cn/apache/hadoop/common/hadoop-2.9.2/hadoop-2.9.2.tar.gz
2.echo "export HADOOP_HOME=/usr/local/hadoop" >> /etc/profile
echo "alias cdha='cd /usr/local/hadoop'">> /etc/profile
echo "export PATH=.:$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin" >> /etc/profile
hadoop2.9.2并没有profile文件。
3.sed -ie 's/export JAVA_HOME=${JAVA_HOME}/export JAVA_HOME=\/usr\/lib\/jvm\/java-1.7.0-openjdk-1.7.0.201-2.6.16.1.el7_6.x86_64/g' /usr/local/hadoop/etc/hadoop/hadoop-env.sh
往hadoop-env.sh里添加java_home的时候出现问题,前面安装jkd版本不同,这里的字段会不一样。
修复这三个问题后,hadoop就跑起来了。
anyway,还是很感谢! 感谢分享 感谢分享
页:
[1]
2