Phoenix(六)配置使用Squirrel GUI连接Phoenix

来源:互联网 发布:淘宝网民族风棉麻棉裤 编辑:程序博客网 时间:2024/06/05 10:18

1. 说明


本篇主要介绍使用Squirrel GUI客户端来连接phoenix,就像MySQL使用Navicat for MySQL,Oracle使用Pl/sql developer一样,在进行一些数据库操作的时候能够更加的直观和方便。安装过程参考官方文档,步骤稍有不同。

http://phoenix.apache.org/installation.html#SQL_Client


1. Remove prior phoenix-[version]-client.jar from the lib directory of SQuirrel
2. Start SQuirrel and add new driver to SQuirrel (Drivers -> New Driver)
3. In the “Extra Class Path” tab, add the path to the phoenix-[version-client.jar.
4. In Add Driver dialog box, set Name to Phoenix, and set the Example URL to jdbc:phoenix:localhost.
5. Press List Drivers button and org.apache.phoenix.jdbc.PhoenixDriver should be automatically populated in the Class Name textbox. Press OK to close this dialog.
6. Switch to Alias tab and create the new Alias (Aliases -> New Aliases)
7. In the dialog box, Name: any name, Driver: Phoenix, User Name: anything, Password: anything
8. Construct URL as follows: jdbc:phoenix: zookeeper quorum server. For example, to connect to a local HBase use: jdbc:phoenix:localhost
9. Press Test (which should succeed if everything is setup correctly) and press OK to close.
10. Now double click on your newly created Phoenix alias and click Connect. Now you are ready to run SQL queries against Phoenix.


2. 下载


从官网下载系统对应的安装包

http://squirrel-sql.sourceforge.net/

这里写图片描述


3. 安装


直接双击下载下来的安装包进行傻瓜式安装一路Next即可(我这里下载的安装包是jar包形式)。

这里写图片描述


4. 配置


安装好的Squirrel需要进行一些额外的配置,例如拷贝jar包和配置驱动等。

4.1 拷贝jar包


phoenix-4.2.2-client.jar拷贝到squirrel安装目录的lib目录下。

高能预警:phoenix-4.2.2-client.jar可以从Phoenix的安装目录中找到,如果是其他版本的Phoenix则替换为相应的phoenix-[version]-client.jar


4.2 启动Squirrel


进入squirrel安装目录双击squirrel-sql.bat来启动squirrel。

这里写图片描述


4.3 配置Driver


进入Drivers标签页创建新的Driver。

这里写图片描述


参数说明:


Name:phoenix(可以填写其他名称)
ExampleURL:填写HBase集群的zookeeper集群的连接信息,这里是jdbc:phoenix:192.168.187.128,192.168.187.129,192.168.187.130:2181
Website URL:这里不填写
Java Class Path:选择phoenix-4.2.2-client.jar(是否选中无所谓,只要在Java Class Path里面就行)
Class Name:org.apache.phoenix.jdbc.PhoenixDriver


4.4 配置Aliases


进入Aliases标签页创建新的Alias。

这里写图片描述


参数说明:


Name:phoenix(可以填写其他名称)
Driver:选择phoenix,即上一步创建的Driver
URL:这里就是HBase集群的zookeeper的连接ip和port
User Name:随便填写
Password:随便填写

这里可以点击Test进行连接测试

这里写图片描述


5. 使用


在Aliases标签中双击刚刚创建的phoenix打开连接。

这里写图片描述

点击SQL标签进入sql命令行界面。

这里写图片描述

编写sql语句并执行

这里写图片描述

在GUI中也可以看到表的字段、视图、索引等信息,这里就不一一叙述了。

0 0
原创粉丝点击