Install Kylin on AWS EMR
Many users run Hadoop on public Cloud like AWS today. Apache Kylin, compiled with standard Hadoop/HBase API, support most main stream Hadoop releases; The current version Kylin v2.2, supports AWS EMR 5.0 to 5.10. This document introduces how to run Kylin on EMR.
Recommended Version
- AWS EMR 5.7 (for EMR 5.8 and above, please check KYLIN-3129)
- Apache Kylin v2.2.0 or above for HBase 1.x
Start EMR cluster
Launch an EMR cluser with AWS web console, command line or API. Select "HBase" in the applications as Kylin need HBase service.
You can select "HDFS" or "S3" as the storage for HBase, depending on whether you need Cube data be persisted after shutting down the cluster. EMR HDFS uses the local disk of EC2 instances, which will erase the data when cluster is stopped, then Kylin metadata and Cube data can be lost.
If you use "S3" as HBase's storage, you need customize its configuration for "hbase.rpc.timeout", because the bulk load to S3 is a copy operation, when data size is huge, HBase region server need wait much longer to finish than on HDFS.
[ {
"Classification": "hbase-site",
"Properties": {
"hbase.rpc.timeout": "3600000",
"hbase.rootdir": "s3://yourbucket/EMRROOT"
}
},
{
"Classification": "hbase",
"Properties": {
"hbase.emr.storageMode": "s3"
}
}
]
Install Kylin
When EMR cluser is in "Waiting" status, you can SSH into its master node, download Kylin and then uncompress the tar ball:
sudo mkdir /usr/local/kylin
sudo chown hadoop /usr/local/kylin
cd /usr/local/kylin
wget http://www-us.apache.org/dist/kylin/apache-kylin-2.2.0/apache-kylin-2.2.0-bin-hbase1x.tar.gz
tar –zxvf apache-kylin-2.2.0-bin-hbase1x.tar.gz
Configure Kylin
Before start Kylin, you need do a couple of configurations:
- Copy "hbase.zookeeper.quorum" property from /etc/hbase/conf/hbase-site.xml to $KYLIN_HOME/conf/kylin_job_conf.xml, like this:
<property>
<name>hbase.zookeeper.quorum</name>
<value>ip-nn-nn-nn-nn.ap-northeast-2.compute.internal</value>
</property>
- Use HDFS as "kylin.env.hdfs-working-dir" (Recommended)
EMR recommends to "use HDFS for intermediate data storage while the cluster is running and Amazon S3 only to input the initial data and output the final results". Kylin's 'hdfs-working-dir' is for putting the intermediate data for Cube building, cuboid files and also some metadata files (like dictionary and table snapshots which are not good in HBase); so it is best to configure HDFS for this.
If using HDFS as Kylin working directory, you just leave configurations unchanged as EMR's default FS is HDFS:
kylin.env.hdfs-working-dir=/kylin
Before you shutdown/restart the cluster, you must backup the "/kylin" data on HDFS to S3 with S3DistCp, or you may lost data and couldn't recover the cluster later.
- Use S3 as "kylin.env.hdfs-working-dir"
If you want to use S3 as storage (assume HBase is also on S3), you need configure the following parameters:
kylin.env.hdfs-working-dir=s3://yourbucket/kylin
kylin.storage.hbase.cluster-fs=s3://yourbucket
kylin.source.hive.redistribute-flat-table=false
The intermediate file and the HFile will all be written to S3. The build performance would be slower than HDFS. Make sure you have a good understanding about the difference between S3 and HDFS. Read the following articles from AWS:
Input and Output Errors Are you having trouble loading data to or from Amazon S3 into Hive
- Hadoop configurations
Some Hadoop configurations need be applied for better performance and data consistency on S3, according to emr-troubleshoot-errors-io
<property>
<name>io.file.buffer.size</name>
<value>65536</value>
</property>
<property>
<name>mapred.map.tasks.speculative.execution</name>
<value>false</value>
</property>
<property>
<name>mapred.reduce.tasks.speculative.execution</name>
<value>false</value>
</property>
<property>
<name>mapreduce.map.speculative</name>
<value>false</value>
</property>
<property>
<name>mapreduce.reduce.speculative</name>
<value>false</value>
</property>
- Create the working-dir folder if it doesn't exist
hadoop fs -mkdir /kylin
or
hadoop fs -mkdir s3://yourbucket/kylin