What is Airflow:
Airflow is a platform to programmatically author, schedule and monitor workflows. This blog contains following procedures to install airflow in ubuntu/linux machine.
- Installing system dependencies
- Installing airflow with extra packages
- Installing airflow meta database
- Mysql
- Postgres
- Installing Rabbitmq (Message broker for CeleryExecutor)
We can use RabbitMQ as a message broker if you are using Celery executor. For LocalExecutor no need to install any message brokers like Rabbitmq/Redis
1. Installing Dependency packages:
apt-get update && apt-get upgrade -y
sudo apt-get -yqq install git \python-dev \libkrb5-dev \libsasl2-dev \libssl-dev \libffi-dev \build-essential \libblas-dev \liblapack-dev \libpq-dev \python-pip \python-requests \apt-utils \curl \netcat \locales \libmysqlclient-dev \supervisorpip install --upgrade pip
2. Install Apache airflow
pip install PyYAML==3.12pip install requests==2.18.4pip install simplejson==3.12.0
pip install apache-airflow[crypto,celery,postgres,hive,hdfs,jdbc,gcp_api,rabbitmq,password,s3,mysql]==1.8.1pip install celery==3.1.17
3. Install Meta Database:
i. Install Mysql
#Installing and enable mysql serversudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password airflowd2p'sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password airflowd2p'
sudo apt-get -y install mysql-server libmysqlclient-dev
ii . Install Postgressql
# Installing and enable postgresql in systemd and starting serversudo apt-get -y install postgresql \postgresql-contribupdate-rc.d postgresql enable
service postgresql start
4. Install rabbitbq
apt-get update && apt-get upgrade -y#Install erlang - dependency package for rabbitmqsudo dpkg -i erlang-solutions_1.0_all.debsudo apt-get update#Install rabbitmq serverecho "deb https://dl.bintray.com/rabbitmq/debian xenial main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.listwget -O- https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc | sudo apt-key add -sudo apt-get update
sudo apt-get -yqq install erlang rabbitmq-server
5. Create Rabbitmq users:
#!/usr/bin/env bash#Creating airflow user, tag, virtual hostrabbitmq-plugins enable rabbitmq_managementrabbitmqctl add_user airflow_user airflow_userrabbitmqctl add_vhost airflowrabbitmqctl set_user_tags airflow_user airflow_tagrabbitmqctl set_user_tags airflow_user administrator
rabbitmqctl set_permissions -p airflow airflow_user ".*" ".*" ".*"