如何重新启动气流Web服务器? [英] 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
服务器在后端成功运行。现在,我想在气流中启用身份验证,并在airflow.cfg中完成配置更改,但是身份验证功能未反映在服务器中。当我在本地计算机上停止并启动气流服务器时,它可以工作。
那么如何重新启动服务器中的守护进程气流Web服务器进程?
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??
推荐答案
我建议以强健的方式运行气流,并使用systemd
进行自动恢复,因此您可以执行以下操作:
-启动 systemctl启动气流
-停止 systemctl停止气流
-重新启动 systemctl重新启动气流
为此,您需要一个systemd'unit'文件。
作为一个(有效的)示例,您可以使用以下命令:
将其放入/lib/systemd/system/airflow.service
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
PS:使用配置将AIRFLOW_HOME更改为您的气流文件夹
P.S: change AIRFLOW_HOME to where your airflow folder with the config
这篇关于如何重新启动气流Web服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!