Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I restart airflow webserver?

I am using airflow for my data pipeline project. I have configured my project in airflow and start the airflow server as a backend process using following command

airflow webserver -p 8080 -D True 

Server running successfully in backend. Now I want to enable authentication in airflow and done configuration changes in airflow.cfg, but authentication functionality is not reflected in server. when I stop and start airflow server in my local machine it works.

So How can I restart my daemon airflow webserver process in my server??

like image 388
MJK Avatar asked Aug 22 '16 07:08

MJK


People also ask

How do I start Airflow on web server?

Create a init script and use the command "daemon" to run this as service. Show activity on this post. You can use a ready-made AMI (namely, LightningFLow) from AWS Marketplace which provides Airflow services (webserver, scheduler, worker) which are enabled at startup.

How do I close Airflow on webserver?

If you run Airflow locally and start it with the two commands airflow scheduler and airflow webserver , then those processes will run in the foreground. So, simply hitting Ctrl-C for each of them should terminate them and all their child processes.

How do I know if my Airflow is running?

To check the health status of your Airflow instance, you can simply access the endpoint "/health" . It will return a JSON object in which a high-level glance is provided. The status of each component can be either “healthy” or “unhealthy”.

How to do start/stop/restart actions on an airflow service?

You can do start/stop/restartactions on an Airflow service and the commands used for each service are given below: Run sudomonit<action>schedulerfor Airflow Scheduler. Run sudomonit<action>webserverfor Airflow Webserver. Run sudomonit<action>workerfor Celery workers. A stopoperation gracefully shuts down existing workers.

How do I configure airflow to secure my webserver?

This topic describes how to configure Airflow to secure your webserver. Using Airflow in a web frame is enabled by default. To disable this (and prevent click jacking attacks) set the below: Variable values that are deemed “sensitive” based on the variable name will be masked in the UI automatically. See Masking sensitive data for more details.

How to start the airflow server as backend process?

I have configured my project in airflow and start the airflow server as a backend process using following command airflow webserver -p 8080 -D True Server running successfully in backend.

How to run airflow on localhost?

Start airflow webserver in a new terminal window That’s it. Now if you go to your web browser at localhost:8080, you will be able to see the Airflow UI loaded with many examples. You can trigger some of the DAGs, and it will run on your local machine. Referencing the example DAGs will help in developing a new one.


1 Answers

I advice running airflow in a robust way, with auto-recovery with systemd
so you can do:
- to start systemctl start airflow
- to stop systemctl stop airflow
- to restart systemctl restart airflow
For this you'll need a systemd 'unit' file. As a (working) example you can use the following:
put it in /lib/systemd/system/airflow.service

[Unit] Description=Airflow webserver daemon After=network.target postgresql.service mysql.service redis.service rabbitmq-server.service Wants=postgresql.service mysql.service redis.service rabbitmq-server.service [Service] PIDFile=/run/airflow/webserver.pid EnvironmentFile=/home/airflow/airflow.env User=airflow Group=airflow Type=simple ExecStart=/bin/bash -c 'export AIRFLOW_HOME=/home/airflow ; airflow webserver --pid /run/airflow/webserver.pid' ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID Restart=on-failure RestartSec=42s PrivateTmp=true [Install] WantedBy=multi-user.target 

P.S: change AIRFLOW_HOME to where your airflow folder with the config

like image 132
Vlad Lyga Avatar answered Sep 20 '22 07:09

Vlad Lyga