MacOS 安装 Hadoop & Hbase 过程
Hadoop: 2.8.2
Hbase: 1.2.6
Mac 安装 HBase
hadoop安装
- 安装
1 | brew 安装 hadoop |
- 进入Hadoop的配置目录
1 | ➜ cd ${HADOOP_HOME}/etc/hadoop |
编辑core-site.xml文件
1
2
3
4
5
6
7
8
9
10
11
12<configuration>
<property>
<name>hadoop.tmp.dir</name>
<!-- 永久存储的tmp文件. -->
<value>/Users/niufeiy/Hadoop/opt/data/tmp/hadoop-${user.name}</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:8020</value>
</property>
</configuration>编辑hdfs-site.xml文件
1
2
3
4
5
6<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>格式化HDFS
1
hdfs namenode -format
配置Yarn
1
2➜ cd ${HADOOP_HOME}/etc/hadoop
➜ cp mapred-site.xml.template mapred-site.xml编辑mapred-site.xml
1
2
3
4
5
6<configuration>
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
</configuration>
编辑yarn-site.xml
1
2
3
4
5
6
7
8
9
10
11<configuration>
<!-- Site specific YARN configuration properties -->
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.resourcemanager.hostname</name>
<value>localhost</value>
</property>
</configuration>Yarn的端口是8088,访问 http://localhost:8088/
查看java进程
1
2
3
4
5
6
7➜ conf jps
42420 ResourceManager
42100 NameNode
42516 NodeManager
42299 SecondaryNameNode
42188 DataNode
48669 Jps
命令
1 | start-all.sh |
Hbase 安装
伪分布式模式
配置 hbase-env.xml
1 | export JAVA_HOME="$(/usr/libexec/java_home)" |
配置 hbase-site.xml (/usr/local/Cellar/hbase/1.2.6/libexec/conf)
1 | <configuration> |
注意
hbase.rootdir
与 hadoop fs.default.name
地址一致
单节点模式
配置 hbase-env.xml
1 | export JAVA_HOME="$(/usr/libexec/java_home)" |
配置 hbase-site.xml
1 | <configuration> |
启动
1 | start-all.sh |
报错集合
org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = Con
原因 没有启动HBase 需要运行 start-hbase.sh 才可以。
ERROR:org.apache.hadoop.hbase.PleaseHoldException: Master is initializing
原因 时间不同步 or ZooKeeper不正常
ERROR
1 | ERROR: The node /hbase is not in ZooKeeper. It should have been written by the master. Check the value configured in 'zookeeper.znode.parent'. There could be a mismatch with the one configured in the master. |
原因是端口被占用,需要把自己安装的zookeeper关闭,用hbase自带的
http://localhost:8042/node
http://localhost:8088/cluster
http://localhost:50070/dfshealth.html#tab-overview