当前位置:网站首页>数据库使用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边栏推荐
- 偏向锁、轻量级锁测试工具类级相关命令
- 5G控制面协议之N2接口
- How to use SFTP command to access SFTP server on the development board
- Hongke share | bring you a comprehensive understanding of "can bus error" (I) -- can bus error and error frame
- MySQL:当你CRUD时BufferPool中发生了什么?十张图就能说清楚
- 【备忘】关于ssh为什么会失败的原因总结?下次记得来找。
- Introduction to OSPF theory
- Analysis of four isolation levels of MySQL things
- Ansible(自动化软件)
- Hongke share | FPGA implementation of pass through and store and forward switching delay
猜你喜欢

如何优雅的写 Controller 层代码?

循环神经网络RNN

Hongke automation SoftPLC | Hongke kPa modk operation environment and construction steps (2) -- modk operation environment construction

Using STP spanning tree protocol to solve the problem of two-layer loop in network

VMware虚拟机在物理机win10系统下如何连接外网

apisix健康检查测试

MySQL:当你CRUD时BufferPool中发生了什么?十张图就能说清楚

Ping principle

为什么5G N2接口控制面使用SCTP协议?

CNN convolutional neural network
随机推荐
ping 原理
Instruction rearrangement under multithreading concurrency
AbstractQueuedSynchronizer(AQS)之 ReentrantLock 源码浅读
JMM memory model concept
NLP word segmentation
AbstractQueuedSynchronizer(AQS) 之共享锁源码浅读
The latest pycharm2018 cracking tutorial
数据库持久化+JDBC数据库连接
API for using the new date class of instant
5G服务化接口和参考点
吴恩达老师机器学习课程笔记 00 写在前面
NLP-分词
【论文阅读 | 冷冻电镜】RELION 4.0 中新的 subtomogram averaging 方法解读
吴恩达老师机器学习课程笔记 03 线性代数回顾
吴恩达老师机器学习课程笔记 05 Octave教程
Hongke shares | testing and verifying complex FPGA design (2) -- how to perform global oriented simulation in IP core
Hongke education you want to enter the field of TSN? Hongke teaches you how to build TSN test system
Let the computer run only one program setting
将源码包转换为rpm包
Loss function -- cross entropy loss function