码迷,mamicode.com
首页 > 数据库 > 详细

postgresql远程连接中断的处理

时间:2015-02-06 00:36:22      阅读:360      评论:0      收藏:0      [点我收藏+]

标签:

在网络上连接远程服务器postgresql时,不活动时间稍长就会自动断开连接,不利于操作。
琢磨了一下,服务器上使用以下网络配置时,解决了这个问题。
 
#man 7 tcp
 
net.ipv4.tcp_keepalive_time = 600
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 15
 
同时要注意postgresql.conf中以下几项设置:
#tcp_keepalives_idle = 0                # TCP_KEEPIDLE, in seconds; 0 selects the system default
#tcp_keepalives_interval = 0            # TCP_KEEPINTVL, in seconds;0 selects the system default
#tcp_keepalives_count = 0               # TCP_KEEPCNT;0 selects the system default
 
 
系统是debian7,默认的超时设置太长,而外网网络状况不佳,所以导致这种问题。
这个配置的思路是让pg更频繁地发出探测数据包来保持tcp连接。

postgresql远程连接中断的处理

标签:

原文地址:http://www.cnblogs.com/inside/p/4276152.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!