Skip to content

Instantly share code, notes, and snippets.

@gbraccialli
Created December 1, 2015 22:33
Show Gist options
  • Select an option

  • Save gbraccialli/a707dbe62fbc461aed9a to your computer and use it in GitHub Desktop.

Select an option

Save gbraccialli/a707dbe62fbc461aed9a to your computer and use it in GitHub Desktop.
sudo -u hdfs hadoop fs -mkdir /user/root
sudo -u hdfs hadoop fs -chmod -R 777 /user/root
mkdir /usr/hdp/current/hive-client/auxlib
cp /usr/hdp/current/phoenix-client/phoenix-server.jar /usr/hdp/current/hive-client/auxlib
chmod -R +x /usr/hdp/current/hive-client/auxlib/
echo "drop table if exists phoenix_test;
CREATE TABLE PHOENIX_TEST(
ID VARCHAR not null,
TEXT VARCHAR
CONSTRAINT PK PRIMARY KEY (ID)
) ;
upsert into phoenix_test values ('1', 'test1');
upsert into phoenix_test values ('2', 'test2');
" > /root/sample_phoenix_hive_p.sql
/root/phoenix.sh /root/sample_phoenix_hive_p.sql
echo "CREATE EXTERNAL TABLE PHOENIX_TEST(ID int, TEXT string)
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler'
WITH SERDEPROPERTIES ('hbase.columns.mapping' = ':key,0:TEXT')
TBLPROPERTIES ('hbase.table.name' = 'PHOENIX_TEST');" > /root/sample_phoenix_hive_h.sql
hive -f /root/sample_phoenix_hive_h.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment