python - Redis Error 8 connecting localhost:6379. nodename nor servname provided, or not known -
my environment mac os 10.9.2, python3.3, redis-2.6.9 (64-bit).
i have many threads (nealy 2000) use same redis instance write data, threads throw following exceptions:
during handling of above exception, exception occurred: traceback (most recent call last): file "/usr/local/lib/python3.3/site-packages/redis/connection.py", line 250, in connect sock = self._connect() file "/usr/local/lib/python3.3/site-packages/redis/connection.py", line 268, in _connect self.socket_timeout) file "/usr/local/cellar/python3/3.3.4/frameworks/python.framework/versions/3.3/lib/python3.3/socket.py", line 417, in create_connecti on res in getaddrinfo(host, port, 0, sock_stream): socket.gaierror: [errno 8] nodename nor servname provided, or not known traceback (most recent call last): file "/usr/local/cellar/python3/3.3.4/frameworks/python.framework/versions/3.3/lib/python3.3/threading.py", line 901, in _bootstrap_i nner self.run() file "/usr/local/cellar/python3/3.3.4/frameworks/python.framework/versions/3.3/lib/python3.3/threading.py", line 858, in run self._target(*self._args, **self._kwargs) file "proxypool.py", line 289, in _efficiency_proxy self.rdb.zadd(db_proxy, time_delay, proxy) file "/usr/local/lib/python3.3/site-packages/redis/client.py", line 1345, in zadd return self.execute_command('zadd', name, *pieces) file "/usr/local/lib/python3.3/site-packages/redis/client.py", line 464, in execute_command connection.send_command(*args) file "/usr/local/lib/python3.3/site-packages/redis/connection.py", line 334, in send_command self.send_packed_command(self.pack_command(*args)) file "/usr/local/lib/python3.3/site-packages/redis/connection.py", line 316, in send_packed_command self.connect() file "/usr/local/lib/python3.3/site-packages/redis/connection.py", line 253, in connect raise connectionerror(self._error_message(e)) redis.exceptions.connectionerror: error 8 connecting localhost:6379. nodename nor servname provided, or not known.
is there way solve problem?
tried connect redis server when exception happens , use ulimit -n
set larger number, 2 methods don't work.
i know why happened. it's caused max number of connections redis-server , it's related max number of file handlers os sets.
if set:
$ ulimit -n 1024
it works.
Comments
Post a Comment