我正在尝试使用systemd设置气流。通常,当我使用屏幕进行操作时,一切都可以正常运行。但是,当我启动服务service airflow-worker start
时,出现以下错误。
Mar 02 08:52:57 IP systemd[1]: Started Airflow celery worker daemon.
Mar 02 08:52:57 IP airflow[16162]: [2019-03-02 08:52:57,489] {settings.py:174} INFO - settings.configure_orm(): Using pool settings. pool_size=5, pool_recycle=1800, pid=16162
Mar 02 08:52:57 IP airflow[16162]: [2019-03-02 08:52:57,969] {__init__.py:51} INFO - Using executor CeleryExecutor
Mar 02 08:52:58 IP airflow[16162]: Traceback (most recent call last):
Mar 02 08:52:58 IP airflow[16162]: File "/bin/airflow", line 32, in <module>
Mar 02 08:52:58 IP airflow[16162]: args.func(args)
Mar 02 08:52:58 IP airflow[16162]: File "/home/ubuntu/.local/lib/python2.7/site-packages/airflow/utils/cli.py", line 74, in wrapper
Mar 02 08:52:58 IP airflow[16162]: return f(*args, **kwargs)
Mar 02 08:52:58 IP airflow[16162]: File "/home/ubuntu/.local/lib/python2.7/site-packages/airflow/bin/cli.py", line 1066, in worker
Mar 02 08:52:58 IP airflow[16162]: sp = subprocess.Popen(['airflow', 'serve_logs'], env=env, close_fds=True)
Mar 02 08:52:58 IP airflow[16162]: File "/usr/lib/python2.7/subprocess.py", line 394, in __init__
Mar 02 08:52:58 IP airflow[16162]: errread, errwrite)
Mar 02 08:52:58 IP airflow[16162]: File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
Mar 02 08:52:58 IP airflow[16162]: raise child_exception
Mar 02 08:52:58 IP airflow[16162]: OSError: [Errno 20] Not a directory
Mar 02 08:52:58 IP systemd[1]: airflow-worker.service: Main process exited, code=exited, status=1/FAILURE
Mar 02 08:52:58 IP systemd[1]: airflow-worker.service: Failed with result 'exit-code'.
以下是我启动服务的顺序:
service airflow-webserver start
service airflow-worker start
service airflow-scheduler start
service airflow-flower start
我正在参考以下文档。 http://site.clairvoyantsoft.com/installing-and-configuring-apache-airflow/
P.S:rabbitmq和Postgres在后台运行良好。
答案 0 :(得分:0)
我能够通过以下操作解决我的问题:
在vim /etc/sysconfig/airflow
添加了环境变量
AIRFLOW_CONFIG=/home/ubuntu/airflow/airflow.cfg
AIRFLOW_HOME=/home/ubuntu/airflow
PATH=/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/ubuntu/.local/bin/