在CentOS上启动HBase需要遵循以下步骤:
java -version
如果没有安装Java,请先安装Java环境。
wget https://archive.apache.org/dist/hbase/2.4.9/hbase-2.4.9-bin.tar.gz
tar -zxvf hbase-2.4.9-bin.tar.gz
/etc/profile.d/hbase.sh
文件,添加以下内容:export HBASE_HOME=/path/to/hbase-2.4.9
export PATH=$PATH:$HBASE_HOME/bin
将/path/to/hbase-2.4.9
替换为实际的HBase安装路径。保存文件并运行source /etc/profile.d/hbase.sh
使配置生效。
$HBASE_HOME/conf/hbase-site.xml
文件,添加以下内容:<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://localhost:9000/hbase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>localhost</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/path/to/zookeeper/data</value>
</property>
</configuration>
将/path/to/zookeeper/data
替换为实际的ZooKeeper数据目录。保存文件。
start-hbase.sh
hbase shell
如果看到HBase shell提示符,说明HBase已经成功启动。
注意:以上步骤假设你已经安装并配置了Hadoop和ZooKeeper。如果还没有,请先安装并配置它们。