Run airflow process and airflow webserver as airflow user

强颜欢笑 提交于 2020-01-30 09:00:06

问题


Problem: I am setting up a Google Compute Engine VM on GCP with airflow installed on it. I am now trying to integrate airflow with systemd by following instructions on http://airflow.readthedocs.io/en/latest/configuration.html#integration-with-systemd, however it states an assumption that Airflow will run under airflow:airflow.

How can I set the airflow installation so that whenever any user on that VM runs airflow from the shell, on backend it runs as airflow user. It is similar to hive process running under hive user.

OS on VM: CentOS 7


回答1:


Have you tried actually following the directions as listed in the linked offical docs? I believe that as long as you use Airflow supplied SystemD configs all processes should start using airflow:airflow.

This happens in these two lines

Of course this is assuming you are exclusively using systemd to start the services up. If you try manually running airflow webserver it will start as your current user.




回答2:


You can configure default_impersonation in the core section of your airflow.cfg to set all tasks to run as the airflow user by default. Once that is set, you'll just need to start the airflow webserver/scheduler/workers/flower (depending on your executor/setup) as the airflow user.

That should cover all the bases, however keep in mind for tasks, that just sets the default user, it can be overridden on a per DAG or task level



来源:https://stackoverflow.com/questions/47291335/run-airflow-process-and-airflow-webserver-as-airflow-user

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!