Redis data export, error could not connect to Redis at Ip:port:Cannot Assign requested address workaround

Source: Internet
Author: User

Because you need to. Compare Redis data export to database data, and export data in a pipe-break connection:


/opt/$company _name/redis-3.0.5/bin/redis-cli-h $IP-P $PORT-a $PASSWORD keys \* |xargs-n 1/opt/$company _name/redis -3.0.5/bin/redis-cli-h $IP-P $PORT-a $PASSWORD get > Key.txt


During the export process, error:

Could not connect to Redis at Ip:port,cannot assign requested address.


This is because the client is frequently connected to the server, the amount of data is large, because each connection in a very short period of time, resulting in a lot of time_wait, so that the use of the port number is used, so the new connection can not bind the port, that is, "cannot assign Requestedaddress ".


The problem with the client is not the server side. Through netstat, you do see a lot of time_wait state connections.

Execute the command to modify the following 2 kernel parameters    

Sysctl-w Net.ipv4.tcp_timestamps=1 #开启对于TCP时间戳的支持, if the entry is set to 0, the following setting does not work

Fast recovery of Sysctl-w net.ipv4.tcp_tw_recycle=1 #表示开启TCP连接中TIME-wait sockets

After execution, and then execute the Export command at the beginning, no longer an error.


This article is from the Linux and networking blogs, so be sure to keep this source http://khaozi.blog.51cto.com/952782/1750786

Redis data export, error could not connect to Redis at Ip:port:Cannot Assign requested address workaround

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.