Phoenix ,SQuirrel 与Hbase 搭建
2016-06-19 14:02
615 查看
搭建目的 : 用Hbase 用起来更像是关系型数据库 ,Hbase 本身没有select ,delete ,where 命令,键入phoenix 后可以实现该功能。
Apache 官网 地址 : http://phoenix.apache.org/installation.html
Download and expand the latest phoenix-[version]-bin.tar.
Add the phoenix-[version]-server.jar to the classpath of all HBase region server and master and remove any previous version. An easy way to do this is to copy it into the HBase lib directory (use phoenix-core-[version].jar for Phoenix 3.x)
Restart HBase.
Add the phoenix-[version]-client.jar to the classpath of any Phoenix client.
说明:
下载Hbase 一致的 Phoenix 拷贝一下文件到Hbase lib 下 :
phoenix-core-4.6.0-HBase-0.98.jar
重启Hbase 集群
Phoenix 链接Hbase 集群 需要通过zookeeper ,所有下文中的localhost ,修改成 zookeeper 所在的hostname 和端口 : bigdatasaprk:2181 (端口可省略)
Phoenix 启动客户端命令:
FAQs and take our quick start guide
here.
To execute SQL scripts from the command line, you can include a SQL file argument like this:
For more information, see the
manual.
Loading Data
In addition, you can use the bin/psql.py to load CSV data or execute SQL scripts. For example:
Other alternatives include:
Using our
map-reduce based CSV loader for bigger data sets
Mapping an existing HBase table to a Phoenix table and using theUPSERT
SELECT command to populate a new table.
Populating the table through our
UPSERT VALUES command.
phoenix-4.6.0-HBase-0.98-client.jar
phoenix-4.6.0-HBase-0.98-client-minimal.jar
phoenix-core-4.6.0-HBase-0.98.jar
URL : jdbc:phoenix: bigdatasaprk:2181
ClassName : org.apache.phoenix.jdbc.PhoenixDriver
If you’d rather use a client GUI to interact with Phoenix, download and installSQuirrel. Since Phoenix is a JDBC driver, integration with tools such as
this are seamless. Here are the setup steps necessary:
Remove prior phoenix-[oldversion]-client.jar from the lib directory of SQuirrel, copy phoenix-[newversion]-client.jar to the lib directory (newversion should be compatible with the version of the phoenix server jar used with your
HBase installation)
Start SQuirrel and add new driver to SQuirrel (Drivers -> New Driver)
In Add Driver dialog box, set Name to Phoenix, and set the Example URL to jdbc:phoenix:localhost.
Type “org.apache.phoenix.jdbc.PhoenixDriver” into the Class Name textbox and click OK to close this dialog.
Switch to Alias tab and create the new Alias (Aliases -> New Aliases)
In the dialog box, Name: any name, Driver: Phoenix, User Name: anything, Password:anything
Construct URL as follows: jdbc:phoenix: zookeeper quorum server. For example, to connect to a local HBase use: jdbc:phoenix:localhost
Press Test (which should succeed if everything is setup correctly) and press OK to close.
Now double click on your newly created Phoenix alias and click Connect. Now you are ready to run SQL queries against Phoenix.
Through SQuirrel, you can issue SQL statements in the SQL tab (create tables, insert data, run queries), and inspect table metadata in the Object tab (i.e. list tables, their columns, primary keys, and types).
Apache 官网 地址 : http://phoenix.apache.org/installation.html
Installation
To install a pre-built phoenix, use these directions:Download and expand the latest phoenix-[version]-bin.tar.
Add the phoenix-[version]-server.jar to the classpath of all HBase region server and master and remove any previous version. An easy way to do this is to copy it into the HBase lib directory (use phoenix-core-[version].jar for Phoenix 3.x)
Restart HBase.
Add the phoenix-[version]-client.jar to the classpath of any Phoenix client.
说明:
下载Hbase 一致的 Phoenix 拷贝一下文件到Hbase lib 下 :
phoenix-core-4.6.0-HBase-0.98.jar
重启Hbase 集群
Phoenix 链接Hbase 集群 需要通过zookeeper ,所有下文中的localhost ,修改成 zookeeper 所在的hostname 和端口 : bigdatasaprk:2181 (端口可省略)
Phoenix 启动客户端命令:
$ sqlline.py bigdatasaprk:2181
Getting Started
Wanted to get started quickly? Take a look at ourFAQs and take our quick start guide
here.
Command Line
A terminal interface to execute SQL from the command line is now bundled with Phoenix. To start it, execute the following from the bin directory:$ sqlline.py localhost
To execute SQL scripts from the command line, you can include a SQL file argument like this:
$ sqlline.py localhost ../examples/stock_symbol.sql
For more information, see the
manual.
Loading Data
In addition, you can use the bin/psql.py to load CSV data or execute SQL scripts. For example:
$ psql.py localhost ../examples/web_stat.sql ../examples/web_stat.csv ../examples/web_stat_queries.sql
Other alternatives include:
Using our
map-reduce based CSV loader for bigger data sets
Mapping an existing HBase table to a Phoenix table and using theUPSERT
SELECT command to populate a new table.
Populating the table through our
UPSERT VALUES command.
SQL Client:
通过SQuirrel 链接 Phoenix 与Hbase 需要拷贝 一下 : phoenix 的jar 到 SQuirrelphoenix-4.6.0-HBase-0.98-client.jar
phoenix-4.6.0-HBase-0.98-client-minimal.jar
phoenix-core-4.6.0-HBase-0.98.jar
URL : jdbc:phoenix: bigdatasaprk:2181
ClassName : org.apache.phoenix.jdbc.PhoenixDriver
If you’d rather use a client GUI to interact with Phoenix, download and installSQuirrel. Since Phoenix is a JDBC driver, integration with tools such as
this are seamless. Here are the setup steps necessary:
Remove prior phoenix-[oldversion]-client.jar from the lib directory of SQuirrel, copy phoenix-[newversion]-client.jar to the lib directory (newversion should be compatible with the version of the phoenix server jar used with your
HBase installation)
Start SQuirrel and add new driver to SQuirrel (Drivers -> New Driver)
In Add Driver dialog box, set Name to Phoenix, and set the Example URL to jdbc:phoenix:localhost.
Type “org.apache.phoenix.jdbc.PhoenixDriver” into the Class Name textbox and click OK to close this dialog.
Switch to Alias tab and create the new Alias (Aliases -> New Aliases)
In the dialog box, Name: any name, Driver: Phoenix, User Name: anything, Password:anything
Construct URL as follows: jdbc:phoenix: zookeeper quorum server. For example, to connect to a local HBase use: jdbc:phoenix:localhost
Press Test (which should succeed if everything is setup correctly) and press OK to close.
Now double click on your newly created Phoenix alias and click Connect. Now you are ready to run SQL queries against Phoenix.
Through SQuirrel, you can issue SQL statements in the SQL tab (create tables, insert data, run queries), and inspect table metadata in the Object tab (i.e. list tables, their columns, primary keys, and types).
Samples
The best place to see samples are in our unit tests under src/test/java. The ones in the endToEnd package are tests demonstrating how to use all aspects of the Phoenix JDBC driver. We also have some examples in the examples directory.相关文章推荐
- Arduino 卡片14红外遥控灯
- IOS UITableView 常见问题总结(-)
- “车城”项目问题总结之UITableView不同样式cell的运用
- build.xml
- thinkjs请求oss报错:RequestTimeTooSkewedError:
- 队列queue
- lucene query
- [LeetCode] Count Numbers with Unique Digits
- JAVA--019 GUI
- UIView 中简单的九宫格
- Arduino 卡片13自制风扇
- Arduino的程序烧录
- 应用服务器性能优化 之 消息队列(MQ:Message Queue)
- UGUI如何判断鼠标是否在UI上
- Arduino 卡片12彩灯调光台
- postgresql----数据库表约束----UNIQUE
- 妙用php中的register_shutdown_function和fastcgi_finish_request
- java基础知识:break语句和continue语句
- iOS-UIStackView浅析
- ajax调后台servlet,把返回json用vue做绑定