This topic provides answers to frequently asked questions about how to use HBase SQL (Phoenix).
What JAR packages have been released in the latest version of ali-phoenix in the Maven central repository?
- ali-phoenix 4.x dependencies:
GroupId ArtifactId Latest Version com.aliyun.phoenix ali-phoenix 4.12.0-AliHBase-1.1-0.9 com.aliyun.phoenix ali-phoenix-hive 4.12.0-AliHBase-1.1-0.9 com.aliyun.phoenix ali-phoenix-spark 4.12.0-AliHBase-1.1-0.9 com.aliyun.phoenix ali-phoenix-pherf 4.12.0-AliHBase-1.1-0.9 com.aliyun.phoenix ali-phoenix-queryserver 4.12.0-AliHBase-1.1-0.9 com.aliyun.phoenix ali-phoenix-queryserver-client 4.12.0-AliHBase-1.1-0.9 com.aliyun.phoenix ali-phoenix-pig 4.12.0-AliHBase-1.1-0.9 com.aliyun.phoenix ali-phoenix-flume 4.12.0-AliHBase-1.1-0.9 com.aliyun.phoenix ali-phoenix-core 4.12.0-AliHBase-1.1-0.9 - ali-phoenix 5.x dependencies:
GroupId ArtifactId Latest Version com.aliyun.phoenix ali-phoenix-shaded-thin-client 5.2.5-HBase-2.x com.aliyun.phoenix ali-phoenix-shaded-thin-client 5.2.5-HBase-2.x Note We recommend that you use the shaded client to avoid incompatibility issues that may occur between client and third-party dependencies.
What is the format of the ali-phoenix JDBC connection string?
- Thick client driverConnection string syntax
Connection string examplejdbc:phoenix:[[ZK_HOST1:port, ZK_HOST2:port, ZK_HOST3:port | comma-separated ZooKeeper Quorum [:port] [:hbase root znode] ]
jdbc:phoenix:localhost jdbc:phoenix:localhost:123:/hbase jdbc:phoenix:v1,v2,v3:123:/hbase jdbc:phoenix:v1:2181,v2:2181,v3:2181:/hbase jdbc:phoenix:v1:2181,v2:2181,v3:2181
- Thin client driverConnection string syntax
jdbc:phoenix:thin:[key=value[;key=value...]]
Connection string examplejdbc:phoenix:thin:url=http://localhost:8765;serialization=PROTOBUF
Does ApsaraDB for HBase support Query Server?
- ApsaraDB for HBase 1.x uses Phoenix 4.x thick clients. You must manually create a Query Server service.
- ApsaraDB for HBase 2.0 supports the HBase SQL service. By default, Query Server is enabled for ApsaraDB for HBase 2.0.
Can web applications be traced?
No, ali-phoenix in ApsaraDB for HBase does not support tracing web applications. This feature will be available soon.
What do I do if secondary indexes time out when I create a synchronization task?
<property>
<name>hbase.rpc.timeout</name>
<value>60000000</value>
</property>
<property>
<name>hbase.client.scanner.timeout.period</name>
<value>60000000</value>
</property>
<property>
<name>phoenix.query.timeoutMs</name>
<value>60000000</value>
</property>
For Phoenix 5.x in ApsaraDB for HBase 2.0, you can modify the preceding parameters in the ApsaraDB for HBase console, and then restart the HBase SQL service. Take note that you do not need to restart HBase. How do I enable namespace mapping?
- Enable namespace mapping for ali-phoenix 4.x.
- Add the following configuration to the client:
<property> <name>hbase.rpc.timeout</name> <value>60000000</value> </property> <property> <name>hbase.client.scanner.timeout.period</name> <value>60000000</value> </property> <property> <name>phoenix.query.timeoutMs</name> <value>60000000</value> </property>
- Contact the ApsaraDB for HBase Q&A group to enable this feature on the HBase server.
- Restart the HBase cluster.
- Add the following configuration to the client:
- Enable namespace mapping for ali-phoenix 5.x.
- Log on to the ApsaraDB for HBase console.
- Configure parameters.
Set the
phoenix.schema.isNamespaceMappingEnabled
andphoenix.schema.mapSystemTablesToNamespace
parameters to true. - Restart the HBase cluster.
- Restart the HBase SQL service.
Note You must configure these parameters on both thequery server
andHBase server
. Take note that the descriptions of the parameters on the two servers are different.
Are connection pools supported?
It depends. Phoenix 4.12.0.Xsupports connection pools. For more information, see PhoenixConnectionPool.java
.
Phoenix 5.x uses thin clients. You cannot use PhoenixConnectionPool.java
to create connection pools. We recommend that you use third-party connection pools, such as MyBatis. For more information, see Connection pool demo.
Can I disconnect my client if it takes too much time to create indexes?
No, you must not disconnect your client. The procedure to create an index consists of two steps. In Step 1, the server synchronizes data from source tables to index tables. In Step 2, the client sends a request to change the state of the index tables to active. Typically, in Step 1, the client sends a request to the server, and then the server processes the request.
How much time does it take to create an index table and synchronize index data?
In most cases, it takes 5 to 20 minutes to create an index on 10 million rows of data. The amount of time required depends on the specification of your cluster and the number of computing resources.
What do I do if it takes too much time to create an index and my client connection is automatically closed?
- Execute the
ALTER INDEX
statement to rebuild the index. - Delete the index table in the building state, set the client connection timeout time to a greater value, and rebuild the index.
How do I import data from a relational database to a Phoenix table in ApsaraDB for HBase?
Use DataX or CDP. for more information about DataX, visit https://github.com/alibaba/DataX.
What do I do if an error message ERROR 599(42912): Default enable Force index, please set phoenix.force.index=false to disable it....,
is returned when I query data?
The system automatically checks whether the primary key columns or index columns are used as query conditions when it compiles SQL statements. This helps avoid full table scans. If no primary key or index column is specified as a query condition, this error is returned. If you need to use a column other than the primary key or index columns as a query condition, use the following methods to resolve this issue. For Phoenix 4.x, open the client configuration file hbase-site.xml
and set phoenix.force.index
to false
. Then, restart the client. For Phoenix 5.x, set phoenix.force.index
to false
in the ApsaraDB for HBase console, and then restart the HBase SQL service.
What do I do if an error message java.sql.SQLException: java.lang.IllegalArgumentException: Connection is null or closed
is returned when I use a Druid connection pool in Spring Boot?
Phoenix caches connection information. If you add these connections to a connection pool, a connection is not removed from the pool when the connection is closed. As a result, this error message is returned when the system wants to reuse the closed connection. Therefore, we recommend that you do not use a Druid connection pool.
When I use an idle connection established between a Python client and a query server to query data, what do I do if the following error message is returned:phoenixdb.errors.InternalError: ('', None, None, None)
- Download the Alibaba Cloud phoenix-python client.
- If you have already installed the phoenix-python driver, run the following command to remove it:
rm -rf /usr/lib/python${version}/site-packages/phoenixdb*
- Decompress the downloaded package, navigate to the phoenixdb directory, and run the following command to install the driver:
python setup.py install
Does Phoenix support multitenancy?
No, Phoenix does not support multi-tenancy. Commands such as grant
and revoke
are not supported.