This repository will include code examples and walkthroughs for the following common tasks:
Thank you to @kremrik for the helpful miniconda instructions below.
- ๐ป ย ย Local Development using Pyflink
- ๐ฆ ย ย Packaging your Pyflink Application for use with Kinesis Data Analytics for Apache Flink
- ๐ ย ย Deploying and running your Pyflink Application to Kinesis Data Analytics for Apache Flink
- ๐ ย ย Logging in a Pyflink Application, and where to see those logs in Kinesis Data Analytics for Apache Flink
- ๐ง ย ย Basic Troubleshooting and Monitoring
-
Install Miniconda with Dependencies
-
Follow the instructions here to download to your machine.
bash Miniconda3-latest-MacOSX-x86_64.sh
This is for my case, but verify yours!
-
Ensure that you prepend miniconda to your PATH, in your
.bashrc
or elsewhere:export PATH=~/miniconda3/bin:$PATH
Then type:
source ~/.bashrc
-
Verify your path has been setup correctly after sourcing your .bashrc by typing:
which python > /home/$USER/miniconda3/bin/python
-
Once installed, create a virtual environment to use for your flink environment:
conda create -n my-new-environment pip python=3.8
This creates a new conda environment with pip installed. The
pip
at the end of this documentation ensures that when runningpip install
commands, they are installed to the correct location.I've found that python 3.9 > doesn't play nicely with some of the Apache Flink dependencies, so just specify 3.8.
-
After creating your new environment, activate it by typing:
conda activate my-new-environment
Then verify that the correct pip is being used:
which pip > /home/$USER/miniconda3/envs/my-new-environment/bin/pip
Once this is set up, installing modules like
apache-flink
is as simple as typingpip install apache-flink
, which will install it into your miniconda environment.Go ahead and install apache-flink since we'll need it for the rest of this exercise.
(my-new-environment) $ pip install apache-flink==1.15.2
-
Additional Note: Please validate that you are either using Java 8 or Java 11 when running examples. There are compatibility issues with later versions of Java due to the Py4j libary calling out to the Kinesis Connector.
(my-new-environment) jdber@147dda1bd4b4 ~ % java -version
openjdk version "11.0.9.1" 2020-11-04 LTS
OpenJDK Runtime Environment Corretto-11.0.9.12.1 (build 11.0.9.1+12-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.9.12.1 (build 11.0.9.1+12-LTS, mixed mode)