我有以下几点:
class FooData(object):
def __init__(self):
...
try:
self.my_cnf = os.environ['HOME'] + '/.my.cnf'
self.my_cxn = mysql.connector.connect(option_files=self.my_cnf)
self.cursor = self.my_cxn.cursor(dictionary=True)
except mysql.connector.Error as err:
if err.errno == 2003:
self.my_cnf = None
self.my_cxn = None
self.cursor = None我可以使用my_cxn和cursor,没有任何明显的故障。我从未显式终止连接,并在mysql错误日志中观察到以下消息...
2017-01-08T15:16:09.355190Z 132 [Note] Aborted connection 132 to db:
'mydatabase' user: 'myusername' host: 'localhost'
(Got an error reading communication packets)我是不是走错路了?每次需要运行查询时初始化连接器和游标对我来说是否更有效率?
我需要在mysql配置中查找什么才能避免这些中断的连接?
另外,我还经常在错误日志中观察到以下消息:
2017-01-06T15:28:45.203067Z 0 [Warning] Changed limits: max_open_files: 1024
(requested 5000)
2017-01-06T15:28:45.205191Z 0 [Warning] Changed limits: table_open_cache: 431
(requested 2000)是否与上述内容相关?它意味着什么?我如何解决它?
我尝试了涉及/lib/systemd/system/mysql.service.d/limits.conf和其他配置设置的各种解决方案,但都不能正常工作。
https://stackoverflow.com/questions/41534568
复制相似问题