我正在尝试使用本教程安装 Hbase,但遇到了一些奇怪的事情:hbase 无法识别我的 java 版本,而 Ubuntu 16.04 可以。
mike@mike-thinks:~/hbase-1.2.6$ ./bin/start-hbase.sh
localhost: +======================================================================+
localhost: | Error: JAVA_HOME is not set |
localhost: +----------------------------------------------------------------------+
localhost: | Please download the latest Sun JDK from the Sun Java web site |
localhost: | > http://www.oracle.com/technetwork/java/javase/downloads |
localhost: | |
localhost: | HBase requires Java 1.7 or later. |
localhost: +======================================================================+
starting master, logging to /home/mike/hbase-1.2.6/bin/../logs/hbase-mike-master-mike-thinks.out
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
regionserver running as process 13688. Stop it first.
mike@mike-thinks:~/hbase-1.2.6$ java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
经常发生我必须执行以下命令:export JAVA_HOME=/usr/
也许我应该编辑start-hbase.sh
以将其添加到 java 路径,我不记得该命令,但我找不到我应该把它放在哪里。
我尝试手动设置JAVA_HOME
变量,但即使错误消息已更改,它似乎仍然找不到它
mike@mike-thinks:~/hbase-1.2.6/bin$ JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/bin/
mike@mike-thinks:~/hbase-1.2.6/bin$ ./start-hbase.sh
/home/mike/hbase-1.2.6/bin/hbase: line 412: /usr/lib/jvm/java-8-openjdk-amd64/bin//bin/java: No such file or directory
/home/mike/hbase-1.2.6/bin/hbase: line 412: /usr/lib/jvm/java-8-openjdk-amd64/bin//bin/java: No such file or directory
starting master, logging to /home/mike/hbase-1.2.6/bin/../logs/hbase-mike-master-mike-thinks.out
/home/mike/hbase-1.2.6/bin/../bin/hbase: line 412: /usr/lib/jvm/java-8-openjdk-amd64/bin//bin/java: No such file or directory
regionserver running as process 13688. Stop it first.
mike@mike-thinks:~/hbase-1.2.6/bin$ sudo kill 13688
[sudo] password for mike:
mike@mike-thinks:~/hbase-1.2.6/bin$ ./start-hbase.sh
/home/mike/hbase-1.2.6/bin/hbase: line 412: /usr/lib/jvm/java-8-openjdk-amd64/bin//bin/java: No such file or directory
/home/mike/hbase-1.2.6/bin/hbase: line 412: /usr/lib/jvm/java-8-openjdk-amd64/bin//bin/java: No such file or directory
starting master, logging to /home/mike/hbase-1.2.6/bin/../logs/hbase-mike-master-mike-thinks.out
/home/mike/hbase-1.2.6/bin/../bin/hbase: line 412: /usr/lib/jvm/java-8-openjdk-amd64/bin//bin/java: No such file or directory
starting regionserver, logging to /home/mike/hbase-1.2.6/bin/../logs/hbase-mike-1-regionserver-mike-thinks.out
/home/mike/hbase-1.2.6/bin/../bin/hbase: line 412: /usr/lib/jvm/java-8-openjdk-amd64/bin//bin/java: No such file or directory
更新后我现在有以下问题:
mike@mike-thinks:~/hbase-1.2.6/bin$ ./start-hbase.sh
/home/mike/hbase-1.2.6/bin/hbase: line 412: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin/java: Not a directory
/home/mike/hbase-1.2.6/bin/hbase: line 412: exec: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin/java: cannot execute: Not a directory
/home/mike/hbase-1.2.6/bin/hbase: line 412: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin/java: Not a directory
/home/mike/hbase-1.2.6/bin/hbase: line 412: exec: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin/java: cannot execute: Not a directory
starting master, logging to /home/mike/hbase-1.2.6/bin/../logs/hbase-mike-master-mike-thinks.out
/home/mike/hbase-1.2.6/bin/../bin/hbase: line 412: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin/java: Not a directory
/home/mike/hbase-1.2.6/bin/../bin/hbase: line 412: exec: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin/java: cannot execute: Not a directory
starting regionserver, logging to /home/mike/hbase-1.2.6/bin/../logs/hbase-mike-1-regionserver-mike-thinks.out
/home/mike/hbase-1.2.6/bin/../bin/hbase: line 412: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin/java: Not a directory
/home/mike/hbase-1.2.6/bin/../bin/hbase: line 412: exec: /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java/bin/java: cannot execute: Not a directory
这不是
JAVA_HOME
这是
请按照以下步骤操作:
JRE
从Oracle 站点下载并解压缩打开终端窗口并输入
安装后类型
从终端窗口复制下载并解压缩
JRE
到文件夹中打开文件
将此行添加到末尾
要检查
JAVA_HOME
是否设置正确,请运行此命令PS更改您的第 412 行
java-start.sh
至
(以及相同的行,如果存在)
您可以使用配置脚本专门为 HBase 定义所有环境变量
conf/hbase-env.sh
。有JAVA_HOME
设置参数的行。通常,此行已注释,但您可以取消注释并根据需要设置值。使用这种方式,您无需更改系统上的通用配置。