---
title: "通过Phoenix使用HBase记要"
author: "tvmovie"
date: "2014-10-08T17:10:29Z"
tags: ["HBase", "phoenix"]
categories: ["数据库"]
slug: "phoenix-hbase"
draft: false
lastmod: "2014-10-08T17:15:11Z"
id: 2125374
url: "https://coffeelover.iteye.com/blog/2125374"
---

HBase 官网: [http://hbase.apache.org/](/aiwiki/Wiki.jsp?page=Pagename)  
Phoenix 官网: [http://phoenix.apache.org/](/aiwiki/Wiki.jsp?page=Pagename)

**在使用上与其他关系型数据库的主要差异如下：**  
1\. 不支持INSERT和UPDATE，统一为UPSERT;  
2\. 不支持java.sql.Statement.setQueryTimeout(int seconds);  
3\. 通过 java.sql.DatabaseMetaData.getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) 获取属性时，NULLABLE=1 表示可空，无 REMARKS 项。

4\. 表必须定义主键。

 

maven 依赖:

 

```
<dependency>
	<groupId>org.apache.phoenix</groupId>
	<artifactId>phoenix</artifactId>
	<classifier>minimal</classifier>
	<version>4.0.0-incubating</version>
	<scope>runtime</scope>
</dependency>

<dependency>
	<groupId>org.apache.hbase</groupId>
	<artifactId>hbase-server</artifactId>
	<version>0.98.1-hadoop2</version>
	<scope>runtime</scope>
</dependency>

<dependency>
	<groupId>org.apache.hbase</groupId>
	<artifactId>hbase-client</artifactId>
	<version>0.98.1-hadoop2</version>
	<scope>runtime</scope>
</dependency>
```

 

 

windows环境下 java.io.IOException: Could not locate executable null\\bin\\winutils.exe in the Hadoop  
binaries.

解决方法：

设置环境变量 hadoop.home.dir 然后在该路径下放置 bin/winutils.exe 文件