https://blog.csdn.net/langkye/article/details/97240948
https://www.cnblogs.com/swordfall/p/8819668.html
https://www.cnblogs.com/zhengna/p/9358578.html
之前用docker部署hbase,用的是harisekhon/hbase镜像(1.0~latest版本都试过,均无法使用,不知道为什么其他人可以用)。故而在宿主机上进行部署。
环境
系统|软件 | 版本 |
Centos | 7.6.1810 |
Hadoop | 2.7.3 |
Hbase | 1.3.1 |
JDK | 1.8 |
SSH | 8.1p1 |
1. 安装Hadoop
# 下载软件包 cd ~ && wget http://archive.apache.org/dist/hadoop/core/hadoop-2.7.6/hadoop-2.7.6.tar.gz # 解压 mkdir /opt/app && tar -zxf hadoop-2.7.6.tar.gz -C /opt/app # 配置环境变量 cat >>/etc/profile<<EOF export HADOOP_HOME=/opt/app/hadoop-2.7.6 export PATH=$PATH:$HADOOP_HOME/bin EOF source /etc/profile # 修改hadoop配置文件 # vim /opt/app/hadoop-2.7.6/etc/hadoop/hadoop-env.sh export JAVA_HOME=/usr/local/java/jdk1.8.0_11 # vim /opt/app/hadoop-2.7.6/etc/hadoop/core-site.xml <configuration> <property> <name>hadoop.tmp.dir</name> <value>file:///opt/app/hadoop-2.7.6</value> <description>Abase for other temporary directories.</description> </property> <property> <name>fs.defaultFS</name> <value>hdfs://10.10.93.30:9000</value> </property> </configuration>
#vim /opt/app/hadoop-2.7.6/etc/hadoop/hdfs-site.xml <configuration> <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:///opt/app/hadoop-2.7.6/tmp/dfs/name</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:///opt/app/hadoop-2.7.6/tmp/dfs/data</value> </property> </configuration>
# SSH免密登陆配置(自行配置)
# 格式化hdfs(出现询问,输入yes即可)
cd /opt/app/hadoop-2.7.6 && ./bin/hdfs namenode -format
# 启动hdfs(停止./sbin/stop-dfs.sh)
./sbin/start-dfs.sh
2. 安装Hbase
# 下载软件包 wget http://archive.apache.org/dist/hbase/2.1.2/hbase-2.1.2-bin.tar.gz # 修改主机名(随意修改) hostname hadoop252 echo "hadoop252" > /etc/hostname # 同步时间 ntpdate ntp1.aliyun.com # 解压 tar -xzf hbase-2.1.2-bin.tar.gz -C /opt/app/ # 修改hbase-env.sh配置 # vim /opt/app/hbase-2.1.2/conf/hbase-env.sh export JAVA_HOME=/usr/local/java/jdk1.8.0_11 export HBASE_HOME=/opt/app/hbase-2.1.2 export HBASE_CLASSPATH=/opt/app/hadoop-2.7.6/etc/hadoop export HBASE_PID_DIR=/opt/app/hbase-2.1.2/pids export HBASE_MANAGES_ZK=false # 修改hbase-site.xml # vim /opt/app/hbase-2.1.2/conf/hbase-site.xml <configuration> <!-- 存储目录 这里的hdfs可以是单机版的--> <property> <name>hbase.rootdir</name> <value>hdfs://hadoop252:9000/hbase</value> <description>The directory shared byregion servers.</description> </property> <property> <name>hbase.tmp.dir</name> <value>/opt/app/hbase-2.1.2/tmp</value> </property> <!-- false是单机模式,true是分布式模式 --> <property> <name>hbase.cluster.distributed</name> <value>false</value> </property> </configuration>
# 访问IP:50070 hadoop首页
3. 启动Hbase
cd /opt/app/hbase-2.1.2/bin && ./start-hbase.sh # 启动后访问IP:16010