How to run the airflow scheduler as a daemon process?

I am new to airflow. I am trying to run the airflow scheduler as a daemon process, but this process is no longer. I configured "LocalExecutor" in the airflow.cfg file and ran the following command for the launch scheduler. (I use the google computation mechanism and access to the server via putty)

airflow scheduler --daemon --num_runs=5 --log-file=/root/airflow/logs/scheduler.log

When I run this command, the airflow scheduler starts, and I see the airflow-scheduler.pid file in the home folder with the airflow, but the process does not take longer. when I close the session in putty and reconnect the server, I cannot find the scheduler process. Am I missing something? how to run the scheduler as a daemon process?

+3
source share
2

--num-runs=5 5 . , .

, , /, .

+2

systemd upstart, :

https://github.com/apache/incubator-airflow/tree/master/scripts/systemd https://github.com/apache/incubator-airflow/tree/master/scripts/upstart

, .

systemd RedHat. ( ) /usr/lib/systemd/system airflow.conf /etc/tmpfiles.d//usr/lib/tmpfiles.d/. airflow.conf // ( 0755)

systemctl. ,

systemctl enable [service]

/etc/sysconfig/airflow. " " . SCHEDULER_RUNS.

, , systemd.

, .

/etc/sysconfig/airflow

# This file is the environment file for Airflow. Put this file in /etc/sysconfig/airflow per default
# configuration of the systemd unit files.
#
# AIRFLOW_CONFIG=
# AIRFLOW_HOME=
#
# required setting, 0 sets it to unlimited. Scheduler will get restart after every X runs
SCHEDULER_RUNS=5

/etc/tmpfiles.d/airflow.conf /usr/lib/tmpfiles.d/airflow.conf

D /run/airflow 0755 airflow airflow

/usr/lib/systemd/system/airflow-scheduler.service

[Unit]
Description=Airflow scheduler daemon
After=network.target postgresql.service mysql.service redis.service rabbitmq-server.service
Wants=postgresql.service mysql.service redis.service rabbitmq-server.service

[Service]
EnvironmentFile=/etc/sysconfig/airflow
User=airflow
Group=airflow
Type=simple
ExecStart=/bin/airflow scheduler -n ${SCHEDULER_RUNS}
KillMode=process
Restart=always
RestartSec=5s

[Install]
WantedBy=multi-user.target
+2

Source: https://habr.com/ru/post/1686582/


All Articles