当前位置:网站首页>数据库使用psql及jdbc进行远程连接,不定时自动断开的解决办法
数据库使用psql及jdbc进行远程连接,不定时自动断开的解决办法
2022-07-29 05:28:00 【马小屑】
环境
系统平台:Linux x86-64 Red Hat Enterprise Linux 7,Linux x86-64 Red Hat Enterprise Linux 6,银河麒麟U系(CPU飞腾)4
版本:4.5
症状
瀚高数据库在使用psql工具以及jdbc进行远程连接时,在经过一定时间之后报错-致命错误:terminating connection due to client no input timeout。
排查安全参数,hg_clientnoinput = 0;
问题原因
操作系统TCP相关参数设置不正确,数据库沿用操作系统配置,导致TCP保活机制未生效。
解决方案
数据库做如下配置后,问题解决:
#以下参数默认值都为0,表示延用服务器的配置情况。
tcp_keepalives_idle = '60'
tcp_keepalives_interval = '20'
tcp_keepalives_count = '10'参数相关说明:
-
tcp_keepalives_idle (integer) 规定在操作系统向客户端发送一个TCP keepalive消息后无网络活动的时间总量。 如果指定值时没有单位,则以秒为单位。值0(默认值)表示选择操作系统默认值。 指定不活动多少秒之后通过 TCP 向客户端发送一个 keepalive 消息。 0 值表示使用默认值。 这个参数只有在支持TCP_KEEPIDLE 或等效套接字选项的系统或 Windows 上才可以使用。在其他系统上,它必须为零。在通过 Unix 域套接字连接的会话中,这个参数被忽略并且总是读作零。 -
tcp_keepalives_interval (integer)
规定未被客户端确认收到的TCP keepalive消息应重新传输的时间长度。 如果指定值时没有单位,则以秒为单位。值0(默认值)表示选择操作系统默认值。 这个参数只有在支持TCP_KEEPINTVL或等效套接字选项的系统或 Windows 上才可以使用。在其他系统上,必须为零。在通过 Unix域套接字连接的会话中,这个参数被忽略并总被读作零。 -
tcp_keepalives_count (integer) 指定服务器到客户端的连接被认为中断之前可以丢失的TCP keepalive消息的数量。值0(默认值)表示选择操作系统默认值。 这个参数只有在支持TCP_KEEPCNT 或等效套接字选项的系统上才可以使用。在其他系统上,必须为零。在通过 Unix 域套接字连接的会话中,这个参数被忽略并总被读作零。 -
tcp_user_timeout (integer) 指定传输的数据在TCP连接被强制关闭之前可以保持未确认状态的时间量。 如果指定值时没有单位,则以毫秒为单位。值0(默认值)表示选择操作系统默认值。 这个参数只有在支持TCP_USER_TIMEOUT 的系统上才被支持;在其他系统上,它必须为零。 在通过Unix-domain 套接字连接的会话中,此参数将被忽略并且始终读取为零。
服务器中相关的配置信息的方法:
[[email protected] ~]# cat /proc/sys/net/ipv4/tcp_keepalive_time
[[email protected] ~]# cat /proc/sys/net/ipv4/tcp_keepalive_intvl
[[email protected] ~]# cat /proc/sys/net/ipv4/tcp_keepalive_probes边栏推荐
- greenplum企业部署
- 会话推荐中的价格偏好和兴趣偏好共同建模-论文泛读
- Mutual conversion between Base64 and file
- Joint modeling of price preference and interest preference in conversation recommendation - extensive reading of papers
- 阿里一面,给了几条SQL,问需要执行几次树搜索操作?
- Loss function -- cross entropy loss function
- MySql基础知识(高频面试题)
- Use of PDO
- Hongke shares | testing and verifying complex FPGA design (2) -- how to perform global oriented simulation in IP core
- OpenResty的核心与cosocket
猜你喜欢

OpenResty的核心与cosocket

循环神经网络RNN

Hongke share | FPGA implementation of pass through and store and forward switching delay

Condition 条件对象源码浅读

Ansible(自动化软件)

SQL developer graphical window to create database (tablespace and user)

【冷冻电镜】Relion4.0——subtomogram教程

Loss function -- cross entropy loss function

NLP-分词

矩阵分解与梯度下降
随机推荐
JMM memory model concept
5G控制面协议之N2接口
损失函数——交叉熵损失函数
AbstractQueuedSynchronizer(AQS) 之共享锁源码浅读
新同事写了几段小代码,把系统给搞崩了,被老板爆怼一顿!
N2 interface of 5g control plane protocol
AbstractQueuedSynchronizer(AQS)之 ReentrantLock 源码浅读
软件定义边界SDP
OpenResty的核心与cosocket
【CryoEM】FSC, Fourier Shell Correlation简介
Hongke shares | how to test and verify complex FPGA designs (1) -- entity or block oriented simulation
Neuralcf neural collaborative filtering network
API for using the new date class of instant
CNAME记录和A记录的区别
【冷冻电镜|论文阅读】子断层平均 M 软件解读:Multi-particle cryo-EM refinement with M
pairs和ipairs的区别
【冷冻电镜|论文阅读】A feature-guided, focused 3D signal permutation method for subtomogram averaging
Use of PDO
Hongke automation SoftPLC | Hongke kPa modk operation environment and construction steps (3) -- modk routine test
失效的访问控制