Skip to content

Google Compute Engine设置

译者:flink.sojb.cn

本文档提供了有关如何在Google Compute Engine群集上使用Hadoop 1或Hadoop 2完全自动设置Flink的说明。这是通过Google的bdutil实现的,它启动了一个集群并使用Hadoop部署了Flink。要开始使用,请按照以下步骤 算子操作。

先决条件

译者:flink.sojb.cn

安装Google Cloud SDK

请按照有关如何设置Google Cloud SDK的说明进行 算子操作。特别是,请务必使用以下命令对Google Cloud进行身份验证:

gcloud auth login 

安装bdutil

目前,尚未发布包含Flink扩展的bdutil版本。但是,您可以从GitHub获得Flink支持的最新版本的bdutil :

git clone https://github.com/GoogleCloudPlatform/bdutil.git 

下载源后,切换到新创建的bdutil目录并继续执行后续步骤。

在Google Compute Engine上部署Flink

译者:flink.sojb.cn

设置一个桶

如果尚未这样做,请为bdutil配置和暂存文件创建一个存储桶。可以使用gsutil创建一个新存储桶:

gsutil mb gs://<bucket_name> 

调整bdutil配置

要使用bdutil部署Flink,请至少调整bdutil_env.sh中的以下变量。

CONFIGBUCKET="<bucket_name>"
PROJECT="<compute_engine_project_name>"
NUM_WORKERS=<number_of_workers>

# set this to 'n1-standard-2' if you're using the free trial

> 译者:[flink.sojb.cn](https://flink.sojb.cn/)  

GCE_MACHINE_TYPE="<gce_machine_type>"

# for example: "europe-west1-d"

> 译者:[flink.sojb.cn](https://flink.sojb.cn/)  

GCE_ZONE="<gce_zone>" 

bdutil的Flink扩展为您处理配置。您可以另外调整配置变量extensions/flink/flink_env.sh。如果您想进一步配置,请查看配置Flink。使用bin/stop-cluster和更改其配置后,您将不得不重新启动Flink bin/start-cluster

要在Google Compute Engine上显示Flink群集,请执行:

./bdutil -e extensions/flink/flink_env.sh deploy 
./bdutil shell
cd /home/hadoop/flink-install/bin
./flink run ../examples/batch/WordCount.jar gs://dataflow-samples/shakespeare/othello.txt gs://<bucket_name>/output 

关闭群集

关闭集群就像执行一样简单

./bdutil -e extensions/flink/flink_env.sh delete 

我们一直在努力

apachecn/AiLearning

【布客】中文翻译组