2016-01-15 37 views
0

我有一個使用Tornado和RethinkDB在Python中構建的服務器。它已經運行了很長時間,爲每個用戶打開數據庫的幾個連接。我從來沒有遇到任何重大問題,只要將它們關閉即可。但檢查出日誌文件,我發現有很多這樣的警告:應該關閉rethinkDB中每個連接到數據庫的連接嗎?

File "/home/bundleroot/commentserver/app.py", line 30, in <module> 
     db_connection = r.connect(RDB_HOST,RDB_PORT) 
     File "/home/bundleroot/commentserver/env34/lib/python3.4/site-packages/rethinkdb/net.py", line 542, in connect 
     return conn.reconnect(timeout) 
     File "/home/bundleroot/commentserver/env34/lib/python3.4/site-packages/rethinkdb/net.py", line 475, in reconnect 
     return self._instance.connect(timeout) 
     File "/home/bundleroot/commentserver/env34/lib/python3.4/site-packages/rethinkdb/net.py", line 360, in connect 
     self._socket = SocketWrapper(self, timeout) 
     File "/home/bundleroot/commentserver/env34/lib/python3.4/site-packages/rethinkdb/net.py", line 268, in __init__ 
     (self.host, self.port, ex)) 
    rethinkdb.errors.RqlDriverError: Could not connect to localhost:28015. Error: [Errno 111] Connection refused 
    Traceback (most recent call last): 
     File "/home/bundleroot/commentserver/env34/lib/python3.4/site-packages/rethinkdb/net.py", line 244, in __init__ 
     socket.create_connection((self.host, self.port), timeout) 
     File "/usr/lib/python3.4/socket.py", line 509, in create_connection 
     raise err 
     File "/usr/lib/python3.4/socket.py", line 500, in create_connection 
     sock.connect(sa) 
    ConnectionRefusedError: [Errno 111] Connection refused 

我應該擔心它嗎?在那種情況下,有什麼好的做法?

回答