我们正试图通过redis-py包将大小为2.3GB的腌制对象设置为redis。遇到以下错误。
BrokenPipeError:[Errno 32]管道破损
redis.exceptions.ConnectionError:写入套接字时出错104。连接由同行重置。
我想了解根本原因。是由于服务器端或客户端的输入/输出缓冲区限制?是否由于RESP协议的任何限制?是否允许将2.3 Gb的单个值(字节)存储到Redis中?
导入redis
r = redis.StrictRedis(host = '10 .X.X.X',port = 7000,db = 0)
pickled_object = pickle.dumps(obj_to_be_pickled)
r.set('some_key',pickled_object)
客户端错误
BrokenPipeError:[Errno 32]管道破损
/usr/local/lib/python3.4/site-packages/redis/connection.py(544)send_packed_command()
self._sock.sendall(项目)
服务器端错误
31164:M 04 Apr 06:02:42.334 - 来自客户端的协议错误:id = 95 addr = 10.2.130.144:36120 fd = 11 name = age = 0 idle = 0 flags = N db = 0 sub = 0 psub = 0 multi = -1 qbuf = 16384 qbuf-free = 16384 obl = 42 oll = 0 omem = 0 events = r cmd = NULL
31164:M 04 Apr 06:07:09.591 - 来自客户端的协议错误:id = 96 addr = 10.2.130.144:36139 fd = 11 name = age = 9 idle = 0 flags = N db = 0 sub = 0 psub = 0 multi = -1 qbuf = 40 qbuf-free = 32728 obl = 42 oll = 0 omem = 0 events = r cmd = NULL
Redis版本:3.2.8 / 64位
答案 0 :(得分:1)
的Redis'字符串数据类型最多为512MB。
答案 1 :(得分:1)
问题在于将数据大小传递给Redis。该命令被发送到Redis,因为RESP标准
之后有两个项目项目#1
b'*3\r\n$3\r\nSET\r\n$8\r\nsome_key\r\n$2460086692\r\n'
Where
*3 - indicates RESP array of three elements
\r\n - indicates the RESP Carriage return Line Feeder(separator)
$3 - indicates Bulk string of length 3 bytes(here it is 'SET')
$8 - indicates Bulk String of length 8 bytes(he it is 'some_key')
$2460086692 - indicates Bulk String of length 2460086692 bytes (the length of value 2460 MB to be passed to Redis as next item )
项目#2
b'\x80\x03csklearn.ensemble.forest\nRandomForestC...
Here item #2 indicates the actual data