To enable global indexing and (optionally) local indexing in Apache 3Phoenix, complete the following steps.
Add the following property to the hbase-site.xml file on all HBase nodes, the Master Server, and all Region servers, to prevent deadlocks from occurring during maintenance on global indexes:
</property> <name>hbase.region.server.rpc.scheduler.factory.class</name> <value>org.apache.phoenix.hbase.index.ipc. PhoenixIndexRpcSchedulerFactory</value> <description>Factory to create the Phoenix RPC Scheduler that knows to put index updates into index queues</description> </property>
(Optional) To use local indexing, set the following two properties. These properties ensure colocation of data table and local index regions:
Note The local indexing feature is a technical preview and considered under development. Do not use this feature in your production systems. If you have questions regarding this feature, contact Support by logging a case on our Hortonworks Support Portal at http://hortonworks.com/support/.
</property> <name>hbase.master.loadbalancer.class</name> <value>org.apache.phoenix.hbase.index.balancer.IndexLoadBalancer</value> </property> </property> <name>hbase.coprocessor.master.classes</name> <value>org.apache.phoenix.hbase.index.master.IndexMasterObserver</value> </property>
Restart the HBase Master and Region Servers.
Replace the client jar file before connecting the new Phoenix client to the Phoenix cluster:
Navigate to /usr/hdp/current
Copy the contents of the phoenix-client directory into the phoenix-client-upgrade directory:
cp -r phoenix-client phoenix-client-upgrade
Download the special 2.2 migration jar file, phoenix-4.2.0.2.2.0.0-2041-client.jar, and copy it into the phoenix-client-upgrade folder:
cp ~/phoenix-4.2.0.2.2.0.0-2041-client.jar /usr/hdp/current/phoenix-client-upgrade/phoenix-4.2.0.2.2.0.0-2041-client.jar
Navigate to the phoenix-client-upgrade directory. Start sqlline as follows:
./bin/sqlline.py <zookeeper_quorum>
where zookeeper_quorum is the connection string to Phoenix, such as localhost:2181:/hbase-unsecure
When the command finishes, you should see a message similar to the following: Connected to: Phoenix (version 4.2)
Driver: PhoenixEmbeddedDriver (version 4.2) Autocommit status: true Transaction isolation: TRANSACTION_READ_COMMITTED Building list of tables and columns for tab-completion (set fastconnect to true to skip)... 71/71 (100%) Done Done sqlline version 1.1.2 0: jdbc:phoenix:localhost>
Exit sqline shell:
!quit
Configuring Phoenix to Run in a Secure Cluster
Perform the following additional steps to configure Phoenix to run in a secure Hadoop cluster:
To link the HBase configuration file with the Phoenix libraries:
ln -sf HBASE_CONFIG_DIR/hbase-site.xml PHOENIX_HOME/bin/hbase-site.xml
To link the Hadoop configuration file with the Phoenix libraries:
ln -sf HADOOP_CONFIG_DIR/core-site.xml PHOENIX_HOME/bin/core-site.xml
Note | |
---|---|
When running the pssql.py and sqlline.py Phoenix scripts in secure mode, you can safely ignore the following warnings. |
14/04/19 00:56:24 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable 14/04/19 00:56:24 WARN util.DynamicClassLoader: Failed to identify the fs of dir hdfs://<HOSTNAME>:8020/apps/hbase/data/lib, ignored java.io.IOException: No FileSystem for scheme: hdfs