打赏

安装Phoenix时./sqlline.py执行报错File "./sqlline.py", line 27, in <module> import argparse ImportError: No module named argparse解决办法(图文详解)

   

  不多说,直接上干货!

 

  前期博客

Apache版Phoenix的安装(图文详解)

 

 

  问题现象

Traceback (most recent call last):
  File "./sqlline.py", line 27, 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.163.com
 * extras: mirrors.163.com
 * updates: mirrors.163.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package python-argparse.noarch 0:1.2.1-2.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================================================================
 Package                                            Arch                                      Version                                            Repository                               Size
===============================================================================================================================================================================================
Installing:
 python-argparse                                    noarch                                    1.2.1-2.1.el6                                      base                                     48 k

Transaction Summary
===============================================================================================================================================================================================
Install       1 Package(s)

Total download size: 48 k
Installed size: 232 k
Is this ok [y/N]: y
Downloading Packages:
python-argparse-1.2.1-2.1.el6.noarch.rpm                                                                                                                                |  48 kB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : python-argparse-1.2.1-2.1.el6.noarch                                                                                                                                        1/1 
  Verifying  : python-argparse-1.2.1-2.1.el6.noarch                                                                                                                                        1/1 

Installed:
  python-argparse.noarch 0:1.2.1-2.1.el6                                                                                                                                                       

Complete!
[root@master phoenix]# 

 

 

 

 

  然后,再重启HBase集群。

 

 

 

 

 

 

 

 

 

 

[hadoop@master apache-phoenix-4.8.2-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.2-HBase-0.98-bin/phoenix-4.8.2-HBase-0.98-client.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/app/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
17/08/22 09:02:13 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)...
86/86 (100%) Done
Done
sqlline version 1.1.9
0: jdbc:phoenix:master> 

 

 

  退出

Building list of tables and columns for tab-completion (set fastconnect to true to skip)...
86/86 (100%) Done
Done
sqlline version 1.1.9
0: jdbc:phoenix:master,slave1,slave2:2181> !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.2-HBase-0.98-bin]$ pwd
/home/hadoop/app/apache-phoenix-4.8.2-HBase-0.98-bin
[hadoop@master apache-phoenix-4.8.2-HBase-0.98-bin]$ bin/sqlline.py master,slave1,slave2:2181
Setting property: [incremental, false]
Setting property: [isolation, TRANSACTION_READ_COMMITTED]
issuing: !connect jdbc:phoenix:master,slave1,slave2:2181 none none org.apache.phoenix.jdbc.PhoenixDriver
Connecting to jdbc:phoenix:master,slave1,slave2:2181
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/hadoop/app/apache-phoenix-4.8.2-HBase-0.98-bin/phoenix-4.8.2-HBase-0.98-client.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/hadoop/app/hadoop-2.6.0/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
17/08/22 09:07:40 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)...
86/86 (100%) Done
Done
sqlline version 1.1.9
0: jdbc:phoenix:master,slave1,slave2:2181> 

 

 

  成功!

posted @ 2017-08-22 08:55  大数据和AI躺过的坑  阅读(8462)  评论(0编辑  收藏  举报