【问题标题】:Redis Error reading from the server: Connection reset by peer从服务器读取 Redis 错误:对等方重置连接
【发布时间】:2019-11-29 20:12:27
【问题描述】:

我想使用管道模式向redis插入一些数据。
当我运行时

cat test-TXT.txt |./redis-4.0.1/src/redis-cli -h 10.99.205.240 --pipe

我收到此错误:

从服务器读取错误:对等方重置连接

这是test-Txt.txt内容:
enter image description here
Redis.conf :

protected-mode no
bind 10.99.205.240

其他配置使用默认值。
我可以使用logstash将数据插入redis。

【问题讨论】:

    标签: redis


    【解决方案1】:

    检查您是否使用 '\r\n' 作为行分隔符。否则你可能会遇到问题。 您可以验证是否在删除 --pipe 时出错:

    cat test-TXT.txt | redis-cli -h 10.99.205.240
    

    【讨论】:

      【解决方案2】:

      与行分隔符一样,协议文本中的任何其他错误都会导致此错误 - 包括 *$ 之后的数字与实际数据相比是否错误。

      【讨论】:

        【解决方案3】:

        试试这个:

        cat test-TXT.txt; sleep 5 |./redis-4.0.1/src/redis-cli -h 10.99.205.240 --pipe
        

        可能是因为当 cat 进程完成后,它退出并导致子进程 redis-cli 也退出。所以添加 sleep 5 等待回复。

        【讨论】:

        • 这个解决方案是可行的。我没有得到任何错误。但我得到这个:所有数据都已传输。等待最后一个回复... 从服务器收到的最后一个回复。错误:0,回复:0。我没有插入任何数据。也许我在 test-TXT.txt 中得到了一些东西
        • 你用redis-cli检查过testpipemode吗?类似lrange testpipemode 0 -1
        • 是的,我在 redis-cli 上运行“llen testpipemode”,它返回“(整数)0”。我更改了 test-TXT.txt,我还更改了 test-TXT.txt 中的内容图片问题。我不知道 "" 和 "\r\n" 哪个是我应该在 test-TXT.txt 中写的?
        • 你能把这段文字分享给 github 或 gist 吗?
        • 很抱歉这么晚才回复。这是 github URL:github.com/AlexRITIAN/Redis-test-pipemod
        猜你喜欢
        • 2012-08-22
        • 2013-08-01
        • 2018-11-10
        • 1970-01-01
        • 2016-12-09
        • 1970-01-01
        • 2017-11-26
        • 1970-01-01
        • 2021-07-15
        相关资源
        最近更新 更多