1 Star 0 Fork 3

Webody / ambari-flink-service

forked from lee / ambari-flink-service 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

An Ambari Service for Flink

此安装方式,会有classpath的问题,只要将复制到Flink lib目录即可解决,适合于Hadoop2.7

Centos7系统

在HDP集群上轻松安装和管理Flink的Ambari服务。 Ambari service for easily installing and managing Flink on HDP clusters. ApacheFlink是一个用于分布式流和批处理数据处理的开源平台。 Apache Flink is an open source platform for distributed stream and batch data processing 关于Flink的更多细节,以及它在今天的行业中是如何使用的,在这里可以找到。 More details on Flink and how it is being used in the industry today available here: http://flink-forward.org/?post_type=session

The Ambari service lets you easily install/compile Flink on HDP 2.5.3

  • Features:
    • By default, downloads prebuilt package of Flink 1.2, but also gives option to build the latest Flink from source instead
    • Exposes flink-conf.yaml in Ambari UI

Limitations:

  • This is not an officially supported service and is not meant to be deployed in production systems. It is only meant for testing demo/purposes
  • It does not support Ambari/HDP upgrade process and will cause upgrade problems if not removed prior to upgrade

Author: Ali Bajwa

  • Thanks to Davide Vergari for enhancing to run in clustered env
  • Thanks to Ben Harris for updating libraries to work with HDP 2.5.3

Setup

  • Download HDP 2.5 sandbox VM image (Sandbox_HDP_2.5_1_VMware.ova) from Hortonworks website
  • Import Sandbox_HDP_2.3_1_VMware.ova into VMWare and set the VM memory size to 8GB
  • Now start the VM
  • After it boots up, find the IP address of the VM and add an entry into your machines hosts file. For example:
  • 仅配置主机头,没有任何意义
192.168.191.241 sandbox.hortonworks.com sandbox    
  • Note that you will need to replace the above with the IP for your own VM

  • Connect to the VM via SSH (password hadoop)

ssh root@sandbox.hortonworks.com
  • To download the Flink service folder, run below

  • 运行以下脚本,将Ambari Stack加入flink

安装git、wget

sudo yum -y install git
VERSION=`hdp-select status hadoop-client | sed 's/hadoop-client - \([0-9]\.[0-9]\).*/\1/'`
sudo git clone https://gitee.com/sleechengn/ambari-flink-service.git  /var/lib/ambari-server/resources/stacks/HDP/$VERSION/services/FLINK   
  • Restart Ambari
#sandbox
service ambari restart

#non sandbox
sudo service ambari-server restart
  • Then you can click on 'Add Service' from the 'Actions' dropdown menu in the bottom left of the Ambari dashboard:

On bottom left -> Actions -> Add service -> check Flink server -> Next -> Next -> Change any config you like (e.g. install dir, memory sizes, num containers or values in flink-conf.yaml) -> Next -> Deploy

  • By default:

    • Container memory is 1024 MB
    • Job manager memory of 768 MB
    • Number of YARN container is 1
  • On successful deployment you will see the Flink service as part of Ambari stack and will be able to start/stop the service from here: Image

  • You can see the parameters you configured under 'Configs' tab Image

  • One benefit to wrapping the component in Ambari service is that you can now monitor/manage this service remotely via REST API

export SERVICE=FLINK
export PASSWORD=admin
export AMBARI_HOST=localhost

#detect name of cluster
output=`curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari'  http://$AMBARI_HOST:8080/api/v1/clusters`
CLUSTER=`echo $output | sed -n 's/.*"cluster_name" : "\([^\"]*\)".*/\1/p'`


#get service status
curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X GET http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE

#start service
curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Start $SERVICE via REST"}, "Body": {"ServiceInfo": {"state": "STARTED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE

#stop service
curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Stop $SERVICE via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE
  • ...and also install via Blueprint. See example here on how to deploy custom services via Blueprints

Use Flink

  • Run word count job
su flink
export HADOOP_CONF_DIR=/etc/hadoop/conf
cd /opt/flink
./bin/flink run --jobmanager yarn-cluster -yn 1 -ytm 768 -yjm 768 ./examples/batch/WordCount.jar
  • This should generate a series of word counts Image

  • Open the YARN ResourceManager UI. Notice Flink is running on YARN Image

  • Click the ApplicationMaster link to access Flink webUI Image

  • Use the History tab to review details of the job that ran: Image

  • View metrics in the Task Manager tab: Image

Other things to try

More details on Flink and how it is being used in the industry today available here: http://flink-forward.org/?post_type=session

Remove service

  • To remove the Flink service:
    • Stop the service via Ambari

    • Unregister the service

      
      

export SERVICE=FLINK export PASSWORD=admin export AMBARI_HOST=localhost #detect name of cluster output=curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' http://$AMBARI_HOST:8080/api/v1/clusters CLUSTER=echo $output | sed -n 's/.*"cluster_name" : "\([^\"]*\)".*/\1/p'

curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X DELETE http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE

#if above errors out, run below first to fully stop the service #curl -u admin:$PASSWORD -i -H 'X-Requested-By: ambari' -X PUT -d '{"RequestInfo": {"context" :"Stop $SERVICE via REST"}, "Body": {"ServiceInfo": {"state": "INSTALLED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/$CLUSTER/services/$SERVICE ```

  • Remove artifacts rm -rf /opt/flink* rm /tmp/flink.tgz

空文件

简介

取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/Webody/ambari-flink-service.git
git@gitee.com:Webody/ambari-flink-service.git
Webody
ambari-flink-service
ambari-flink-service
master

搜索帮助