Linux下R语言和HBase连接(一)

删除线格式 R语言和HBase连接,通过查找资料得到信息是要启动HBase的Thrift Server,另外安装R的机器需要安装thrift-0.8.0.tar和rhbase_1.2.1.tar

将两个软件放到R的路径后解压并编译后,就安装成功了(make编译的时间长,需要等待。第一次发现编译时间长以为宕机了,第二次下载了thrift-0.8.0.tar发现并不是),但是启动HBase时,遇到了新的问题。如下:

[root@hadoop1 bin]# ./hbase-daemon.sh start thrift
++
| Error: JAVA_HOME is not set |
±---------------------------------------------------------------------+
| Please download the latest Sun JDK from the Sun Java web site |
| > http://www.oracle.com/technetwork/java/javase/downloads |
| |
| HBase requires Java 1.7 or later. |
+
+
上面来看,是java路径没有进行设置,通过查找得到解决的方法是:先查找java的安装路径

[root@hadoop1 bin]#  whereis java
java: /usr/bin/java /usr/lib/java /etc/java /usr/share/java /usr/share/man/man1/java.1.gz
[root@hadoop1 bin]# vi /etc/profile
[root@hadoop1 bin]# source /etc/profile
[root@hadoop1 bin]# echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64/jre/bin/java

在li nux下,如何找java的安装路径

han@ubuntu:/etc$ whereis java
java: /usr/bin/java /usr/share/java /usr/lib/jvm/java-8-openjdk-amd64/bin/java /usr/share/man/man1/java.1.gz
han@ubuntu:/etc$ ls -lrt /usr/bin/java
lrwxrwxrwx 1 root root 22 4月   2 15:54 /usr/bin/java -> /etc/alternatives/java
han@ubuntu:/etc$ ls -lrt /etc/alternatives/java
lrwxrwxrwx 1 root root 46 4月   2 15:54 /etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

然后编辑/etc/profilewen文件,在文件末尾添加

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

然后,运行

source /etc/profile

查看JAVA_HOME环境变量

han@ubuntu:/etc$ echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64

配置好后,即可运行

[root@hadoop1 bin]# ./hbase-daemon.sh start thrift
+======================================================================+
|                    Error: JAVA_HOME is not set                       |
+----------------------------------------------------------------------+
| Please download the latest Sun JDK from the Sun Java web site        |
|     > http://www.oracle.com/technetwork/java/javase/downloads        |
|                                                                      |
| HBase requires Java 1.7 or later.                                    |
+======================================================================+
[root@hadoop1 bin]# source /etc/profile
[root@hadoop1 bin]# ./hbase-daemon.sh start thrift
starting thrift, logging to /usr/lib/ams-hbase/bin/../logs/hbase-root-thrift-hadoop1.out
[root@hadoop1 bin]# 

猜你喜欢

转载自blog.csdn.net/tandelin/article/details/87176394