Install and configure apache flink

Download flink from
https://flink.apache.org/downloads.html
Download to hdfs home directory
Untar the file and rename the dir to flink-{version} eg: flink-1.2.0
Make the below changes to the conf file or replace the current yaml file with below
and then make the changes accordingly.
$ cd /flink-1.2.0/conf
$ cat flink-conf.yaml
################################################################################
#  Licensed to the Apache Software Foundation (ASF) under one
#  or more contributor license agreements.  See the NOTICE file
#  distributed with this work for additional information
#  regarding copyright ownership.  The ASF licenses this file
#  to you under the Apache License, Version 2.0 (the
#  "License"); you may not use this file except in compliance
#  with the License.  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
# limitations under the License.
################################################################################


#==============================================================================
# Common
#==============================================================================

# The external address of the host on which the JobManager runs and can be
# reached by the TaskManagers and any clients which want to connect. This setting
# is only used in Standalone mode and may be overwritten on the JobManager side
# by specifying the --host <hostname> parameter of the bin/jobmanager.sh executable.
# In high availability mode, if you use the bin/start-cluster.sh script and setup
# the conf/masters file, this will be taken care of automatically. Yarn/Mesos
# automatically configure the host name based on the hostname of the node where the
# JobManager runs.

#jobmanager.rpc.address: 192.168.3.150
jobmanager.rpc.address: 192.168.132.132

# The RPC port where the JobManager is reachable.

jobmanager.rpc.port: 6123


# The heap size for the JobManager JVM

jobmanager.heap.mb: 6144


# The heap size for the TaskManager JVM

taskmanager.heap.mb: 40960


# The number of task slots that each TaskManager offers. Each slot runs one parallel pipeline.

taskmanager.memory.off-heap: true

taskmanager.numberOfTaskSlots: 10

parallelization.degree.default: 10


# Specify whether TaskManager memory should be allocated when starting up (true) or when
# memory is required in the memory manager (false)

taskmanager.memory.preallocate: false

# The parallelism used for programs that did not specify and other parallelism.

parallelism.default: 1


#==============================================================================
# Web Frontend
#==============================================================================

# The address under which the web-based runtime monitor listens.
#
#jobmanager.web.address: 0.0.0.0

# The port under which the web-based runtime monitor listens.
# A value of -1 deactivates the web server.

#taskmanager.tmp.dirs: /mnt/vol2/tmp/flink-cluster-tmp-2:/mnt/vol3/tmp/flink-cluster-tmp-2:/mnt/vol4/tmp/flink-cluster-tmp-2:/mnt/vol5/tmp/flink-cluster-tmp-2:/mnt/vol6/tmp/flink-cluster-tmp-2:/mnt/vol7/tmp/flink-cluster-tmp-2:/mnt/vol8/tmp/flink-cluster-tmp-2:/mnt/vol9/tmp/flink-cluster-tmp-2:/mnt/vol10/tmp/flink-cluster-tmp-2:/mnt/vol11/tmp/flink-cluster-tmp-2:/mnt/vol12/tmp/flink-cluster-tmp-2:/mnt/vol2/tmp/flink-cluster-tmp-2_1:/mnt/vol3/tmp/flink-cluster-tmp-2_1:/mnt/vol4/tmp/flink-cluster-tmp-2_1:/mnt/vol5/tmp/flink-cluster-tmp-2_1:/mnt/vol6/tmp/flink-cluster-tmp-2_1:/mnt/vol7/tmp/flink-cluster-tmp-2_1:/mnt/vol8/tmp/flink-cluster-tmp-2_1:/mnt/vol9/tmp/flink-cluster-tmp-2_1:/mnt/vol10/tmp/flink-cluster-tmp-2_1:/mnt/vol11/tmp/flink-cluster-tmp-2_1:/mnt/vol12/tmp/flink-cluster-tmp-2_1

taskmanager.tmp.dirs: /mnt/vol2/tmp/flink-cluster-tmp-2:/mnt/vol2/tmp/flink-blobstore-tmp:/mnt/vol2/tmp/flink-blobstore-tmp-2:/mnt/vol2/tmp/flink-cluster-tmp:/mnt/vol2/tmp/flink-webclient-tmp:/mnt/vol2/tmp/flink-webclient-tmp-2:/mnt/vol2/tmp/hdfs-run-logs:/mnt/vol2/tmp/flink-cluster-tmp-2_1

jobmanager.web.port: 8081

fs.hdfs.hadoopconf: /etc/hadoop/conf

#env.java.opts: "-Djava.library.path=/opt/cloudera/parcels/CDH/lib/hadoop/lib/native/"
env.java.opts: "-Djava.library.path=/usr/hdp/2.6.5.0-292/hadoop/lib/native"

#env.java.home: /var/lib/hadoop-hdfs/jdk8/jdk1.8.0_121
env.java.home: /usr/jdk64/jdk1.8.0_112

#yarn.application-master.env.JAVA_HOME: /var/lib/hadoop-hdfs/jdk8/jdk1.8.0_121
yarn.application-master.env.JAVA_HOME: /usr/jdk64/jdk1.8.0_112

#yarn.taskmanager.env.JAVA_HOME : /var/lib/hadoop-hdfs/jdk8/jdk1.8.0_121
yarn.taskmanager.env.JAVA_HOME: /usr/jdk64/jdk1.8.0_112

akka.framesize: 256477376b

jobmanager.web.history: 100

webclient.tempdir: /mnt/vol2/tmp/flink-webclient-tmp-2

blob.storage.directory: /mnt/vol2/tmp/flink-blobstore-tmp-2

taskmanager.memory.fraction: 0.5

akka.ask.timeout: 60s

akka.client.timeout: 60s

akka.watch.heartbeat.interval: 60s

akka.watch.heartbeat.pause: 300s


# Flag to specify whether job submission is enabled from the web-based
# runtime monitor. Uncomment to disable.

#jobmanager.web.submit.enable: false


#==============================================================================
# Streaming state checkpointing
#==============================================================================

# The backend that will be used to store operator state checkpoints if
# checkpointing is enabled.
#
# Supported backends: jobmanager, filesystem, rocksdb, <class-name-of-factory>
#
#state.backend: filesystem


# Directory for storing checkpoints in a Flink-supported filesystem
# Note: State backend must be accessible from the JobManager and all TaskManagers.
# Use "hdfs://" for HDFS setups, "file://" for UNIX/POSIX-compliant file systems,
# (or any local file system under Windows), or "S3://" for S3 file system.
#
# state.backend.fs.checkpointdir: hdfs://namenode-host:port/flink-checkpoints


#==============================================================================
# Advanced
#==============================================================================

# The number of buffers for the network stack.
#
# taskmanager.network.numberOfBuffers: 2048


# Directories for temporary files.
#
# Add a delimited list for multiple directories, using the system directory
# delimiter (colon ':' on unix) or a comma, e.g.:
#     /data1/tmp:/data2/tmp:/data3/tmp
#
# Note: Each directory entry is read from and written to by a different I/O
# thread. You can include the same directory multiple times in order to create
# multiple I/O threads against that directory. This is for example relevant for
# high-throughput RAIDs.
#
# If not specified, the system-specific Java temporary directory (java.io.tmpdir
# property) is taken.
#
# taskmanager.tmp.dirs: /tmp


# Path to the Hadoop configuration directory.
#
# This configuration is used when writing into HDFS. Unless specified otherwise,
# HDFS file creation will use HDFS default settings with respect to block-size,
# replication factor, etc.
#
# You can also directly specify the paths to hdfs-default.xml and hdfs-site.xml
# via keys 'fs.hdfs.hdfsdefault' and 'fs.hdfs.hdfssite'.
#
# fs.hdfs.hadoopconf: /path/to/hadoop/conf/


#==============================================================================
# High Availability
#==============================================================================

# The list of ZooKeeper quorum peers that coordinate the high-availability
# setup. This must be a list of the form:
#
# "host1:clientPort,host2:clientPort,..." (default clientPort: 2181)
#

# high-availability: zookeeper
# high-availability.zookeeper.quorum: localhost:2181
# high-availability.zookeeper.storageDir: hdfs:///flink/ha/

# ACL options are based on https://zookeeper.apache.org/doc/r3.1.2/zookeeperProgrammers.html#sc_BuiltinACLSchemes
# It can be either "creator" (ZOO_CREATE_ALL_ACL) or "open" (ZOO_OPEN_ACL_UNSAFE)
# The default value is "open" and it can be changed to "creator" if ZK security is enabled
#
# high-availability.zookeeper.client.acl: open

#==============================================================================
# Flink Cluster Security Configuration (optional configuration)
#==============================================================================

# Kerberos authentication for various components - Hadoop, ZooKeeper, and connectors -
# may be enabled in four steps:
# 1. configure the local krb5.conf file
# 2. provide Kerberos credentials (either a keytab or a ticket cache w/ kinit)
# 3. make the credentials available to various JAAS login contexts
# 4. configure the connector to use JAAS/SASL

#security.kerberos.login.keytab: /path/to/kerberos/keytab
#security.kerberos.login.principal: flink-user
#security.kerberos.login.use-ticket-cache: true

#security.kerberos.login.contexts: Client,KafkaClient

#==============================================================================
# ZK Security Configuration (optional configuration)
#==============================================================================

# Below configurations are applicable if ZK ensemble is configured for security

# Override below configuration to provide custom ZK service name if configured
#
# zookeeper.sasl.service-name: zookeeper
Here we have only one disk: /mnt/vol2 and hence few directories created and 
if more disks available (/mnt/vol1 to /mnt/voln)then add tmp directories accordingly. 
Create the dir structure mentioned above in conf in all nodes:

mkdir -p /mnt/vol2/tmp/flink-cluster-tmp-2
mkdir -p /mnt/vol2/tmp/flink-blobstore-tmp
mkdir -p /mnt/vol2/tmp/flink-blobstore-tmp-2
mkdir -p /mnt/vol2/tmp/flink-cluster-tmp
mkdir -p /mnt/vol2/tmp/flink-webclient-tmp
mkdir -p /mnt/vol2/tmp/flink-webclient-tmp-2
mkdir -p /mnt/vol2/tmp/hdfs-run-logs
mkdir -p /mnt/vol2/tmp/flink-cluster-tmp-2_1
chown hdfs:hadoop /mnt/vol2/tmp/flink-cluster-tmp-2
chown hdfs:hadoop /mnt/vol2/tmp/flink-blobstore-tmp
chown hdfs:hadoop /mnt/vol2/tmp/flink-blobstore-tmp-2
chown hdfs:hadoop /mnt/vol2/tmp/flink-cluster-tmp
chown hdfs:hadoop /mnt/vol2/tmp/flink-webclient-tmp
chown hdfs:hadoop /mnt/vol2/tmp/flink-webclient-tmp-2
chown hdfs:hadoop /mnt/vol2/tmp/hdfs-run-logs
chown hdfs:hadoop /mnt/vol2/tmp/flink-cluster-tmp-2_1
chmod 777 /mnt/vol2/tmp/flink-cluster-tmp-2
chmod 777 /mnt/vol2/tmp/flink-blobstore-tmp
chmod 777 /mnt/vol2/tmp/flink-blobstore-tmp-2
chmod 777 /mnt/vol2/tmp/flink-cluster-tmp
chmod 777 /mnt/vol2/tmp/flink-webclient-tmp
chmod 777 /mnt/vol2/tmp/flink-webclient-tmp-2
chmod 777 /mnt/vol2/tmp/hdfs-run-logs
chmod 777 /mnt/vol2/tmp/flink-cluster-tmp-2_1
Here yarn will create the required containers for processing in each node.
Flink installation is done only in 1 node but the directories created above should
be present in all nodes where nodemanager is installed.
0 Comments

There are no comments yet

Leave a comment

Your email address will not be published. Required fields are marked *