在CentOS上启动HBase需要遵循以下步骤:
java -version
如果没有安装Java,请先安装它。
wget https://archive.apache.org/dist/hbase/2.4.9/hbase-2.4.9-bin.tar.gz
tar -xzf 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>/var/lib/zookeeper</value>
</property>
</configuration>
根据您的Hadoop和ZooKeeper配置,可能需要修改hbase.rootdir
和hbase.zookeeper.quorum
的值。
$HBASE_HOME/bin
目录下运行以下命令:start-hbase.sh
hbase shell
在HBase shell中,输入status
命令,如果看到HBase集群的状态为UP
,则表示HBase已成功启动。
注意:如果您还没有安装和配置Hadoop和ZooKeeper,您需要先完成这些步骤。HBase依赖于Hadoop和ZooKeeper,因此在启动HBase之前,请确保它们已经正确安装和配置。