通过Phoenix使用HBase记要
HBase 官网: http://hbase.apache.org/
Phoenix 官网: http://phoenix.apache.org/
在使用上与其他关系型数据库的主要差异如下:
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 文件