简体   繁体   English

如何在Airflow Scheduler中解决DB连接无效警告?

[英]How to resolve DB connection invalidated warning in Airflow Scheduler?

I am upgrading our Airflow instance from 1.9 to 1.10.3 and whenever the scheduler runs now I get a warning that the database connection has been invalidated and it's trying to reconnect. 我正在将我的Airflow实例从1.9升级到1.10.3,并且每当调度程序现在运行时,我都会收到一条警告,指出数据库连接已失效,并且它正在尝试重新连接。 A bunch of these errors show up in a row. 一堆这些错误连续出现。 The console also indicates that tasks are being scheduled but if I check the database nothing is ever being written. 控制台还指示正在安排任务,但如果我检查数据库,则不会写入任何内容。

The following warning shows up where it didn't before 以下警告显示之前没有的位置

[2019-05-21 17:29:26,017] {sqlalchemy.py:81} WARNING - DB connection invalidated. Reconnecting...

Eventually, I'll also get this error 最终,我也会得到这个错误

FATAL: remaining connection slots are reserved for non-replication superuser connections

I've tried to increase the SQL Alchemy pool size setting in airflow.cfg but that had no effect 我试图在airflow.cfg增加SQL Alchemy池大小设置但是没有效果

# The SqlAlchemy pool size is the maximum number of database connections in the pool.
sql_alchemy_pool_size = 10

I'm using CeleryExecutor and I'm thinking that maybe the number of workers is overloading the database connections. 我正在使用CeleryExecutor,我想也许工人数量正在超载数据库连接。

I run three commands, airflow webserver , airflow scheduler , and airflow worker , so there should only be one worker and I don't see why that would overload the database. 我运行三个命令, airflow webserverairflow schedulerairflow worker ,因此应该只有一个工作人员,我不明白为什么会使数据库超载。

How do I resolve the database connection errors? 如何解决数据库连接错误? Is there a setting to increase the number of database connections, if so where is it? 是否有设置来增加数据库连接的数量,如果是这样的话呢? Do I need to handle the workers differently? 我需要以不同的方式处理工人吗?


Update: 更新:

Even with no workers running, starting the webserver and scheduler fresh, when the scheduler fills up the airflow pools the DB connection warning starts to appear. 即使没有工作人员正在运行,启动Web服务器和调度程序,当调度程序填满气流池时,DB连接警告也会开始出现。


Update 2: 更新2:

I found the following issue in the Airflow Jira: https://issues.apache.org/jira/browse/AIRFLOW-4567 我在Airflow Jira中发现了以下问题: https//issues.apache.org/jira/browse/AIRFLOW-4567

There is some activity with others saying they see the same issue. 有些活动与其他人说他们看到同样的问题。 It is unclear whether this directly causes the crashes that some people are seeing or whether this is just an annoying cosmetic log. 目前还不清楚这是否会直接导致某些人看到的崩溃,或者这只是一个烦人的化妆品日志。 As of yet there is no resolution to this problem. 到目前为止,还没有解决这个问题的方法。

This has been resolved in the latest version of Airflow, 1.10.4 这已在最新版本的Airflow 1.10.4中得到解决

I believe it was fixed by AIRFLOW-4332 , updating SQLAlchemy to a newer version. 我相信它是由AIRFLOW-4332修复的,将SQLAlchemy更新为更新的版本。

Pull request 拉请求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM