Part2 - Phoenix Installation Configuration

Purpose: Connect Hbase using dbeaver

01. Unzip the installation and copy to the lib directory of HBase

(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. Configure environment variables

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

03.Start phoenix, restart Hbase, but never connect

(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. Try copying another 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. Wait endlessly after restart

Will hbase/conf/hbase-site. Copy the XML to the bin/directory in phoenix and cat to see the contents

(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: Whether to Overwrite"/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: Whether to Overwrite"/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. Restart Hbase again or get stuck

(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. Close Hbase, delete zookeeperk information, result is still not good

[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. Problem closing 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. It is suspected that the default storage path for pid files of HBase is / tmp, because it may be deleted by the operating system, the system cannot find the process number of HBase

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

Add to:

export HBASE_PID_DIR=/opt/hbase-2.1.1/pids

10. Restart Hbase to find that HMaster is not started, and then delete zookeeper information

[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. Start Hbase again, then HMaster has started

(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. Open the hbase shell to test, it cannot be used

hbase(main):001:0> status

ERROR: KeeperErrorCode = NoNode for /hbase/master

For usage try 'help "status"'

Took 8.2306 seconds

13. Delete the original jar package on Hbase: phoenix-client-hbase-2.1-5.1.2.jar started, Hbase can be used successfully

(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. Start phoenix again to try

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>

15. Configure on dbeaver using copied jar packages

17. Edit Driver Details New

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

18. Reconnection occurs as follows:

19. Not after that. There was a mapping namespace problem after specifying jdk. I clearly did not use mapping

20. Delete the previous 17 steps and change to fixed IP

21. Finally connected to hbase

22. But open without any tables to view

The class is found below, but there are no tables

23. Pull hbase-site.xml, put in jar, generate a new jar

Add the last 17 deletions and modify dbeaver. The INI file is as follows

-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. Opening dbeaver resulted in insufficient version

25. So we're installing a Java, try without configuring environment variables first, and then a 17-version version version

26.dbeaver.ini is modified as follows:

-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. A new problem has arisen and has not been able to load it. Remembering that version 17 should have no jre, it cannot be found

28. But I just don't want to install another version of jdk, so change dbeaver

Take a compressed backup of your own jre and prepare to delete it, in case it crashes it will be saved

29.Putting your own jre will make a mistake, adding hbase-site.xml

Restore jre, restore dbeaver.ini file

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

30. Cancel the following or change to false in dbeaver

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

Final result:

  </property>
    <property>
            <name>phoenix.schema.mapSystemTablesToNamespace</name>
            <value>false</value>
    </property>
30.stay dbeaver Cancel the following or change to false

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

​	The end result:

![image-20220413065807578](https://img-blog.csdnimg.cn/img_convert/1c05ca5b270a275087c31929a1ffcb2e.png)

Tags: HBase phoenix

Posted by DonnieDarko on Sun, 17 Apr 2022 01:51:25 +0930