Environmental requirements:
Java version 1.6 and above
Hadoop 1.x or 2.x version
This example environment information:
Linux Version:centos Release 6.8 (Final)
Hadoop VERSION:HDP 2.4.0.0-169
Java version:jre-1.8.0-openjdk.x86_64
Download Hpl/sql installation package
: Http://www.hplsql.org/download
Upload to Linux platform when download is complete
Unzip the installation package and install to/OPT:
TAR-ZVXF hplsql-0.3.31.tar.gz-c/opt
Ln-s/opt/hplsql-0.3.31/opt/hplsql
Include the following files after decompression
? Hplsql
? Hplsql.cmd
? Hplsql-x.x.x.jar
? Hplsql-site.xml
? Antlr-runtime-4.5.jar
Modify Permissions:
Chmod +x/opt/hplsql
Configure Classpath
Cd/opt/hplsql
Vi Hplsql
If Hadoop is the CDH
Delete all the export "hadoop_classpath= ..." in the Hplsql file
Add Export "hadoop_classpath=/opt/cloudera/parcels/cdh/jars/*"
If Hadoop is the HDP
Check the/usr/hdp/x.x.x.x-x directory and modify all the export "hadoop_classpath= ..." Paths in the Hplsql file to the/usr/hdp/x.x.x.x-x corresponding path.
For other versions of Hadoop, check the/usr/lib for Hadoop jars and make the corresponding changes in the Phlsql file.
Test whether the installation was successful
/opt/hplsql–version
Cd/opt/hplsql
./hplsql–version
If the above command can return Hplsql version information, the installation is successful.
Add Hplsql to PATH variable
Export path= $PATH:/opt/hplsql
After you set the path, you can call Hpl/sql directly from the Hplsql command.
Hplsql <option>
Configuration
Cd/opt/hplsql
Vi Hplsql-site.xml
Modify
<property>
<name>hplsql.conn.init.hive2conn</name>
<value></value>
</property>
For:
<property>
<name>hplsql.conn.init.hive2conn</name>
<value>
Set Mapred.job.queue.name=dev;
Set HIVE.EXECUTION.ENGINE=MR;
Use sales_db;
</value>
</property>
Run Hpl/sql
Hplsql-e "Current_date+1"
HPLSQL-E "SELECT * from src LIMIT 1"
Hplsql-f Script.SQL
Using Hpl/sql in shell scripts
Get a value from the Hpl/sql script
mdate=$ (hplsql-e "NVL (min_partition_date (sales,local_dt,code= ' A '), ' 1970-01-01 ')")
start=$ (HPLSQL-E ' current_date–1 ')
Install Hpl/sql under Linux