Part2---Phoenix安装配置

目的:使用dbeaver连接Hbase

01.解压安装并拷贝到HBase的lib目录

(base) [root@192 phoenix-hbase-2.1-5.1.2-bin]# ls
bin  docs  examples  LICENSE  NOTICE  phoenix-client-hbase-2.1-5.1.2.jar  phoenix-pherf-5.1.2.jar  phoenix-server-hbase-2.1-5.1.2.jar
(base) [root@192 phoenix-hbase-2.1-5.1.2-bin]# pwd
/opt/phoenix-hbase-2.1-5.1.2-bin
(base) [root@192 lib]# cd $HBASE_HOME
(base) [root@192 hbase-2.1.1]# cd lib/
(base) [root@192 lib]# pwd
/opt/hbase-2.1.1/lib
(base) [root@192 lib]# cd /opt/phoenix-hbase-2.1-5.1.2-bin
(base) [root@192 phoenix-hbase-2.1-5.1.2-bin]# cp phoenix-client-hbase-2.1-5.1.2.jar /opt/hbase-2.1.1/lib/
(base) [root@192 phoenix-hbase-2.1-5.1.2-bin]# cd /opt/hbase-2.1.1/lib
(base) [root@192 lib]# find phoen*
phoenix-client-hbase-2.1-5.1.2.jar

02.配置环境变量

export PHOENIX_HOME=/opt/phoenix-hbase-2.1-5.1.2-bin
export PHOENIX_CLASSPATH=$PHOENIX_HOME
export PATH=$PATH:$PHOENIX_HOME/bin

03.启动phoenix,重启Hbase,但一直连接不上

(base) [root@192 bin]# ./sqlline.py
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect -p driver org.apache.phoenix.jdbc.PhoenixDriver -p user "none" -p password "none" "jdbc:phoenix:"
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/phoenix-hbase-2.1-5.1.2-bin/phoenix-client-hbase-2.1-5.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop-2.7.7/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Connecting to jdbc:phoenix:
22/04/12 21:09:15 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

04.拷贝另一个jar试试

(base) [root@192 lib]# cd /opt/phoenix-hbase-2.1-5.1.2-bin
(base) [root@192 phoenix-hbase-2.1-5.1.2-bin]# ls
bin  docs  examples  LICENSE  NOTICE  phoenix-client-hbase-2.1-5.1.2.jar  phoenix-pherf-5.1.2.jar  phoenix-server-hbase-2.1-5.1.2.jar
(base) [root@192 phoenix-hbase-2.1-5.1.2-bin]# cp phoenix-server-hbase-2.1-5.1.2.jar /opt/hbase-2.1.1/lib
(base) [root@192 phoenix-hbase-2.1-5.1.2-bin]# cd /opt/hbase-2.1.1/lib
(base) [root@192 lib]# find phoe*
phoenix-client-hbase-2.1-5.1.2.jar
phoenix-server-hbase-2.1-5.1.2.jar

05.重启之后还是无休止的等待

​ 将hbase/conf/hbase-site.xml 复制到phoenix中的bin/目录下,并cat一下看看内容

(base) [root@192 bin]# pwd
/opt/phoenix-hbase-2.1-5.1.2-bin/bin
(base) [root@192 bin]# cd $HBASE_HOME
(base) [root@192 hbase-2.1.1]# cd conf/
(base) [root@192 conf]# ls
hadoop-metrics2-hbase.properties  hbase-env.cmd  hbase-env.sh  hbase-policy.xml  hbase-site.xml  log4j.properties  regionservers
(base) [root@192 conf]# cp hbase-site.xml /opt/phoenix-hbase-2.1-5.1.2-bin/bin/
cp:是否覆盖"/opt/phoenix-hbase-2.1-5.1.2-bin/bin/hbase-site.xml"? y
(base) [root@192 conf]# cp hbase-site.xml /opt/phoenix-hbase-2.1-5.1.2-bin/bin/
cp:是否覆盖"/opt/phoenix-hbase-2.1-5.1.2-bin/bin/hbase-site.xml"? y
(base) [root@192 conf]# cd /opt/phoenix-hbase-2.1-5.1.2-bin/bin
(base) [root@192 bin]# cat hbase-site.xml

06.再次重启Hbase,还是卡住

(base) [root@192 bin]# ./sqlline.py 192.168.1.10:2181
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect -p driver org.apache.phoenix.jdbc.PhoenixDriver -p user "none" -p password "none" "jdbc:phoenix:192.168.1.10:2181"
SLF4J: Found binding in [jar:file:/opt/phoenix-hbase-2.1-5.1.2-bin/phoenix-client-hbase-2.1-5.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop-2.7.7/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Connecting to jdbc:phoenix:192.168.1.10:2181
22/04/12 21:45:41 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable

07.关闭Hbase,删除zookeeperk信息,结果还是不行

[zk: localhost:2181(CONNECTED) 0] ls /
[cluster, controller_epoch, controller, brokers, zookeeper, admin, isr_change_notification, consumers, log_dir_event_notification, latest_producer_id_block, config, hbase]
[zk: localhost:2181(CONNECTED) 1] rmr /hbase
[zk: localhost:2181(CONNECTED) 2] ls /
[cluster, controller_epoch, controller, brokers, zookeeper, admin, isr_change_notification, consumers, log_dir_event_notification, latest_producer_id_block, config]

08.关闭Hbase出现问题

(base) [root@192 bin]# ./stop-hbase.sh
no hbase master found
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hbase-2.1.1/lib/phoenix-client-hbase-2.1-5.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hbase-2.1.1/lib/client-facing-thirdparty/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]

09.怀疑是HBase 的 pid 文件默认存放路径为 /tmp 路径,因为可能被操作系统删除,系统找不到 HBase 的进程号

(base) [root@192 conf]# vim hbase-env.sh

添加:

export HBASE_PID_DIR=/opt/hbase-2.1.1/pids

10.重启Hbase发现HMaster没有启动,再去删除zookeeper信息

[cluster, controller_epoch, controller, brokers, zookeeper, admin, isr_change_notification, consumers, log_dir_event_notification, latest_producer_id_block, config, hbase]
[zk: localhost:2181(CONNECTED) 2] rmr /hbase
[zk: localhost:2181(CONNECTED) 3] ls /
[cluster, controller_epoch, controller, brokers, zookeeper, admin, isr_change_notification, consumers, log_dir_event_notification, latest_producer_id_block, config]
[zk: localhost:2181(CONNECTED) 4]

11.再次启动Hbase,之后HMaster已启动

(base) [root@192 bin]# jps
7744 HMaster
7827 HRegionServer
4406 SecondaryNameNode
5320 QuorumPeerMain
4025 NameNode
8009 Kafka
4890 NodeManager
4587 ResourceManager
4189 DataNode
8094 Jps
5151 RunJar

12.打开hbase shell测试一下,不能用

hbase(main):001:0> status

ERROR: KeeperErrorCode = NoNode for /hbase/master

For usage try 'help "status"'

Took 8.2306 seconds

13.删除Hbase上最开始的jar包:phoenix-client-hbase-2.1-5.1.2.jar启动,成功可以使用Hbase

(base) [root@192 bin]# hbase shell
HBase Shell
Use "help" to get list of supported commands.
Use "exit" to quit this interactive shell.
For Reference, please visit: http://hbase.apache.org/2.0/book.html#shell
Version 2.1.1, rb60a92d6864ef27295027f5961cb46f9162d7637, Fri Oct 26 19:27:03 PDT 2018
Took 0.0055 seconds
hbase(main):001:0> status
1 active master, 0 backup masters, 1 servers, 0 dead, 3.0000 average load
Took 0.3938 seconds
hbase(main):002:0>

14.再次启动phoenix试试

hbase(main):003:0> (base) [root@192 bin]# cd $PHOENIX_HOME
(base) [root@192 phoenix-hbase-2.1-5.1.2-bin]# ls
bin  docs  examples  LICENSE  NOTICE  phoenix-client-hbase-2.1-5.1.2.jar  phoenix-pherf-5.1.2.jar  phoenix-server-hbase-2.1-5.1.2.jar
(base) [root@192 phoenix-hbase-2.1-5.1.2-bin]# cd bin/
(base) [root@192 bin]# ls
argparse-1.4.0  hadoop-metrics2-hbase.properties    hbase-site.xml    pherf-standalone.py  __pycache__  traceserver.py
daemon.py       hadoop-metrics2-phoenix.properties  log4j.properties  phoenix_utils.py     readme.txt
end2endTest.py  hbase-omid-client-config.yml        performance.py    psql.py              sqlline.py
(base) [root@192 bin]# ./sqlline.py 192.168.1.10:2181
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect -p driver org.apache.phoenix.jdbc.PhoenixDriver -p user "none" -p password "none" "jdbc:phoenix:192.168.1.10:2181"
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/phoenix-hbase-2.1-5.1.2-bin/phoenix-client-hbase-2.1-5.1.2.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/opt/hadoop-2.7.7/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Connecting to jdbc:phoenix:192.168.1.10:2181
22/04/12 22:42:01 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Connected to: Phoenix (version 5.1)
Driver: PhoenixEmbeddedDriver (version 5.1)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
sqlline version 1.9.0
0: jdbc:phoenix:192.168.1.10:2181>

image-20220412224731708

15.使用拷贝下来的jar包在dbeaver上配置

17.编辑驱动详情新增内容

phoenix.schema.isNamespaceMappingEnabled  true
phoenix.schema.mapSystemTablesToNamespace  true

image-20220412232644420

18.再次连接出现如下情况:

image-20220412232726459

19.之后还是不行,指定jdk后出现映射命名空间问题,我明明没有使用映射

20.删除前面17步骤的内容,更改为固定IP

image-20220412235526878

21.最后连接上了hbase

image-20220412235605366

22.但是打开没有任何的表可以查看

​ 这下面找到类,但是还是没有表

image-20220413002444927

23.拉取hbase-site.xml,放在jar中,生成新的jar

添加上17删除的内容,修改dbeaver.ini文件如下

-vm
E:\javawin\bin
-startup
plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.400.v20211117-0650
-vmargs
-XX:+IgnoreUnrecognizedVMOptions
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Xms64m
-Xmx1024m
-Djavax.net.ssl.trustStoreType=WINDOWS-ROOT
-Ddbeaver.distribution.type=exe

24.打开dbeaver,结果版本不够

image-20220413012021195

25.那我们在装一个Java,先不配置环境变量试试,先来个17版本的

image-20220413012606076

26.dbeaver.ini修改如下:

-vm
D:\javatmpv17\bin
-startup
plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.400.v20211117-0650
-vmargs
-XX:+IgnoreUnrecognizedVMOptions
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Xms64m
-Xmx1024m
-Djavax.net.ssl.trustStoreType=WINDOWS-ROOT
-Ddbeaver.distribution.type=exe

27.新的问题又出现了,一直加载不出来,想起17版本应该是没有jre,它找不到

image-20220413013121897

28.但我就是不想再装一个版本的jdk,那就改变dbeaver吧

把自带的jre压缩备份一下,准备删除它,万一崩了还有得救

image-20220413015044941

29.放自己的jre会报错,新增hbase-site.xml

​ 还原jre,还原dbeaver.ini文件


        <property>
                <name>phoenix.schema.isNamespaceMappingEnabled</name>
                <value>false</value>
        </property>
        <property>
                <name>phoenix.schema.mapSystemTablesToNamespace</name>
                <value>false</value>
        </property>

30.在dbeaver中取消下面或者改为false

phoenix.schema.isNamespaceMappingEnabled  true
phoenix.schema.mapSystemTablesToNamespace  true

​ 最终结果:

image-20220413065807578

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值