flink1.12安装并配置ha

1.下载安装包,解压

# https://flink.apache.org/downloads.html
tar zxvf     *.tax.gz
# scala下载 解压 配置  vim  /etc/profile
https://www.scala-lang.org/download/
export SCALA_HOME=/usr/local/scala-2.12.13
PATH=$SCALA_HOME/bin:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HIVE_HOME/bin:$HBASE_HOME/bin:$SPARK_HOME/bin:$STORM_HOME/bin:$SQOOP_HOME/bin:$KYLIN_HOME/bin:$ALLUXIO_HOME/bin:$FLINK_HOME/bin:$IMPALA_HOME/bin:$OOZIE_HOME/bin:$PRESTO_HOME/bin:$SLIDER_HOME/bin:$KUDU_HOME/bin:$PATH

2.配置ha
https://ci.apache.org/projects/flink/flink-docs-release-1.12/deployment/ha/zookeeper_ha.html
Example configuration
Configure high availability mode and ZooKeeper quorum in conf/flink-conf.yaml:

high-availability: zookeeper
high-availability.zookeeper.quorum: localhost:2181
high-availability.zookeeper.path.root: /flink
#high-availability.cluster-id: /cluster_one # important: customize per cluster ,on yarn不配置
high-availability.storageDir: hdfs:///flink/recovery

3.测试

./bin/flink run-application -t yarn-application ./examples/streaming/TopSpeedWindowing.jar
./bin/flink run-application -t yarn-application ./examples/batch/WordCount.jar

Application Mode
Application Mode will launch a Flink cluster on YARN, where the main() method of the application jar gets executed on the JobManager in YARN. The cluster will shut down as soon as the application has finished. You can manually stop the cluster using yarn application -kill or by cancelling the Flink job.

./bin/flink run-application -t yarn-application ./examples/streaming/TopSpeedWindowing.jar

Once an Application Mode cluster is deployed, you can interact with it for operations like cancelling or taking a savepoint.

List running job on the cluster

./bin/flink list -t yarn-application -Dyarn.application.id=application_XXXX_YY

Cancel running job

./bin/flink cancel -t yarn-application -Dyarn.application.id=application_XXXX_YY <jobId>

Note that cancelling your job on an Application Cluster will stop the cluster.
To unlock the full potential of the application mode, consider using it with the yarn.provided.lib.dirs configuration option and pre-upload your application jar to a location accessible by all nodes in your cluster. In this case, the command could look like:

./bin/flink run-application -t yarn-application \
	-Dyarn.provided.lib.dirs="hdfs://myhdfs/my-remote-flink-dist-dir" \
	hdfs://myhdfs/jars/my-application.jar

The above will allow the job submission to be extra lightweight as the needed Flink jars and the application jar are going to be picked up by the specified remote locations rather than be shipped to the cluster by the client.

在yarn ui 看任务运行状态

Guess you like

Origin blog.csdn.net/qq_27474277/article/details/114365025