From e165629b29d51bd143537cb7ba2dbed21ab8dc9e Mon Sep 17 00:00:00 2001 From: louzin <294098546@qq.com> Date: Fri, 16 Sep 2022 15:51:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AF=B9ubuntu=E7=9A=84?= =?UTF-8?q?=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +++++++- ubuntu_standalone_hbase.sh | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 ubuntu_standalone_hbase.sh diff --git a/README.md b/README.md index 468e53d..e6df003 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ - [前置条件](#前置条件) - [使用方法](#使用方法) - [RHEL/CentOS](#RHEL/CentOS) + - [Ubuntu](#Ubuntu) - [已知问题](#已知问题) # 前置条件 @@ -38,7 +39,14 @@ ```shell chmod +x ./centos_standalone_hbase.sh -bash ./centos_standalone_hbase.sh +sh ./centos_standalone_hbase.sh +``` + +## Ubuntu + +```shell +chmod +x ./ubuntu_standalone_hbase.sh +bash ./ubuntu_standalone_hbase.sh ``` # 已知问题 diff --git a/ubuntu_standalone_hbase.sh b/ubuntu_standalone_hbase.sh new file mode 100644 index 0000000..c9a8443 --- /dev/null +++ b/ubuntu_standalone_hbase.sh @@ -0,0 +1,57 @@ +#!/bin/bash +echo "开始更新" +apt update -y && apt install wget openssh-server -y +echo -e "port 22\nPermitRootLogin yes" >> /etc/ssh/sshd_config +service ssh restart +#下载 +#JDK +wget https://repo.huaweicloud.com/java/jdk/8u202-b08/jdk-8u202-linux-x64.tar.gz +tar xf jdk-8u202-linux-x64.tar.gz -C /opt/ +#Hadoop +wget https://repo.huaweicloud.com/apache/hadoop/common/hadoop-2.9.0/hadoop-2.9.0.tar.gz +tar xf hadoop-2.9.0.tar.gz -C /opt/ +#Zookeeper +wget https://repo.huaweicloud.com/apache/zookeeper/zookeeper-3.8.0/apache-zookeeper-3.8.0-bin.tar.gz +tar xf apache-zookeeper-3.8.0-bin.tar.gz -C /opt/ +#Hbase +wget https://repo.huaweicloud.com/apache/hbase/2.2.4/hbase-2.2.4-bin.tar.gz +tar xf hbase-2.2.4-bin.tar.gz -C /opt/ +#环境变量 +echo -e "#JDK Env\nexport JAVA_HOME=/opt/jdk1.8.0_202\n\ +export PATH=\${JAVA_HOME}/bin:/\$PATH" >> /root/.bashrc +echo -e "#Hadoop Env\nexport HADOOP_HOME=/opt/hadoop-2.9.0/\n\ +export PATH=\$HADOOP_HOME/sbin:\$HADOOP_HOME/bin:\$PATH" >> /root/.bashrc +echo -e "#Zookeeper Env\nexport ZOOKEEPER_HOME=/opt/apache-zookeeper-3.8.0-bin\n\ +export PATH=\$PATH:\$ZOOKEEPER_HOME/bin" >> /root/.bashrc +echo -e "#Hbase Env\nexport HBASE_HOME=/opt/hbase-2.2.4\n\ +export PATH=\$HBASE_HOME/bin:\$HADOOP_HOME/bin:\$PATH" >> /root/.bashrc +# 验证安装 +echo "验证安装" +java -version +hadoop version +zkServer.sh version +# 配置 +# 关闭防火墙 +echo "关闭防火墙" +service ufw stop +echo "开始安装hadoop" +# Hadoop +sed "s/{host}/$(cat /etc/hostname)/g" -i ./hadoop/slaves +sed "s|\${JAVA_HOME}|$JAVA_HOME|g" -i ./hadoop/hadoop-env.sh +sed "s/{host}/$(cat /etc/hostname)/g" -i ./hadoop/core-site.xml +\cp -rf ./hadoop /opt/hadoop-2.9.0/etc/ +hdfs namenode -format +echo "开始安装zookeeper" +# Zookeeper +mkdir -p /opt/zookeeper_cache/data/zookeeper +mkdir -p /opt/zookeeper_cache/data/zookeeper_log +\cp -rf zoo.cfg /opt/apache-zookeeper-3.8.0-bin/conf/ +# Hbase +echo "开始安装hbase" +echo -e "export JAVA_HOME=$JAVA_HOME\n\ +export HBASE_CLASSPATH=/opt/hbase-2.2.4/conf\n\ +export HBASE_MANAGES_ZK=false" >> ./conf/hbase-env.sh +sed "s/{host}/$(cat /etc/hostname)/g" -i ./conf/hbase-site.xml +sed "s/{host}/$(cat /etc/hostname)/g" -i ./conf/regionservers +\cp -rf ./conf/* /opt/hbase-2.2.4/conf/ +echo "安装结束" \ No newline at end of file