不多说,直接上干货!
前期博客
Apache版Phoenix的安装(图文详解)
问题现象
Traceback (most recent call last):
File "./sqlline.py", line , in <module>
import argparse
ImportError: No module named argparse
解决办法
[root@master phoenix]# yum install python-argparse
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors..com
* extras: mirrors..com
* updates: mirrors..com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-argparse.noarch :1.2.-2.1.el6 will be installed
--> Finished Dependency Resolution Dependencies Resolved ===============================================================================================================================================================================================
Package Arch Version Repository Size
===============================================================================================================================================================================================
Installing:
python-argparse noarch 1.2.-2.1.el6 base k Transaction Summary
===============================================================================================================================================================================================
Install Package(s) Total download size: k
Installed size: k
Is this ok [y/N]: y
Downloading Packages:
python-argparse-1.2.-2.1.el6.noarch.rpm | kB :
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : python-argparse-1.2.-2.1.el6.noarch /
Verifying : python-argparse-1.2.-2.1.el6.noarch / Installed:
python-argparse.noarch :1.2.-2.1.el6 Complete!
[root@master phoenix]#
然后,再重启HBase集群。
[hadoop@master apache-phoenix-4.8.-HBase-0.98-bin]$ bin/sqlline.py master
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect jdbc:phoenix:master none none org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:master
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/app/apache-phoenix-4.8.-HBase-0.98-bin/phoenix-4.8.-HBase-0.98-client.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/app/hadoop-2.6./share/hadoop/common/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
// :: WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Connected to: Phoenix (version 4.8)
Driver: PhoenixEmbeddedDriver (version 4.8)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true to skip)...
/ (%) Done
Done
sqlline version 1.1.
: jdbc:phoenix:master>
退出
Building list of tables and columns for tab-completion (set fastconnect to true to skip)...
/ (%) Done
Done
sqlline version 1.1.
: jdbc:phoenix:master,slave1,slave2:> !exit
Closing: org.apache.phoenix.jdbc.PhoenixConnection
[hadoop@master phoenix]$
这里,建议搭建,你若如跟我一样(master、slave1和slave2)集群的话,zookeeper也是都安装在master、slave1和slave2上,则
使用 sqlline.py 脚本来启动,参数是 zookeeper 集群中各个节点的 hostname ,多个使用逗号隔开,另外端口为 2181
[hadoop@master apache-phoenix-4.8.-HBase-0.98-bin]$ pwd
/home/hadoop/app/apache-phoenix-4.8.-HBase-0.98-bin
[hadoop@master apache-phoenix-4.8.-HBase-0.98-bin]$ bin/sqlline.py master,slave1,slave2:
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect jdbc:phoenix:master,slave1,slave2: none none org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:master,slave1,slave2:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/app/apache-phoenix-4.8.-HBase-0.98-bin/phoenix-4.8.-HBase-0.98-client.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/app/hadoop-2.6./share/hadoop/common/lib/slf4j-log4j12-1.7..jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
// :: WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Connected to: Phoenix (version 4.8)
Driver: PhoenixEmbeddedDriver (version 4.8)
Autocommit status: true
Transaction isolation: TRANSACTION_READ_COMMITTED
Building list of tables and columns for tab-completion (set fastconnect to true to skip)...
/ (%) Done
Done
sqlline version 1.1.
: jdbc:phoenix:master,slave1,slave2:>
成功!