尝试从sqlite db过渡到postgresql(基于此处的指南:https://www.ryanmerlin.com/2019/07/apache-airflow-installation-on-ubuntu-18-04-18-10/),并在Web服务器用户界面的初始屏幕上出现蘑菇状云错误。
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/home/airflow/.local/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)
...
...
File "/home/airflow/.local/lib/python3.6/site-packages/airflow/www/utils.py", line 93, in is_accessible
(not current_user.is_anonymous and current_user.is_superuser())
File "/home/airflow/.local/lib/python3.6/site-packages/airflow/contrib/auth/backends/password_auth.py", line 114, in is_superuser
return hasattr(self, 'user') and self.user.is_superuser()
AttributeError: 'NoneType' object has no attribute 'is_superuser'
查看网络服务器日志不会显示太多...
[airflow@airflowetl airflow]$ tail airflow-webserver.*
==> airflow-webserver.err <==
/home/airflow/.local/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
""")
==> airflow-webserver.log <==
==> airflow-webserver.out <==
[2019-12-18 10:20:36,553] {settings.py:213} INFO - settings.configure_orm(): Using pool settings. pool_size=5, max_overflow=10, pool_recycle=1800, pid=72725
==> airflow-webserver.pid <==
72745
值得注意的一件事(因为这似乎是由于某种密码问题引起的)是,在尝试切换到postgres之前,我已经根据文档(https://airflow.apache.org/docs/stable/security.html#password设置了bycrpt密码。脚本在这里:
import airflow
from airflow import models, settings
from airflow.contrib.auth.backends.password_auth import PasswordUser
user = PasswordUser(models.User())
user.username = 'airflow'
user.email = 'myemail@co.org'
user.password = 'mypasword'
session = settings.Session()
session.add(user)
session.commit()
session.close()
exit()
有人知道这里可能发生什么或如何进一步调试吗?
答案 0 :(得分:0)
重新运行我的用户/密码脚本可以解决此问题。
我认为这是从以前使用的sqllite数据库连接到对新的postgres服务器的更改。我想这是存储在气流后端数据库中的某个地方(不是气流的新手,所以不了解这些内部情况),并且由于我要切换后端,因此新后端没有此用户/身份验证信息,需要重新运行脚本才能导入气流包装并将新的用户名/密码写入其后端以能够使用密码登录(因为我的airflow.cfg
使用auth_backend = airflow.contrib.auth.backends.password_auth
)。