目前E-MapReduce的开源组件还未包含Kylin,下面介绍一种通过创建集群时设置的引导操作来完成集群上Kylin的部署。
1.引导操作shell脚本(kylin_bootstrap.sh)
入参:
参数名 | 取值 | 备注 |
---|---|---|
regionId | cn-hangzhou/cn-beijing | 创建集群所在的regionId |
isVpc | 0/1 | 创建的是否是vpc集群 |
#!/bin/bash
regionId="$1"
isVpc=$2
echo $regionId
echo $isVpc
if [ ! $regionId ]; then
regionId="cn-hangzhou"
fi
if [ ! $isVpc ]; then
isVpc=0
fi
isMaster=`hostname --fqdn | grep emr-header-1`
masterIp=`cat /etc/hosts | grep emr-header-1 | awk '{print $1}'`
bucket=""
if [[ $regionId == "cn-hangzhou" ]]; then
bucket="emr-agent-pack"
elif [[ $regionId == "cn-beijing" ]]; then
bucket="emr-bj"
elif [[ $regionId == "cn-shanghai" ]]; then
bucket="emr-public-shanghai"
elif [[ $regionId == "cn-shenzhen" ]]; then
bucket="emr-public-shenzhen"
fi
kylinpackUrl="http://emr-agent-pack.oss-cn-hangzhou-int ernal.aliyuncs.com/kylin/apache-kylin-1.6.0-hbase1.x-bin.tar.gz"
if [[ isVpc -eq 1 ]]; then
kylinpackUrl="http://$bucket.vpc100-oss-$regionId.aliyuncs.com/kylin/apache-kylin-1.6.0-hbase1.x-bin.tar.gz"
else
kylinpackUrl="http://$bucket.oss-$regionId-internal.aliyuncs.com/kylin/apache-kylin-1.6.0-hbase1.x-bin.tar.gz"
fi
cd /opt/apps
wget $kylinpackUrl
tar xvf apache-kylin-1.6.0-hbase1.x-bin.tar.gz
rm -rf /opt/apps/apache-kylin-1.6.0-hbase1.x-bin.tar.gz
chown -R hadoop:hadoop /opt/apps/apache-kylin-1.6.0-hbase1.x-bin
ln -s /opt/apps/apache-kylin-1.6.0-hbase1.x-bin /usr/lib/kylin-current
echo "export KYLIN_HOME=/usr/lib/kylin-current" >>/etc/profile.d/hadoop.sh
echo "export HIVE_CONF=/etc/emr/hive-conf" >>/etc/profile.d/hadoop.sh
echo "
if [ $isMaster ]; then
sleep 5
su -l hadoop -c '/opt/apps/apache-kylin-1.6.0-hbase1.x-bin/bin/kylin.sh start'
else
echo 'slave no need to start kylin'
fi
" >/usr/local/emr/emr-bin/script/hive/after_start.sh
2.OSS存储kylin_bootstrap.sh
将1中的kylin_bootstrap.sh脚本上传到OSS中,创建集群的时候需要从OSS中选择
3.创建E-MapReduce集群(添加引导操作)
在E-MapReduce中创建集群(必须勾选HBase
),在创建集群的基础配置
页面,点击添加引导操作
,选择2中OSS的kylin_bootstrap.sh脚本,并且根据需求填写可选参数
(即1中介绍的脚本入参),如下图所示(在深圳region创建classic集群)
)
4.验证
集群创建完成,状态显示为空闲后,打隧道到master节点,在浏览器中输http://localhost:7070/kylin
, 查看Kylin是否正常。
备注
上述创建的Kylin是非HA,只有master上面一台Kylin的webserver。
如果需要多台,则可以在slave上面启动,需要做如下操作:
1). 修改kylin.properties 详见Kylin文档
kylin.rest.servers=emr-header-1:7070,emr-worker-1:7070,emr-worker-2:7070 //比如启动了三台
kylin.server.mode=all //只要有一台配置成all,其它配置成query
2). 在slave节点启动Kylin,并重启master节点的Kylin
sudo su hadoop
/usr/lib/kylin-current/bin/kylin.sh start
3). 配置SLB负载均衡
通过阿里云的SLB负载均衡,将上述启动的所有Kylin的webserver进行负载均衡的配置,[详见SLB](https://help.aliyun.com/document_detail/27551.html?spm=5176.doc27552.6.561.90KCkd)
时间: 2024-11-08 17:27:58