Redis连接拒绝错误,但redis-cli连接并显示我在db中期望的值

时间:2017-07-26 16:54:46

标签: python flask server redis celery

我无法弄清楚这一点。我有芹菜烧瓶应用程序,并在Ubuntu 16.04上使用Redis作为代理。它在最近几天工作正常,今天它突然发出以下异常。在我的OSX上本地工作正常。在ubuntu虚拟服务器上失败。

[2017-07-26 20:12:25,512: WARNING/MainProcess] consumer: Connection to broker lost. Trying to re-establish the connection...
Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 129, in _read_from_socket
    raise socket.error(SERVER_CLOSED_CONNECTION_ERROR)
OSError: Connection closed by server.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 2165, in _execute
    return command(*args)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 577, in read_response
    response = self._parser.read_response()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 238, in read_response
    response = self._buffer.readline()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 168, in readline
    self._read_from_socket()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 143, in _read_from_socket
    (e.args,))
redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 439, in connect
    sock = self._connect()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 494, in _connect
    raise err
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 482, in _connect
    sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/celery/worker/consumer/consumer.py", line 318, in start
    blueprint.start(self)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/celery/bootsteps.py", line 119, in start
    step.start(parent)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/celery/worker/consumer/consumer.py", line 594, in start
    c.loop(*c.loop_args())
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/celery/worker/loops.py", line 88, in asynloop
    next(loop)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/kombu/async/hub.py", line 345, in create_loop
    cb(*cbargs)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/kombu/transport/redis.py", line 1039, in on_readable
    self.cycle.on_readable(fileno)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/kombu/transport/redis.py", line 337, in on_readable
    chan.handlers[type]()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/kombu/transport/redis.py", line 667, in _receive
    ret.append(self._receive_one(c))
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/kombu/transport/redis.py", line 678, in _receive_one
    response = c.parse_response()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 2183, in parse_response
    return self._execute(connection, connection.read_response)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 2172, in _execute
    connection.connect()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 442, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
[2017-07-26 20:12:25,804: ERROR/MainProcess] consumer: Cannot connect to redis://localhost:6379//: Error 111 connecting to localhost:6379. Connection refused..
Trying again in 2.00 seconds...

[2017-07-26 20:12:26,725: ERROR/PoolWorker-3] Something went wrong in async processes.
Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/tasks.py", line 66, in send_event_notification_async
    sleep(nextEventDelayInSeconds)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/common.py", line 125, in _shutdown_cleanup
    sys.exit(-(256 - signum))
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/pool.py", line 281, in exit
    return _exit()
SystemExit
[2017-07-26 20:12:26,726: ERROR/PoolWorker-4] Something went wrong in async processes.
Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/tasks.py", line 66, in send_event_notification_async
    sleep(nextEventDelayInSeconds)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/common.py", line 125, in _shutdown_cleanup
    sys.exit(-(256 - signum))
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/pool.py", line 281, in exit
    return _exit()
SystemExit
[2017-07-26 20:12:26,734: ERROR/PoolWorker-8] Something went wrong in async processes.
Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/tasks.py", line 66, in send_event_notification_async
    sleep(nextEventDelayInSeconds)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/common.py", line 125, in _shutdown_cleanup
    sys.exit(-(256 - signum))
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/billiard/pool.py", line 281, in exit
    return _exit()
SystemExit
[2017-07-26 20:12:27,729: ERROR/MainProcess] Process 'PoolWorker-6' pid:2057 exited with 'signal 15 (SIGTERM)'
[2017-07-26 20:12:27,740: ERROR/MainProcess] Process 'PoolWorker-5' pid:2055 exited with 'exitcode 15'
[2017-07-26 20:12:27,750: ERROR/MainProcess] Process 'PoolWorker-2' pid:2052 exited with 'exitcode 15'
[2017-07-26 20:12:27,761: ERROR/MainProcess] Process 'PoolWorker-1' pid:2051 exited with 'exitcode 15'
[2017-07-26 20:12:27,812: ERROR/MainProcess] Process 'PoolWorker-7' pid:2059 exited with 'exitcode 15'
[2017-07-26 20:13:27,799: ERROR/PoolWorker-3] Something went wrong in async processes.
Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 129, in _read_from_socket
    raise socket.error(SERVER_CLOSED_CONNECTION_ERROR)
OSError: Connection closed by server.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 573, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 585, in parse_response
    response = connection.read_response()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 577, in read_response
    response = self._parser.read_response()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 238, in read_response
    response = self._buffer.readline()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 168, in readline
    self._read_from_socket()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 143, in _read_from_socket
    (e.args,))
redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 439, in connect
    sock = self._connect()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 494, in _connect
    raise err
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 482, in _connect
    sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/tasks.py", line 45, in send_event_notification_async
    r.set(priority, True)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 1072, in set
    return self.execute_command('SET', *pieces)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 578, in execute_command
    connection.send_command(*args)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 563, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 538, in send_packed_command
    self.connect()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 442, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
[2017-07-26 20:13:27,800: ERROR/PoolWorker-4] Something went wrong in async processes.
Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 129, in _read_from_socket
    raise socket.error(SERVER_CLOSED_CONNECTION_ERROR)
OSError: Connection closed by server.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 573, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 585, in parse_response
    response = connection.read_response()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 577, in read_response
    response = self._parser.read_response()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 238, in read_response
    response = self._buffer.readline()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 168, in readline
    self._read_from_socket()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 143, in _read_from_socket
    (e.args,))
redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 439, in connect
    sock = self._connect()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 494, in _connect
    raise err
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 482, in _connect
    sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/tasks.py", line 45, in send_event_notification_async
    r.set(priority, True)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 1072, in set
    return self.execute_command('SET', *pieces)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 578, in execute_command
    connection.send_command(*args)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 563, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 538, in send_packed_command
    self.connect()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 442, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.
[2017-07-26 20:13:27,802: ERROR/PoolWorker-8] Something went wrong in async processes.
Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 129, in _read_from_socket
    raise socket.error(SERVER_CLOSED_CONNECTION_ERROR)
OSError: Connection closed by server.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 573, in execute_command
    return self.parse_response(connection, command_name, **options)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 585, in parse_response
    response = connection.read_response()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 577, in read_response
    response = self._parser.read_response()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 238, in read_response
    response = self._buffer.readline()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 168, in readline
    self._read_from_socket()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 143, in _read_from_socket
    (e.args,))
redis.exceptions.ConnectionError: Error while reading from socket: ('Connection closed by server.',)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 439, in connect
    sock = self._connect()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 494, in _connect
    raise err
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 482, in _connect
    sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/dsangvikar/apps/msbot/tasks.py", line 45, in send_event_notification_async
    r.set(priority, True)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 1072, in set
    return self.execute_command('SET', *pieces)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/client.py", line 578, in execute_command
    connection.send_command(*args)
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 563, in send_command
    self.send_packed_command(self.pack_command(*args))
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 538, in send_packed_command
    self.connect()
  File "/home/dsangvikar/apps/msbot/msbotenv/lib/python3.5/site-packages/redis/connection.py", line 442, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:6379. Connection refused.

我猜它会在2秒后重试并再次失败并出现相同的异常。更令人困惑的是redis-server启动并正常运行。 redis-cli ping工作。此外,我打开了redis-cli并试图获得芹菜工人应该添加的值。那些也是可以得到的。顺便说一句,我刷新服务器重启时的所有值。因此,当我重新启动服务器时,它会相应地更新值。我怎么弄清楚出了什么问题?

我没有对redis-server配置文件进行任何更改。各种方式一直运作到昨天。

编辑:令人惊讶的是我收到此错误' ConnectionRefusedError:[Errno 111]连接被拒绝'在一些陈述被执行之后。所以基本上它连接到redis db,放入值然后失败。什么?

0 个答案:

没有答案