小程序制作平台网站设计平台 互联网品牌制作专家
关于A5客户收购GoogleAdsense带有搜索账户的相关事宜更多

软文发布平台资讯中心

postgresql中的几个timeout参数用法说明

postgresql中的几个timeout参数用法说明

  项目招商找A5 快速获取精准代理名单

这篇文章主要介绍了postgresql中的几个timeout参数用法说明,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧。

今天整理了下 postgresql 几个 timeout 参数

select version(); version ---------------------------------------------------------------------------------------------------------PostgreSQL 10.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18), 64-bit(1 row)select *from pg_settings pswhere 1=1and ps.name like '%timeout%'; name | setting | unit | category | short_desc | extra_desc | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | sourcefile | sourceline | pending_restart -------------------------------------+---------+------+--------------------------------------------------------------+-------------------------------------------------------------------------------------------+-------------------------------------+-----------+---------+---------+---------+------------+----------+----------+-----------+------------+------------+-----------------archive_timeout | 0 | s | Write-Ahead Log / Archiving | Forces a switch to the next WAL file if a new file has not been started within N seconds. | | sighup | integer | default | 0 | 1073741823 | | 0 | 0 | | | fauthentication_timeout | 60 | s | Connections and Authentication / Security and Authentication | Sets the maximum allowed time to complete client authentication. | | sighup | integer | default | 1 | 600 | | 60 | 60 | | | fcheckpoint_timeout | 300 | s | Write-Ahead Log / Checkpoints | Sets the maximum time between automatic WAL checkpoints. | | sighup | integer | default | 30 | 86400 | | 300 | 300 | | | fdeadlock_timeout | 1000 | ms | Lock Management | Sets the time to wait on a lock before checking for deadlock. | | superuser | integer | default | 1 | 2147483647 | | 1000 | 1000 | | | f idle_in_transaction_session_timeout | 0 | ms | Client Connection Defaults / Statement Behavior | Sets the maximum allowed duration of any idling transaction. | A value of 0 turns off the timeout. | user | integer | default | 0 | 2147483647 | | 0 | 0 | | | flock_timeout | 0 | ms | Client Connection Defaults / Statement Behavior | Sets the maximum allowed duration of any wait for a lock. | A value of 0 turns off the timeout. | user | integer | default | 0 | 2147483647 | | 0 | 0 | | | fstatement_timeout | 0 | ms | Client Connection Defaults / Statement Behavior | Sets the maximum allowed duration of any statement. | A value of 0 turns off the timeout. | user | integer | default | 0 | 2147483647 | | 0 | 0 | | | fwal_receiver_timeout | 60000 | ms | Replication / Standby Servers | Sets the maximum wait time to receive data from the primary. | | sighup | integer | default | 0 | 2147483647 | | 60000 | 60000 | | | fwal_sender_timeout | 60000 | ms | Replication / Sending Servers | Sets the maximum time to wait for WAL replication. | | sighup | integer | default | 0 | 2147483647 | | 60000 | 60000 | | | f(9 rows)

下面简单介绍下这几个参数

archive_timeout控制服务器周期性地切换到一个新的 WAL 段文件,通俗的讲,就是定时归档。

authentication_timeout完成服务器认证的最长时间,如果在这个时间内没有完成认证,服务器将关闭连接。

checkpoint_timeout自动 WAL 检查点之间的最长时间,增大这个参数会使数据库崩溃后恢复的时间加长。

deadlock_timeout进行死锁检测之前在一个锁上等待的总时间

idle_in_transaction_session_timeout空闲事务超时。终止任何已经闲置超过这个参数所指定的时间(以毫秒计)的打开事务的会话。 这使得该会话所持有的任何锁被释放,并且其所持有的连接槽可以被重用, 它也允许只对这个事务可见的元组被清理。

lock_timeout锁等待超时。语句在试图获取表、索引、行或其他数据库对象上的锁时等到超过指定的毫秒数,该语句将被中止。不推荐在postgresql.conf中设置。

statement_timeout控制语句执行时长,单位是ms。超过设定值,该语句将被中止。

不推荐在postgresql.conf中设置,如非要设置,应该设置一个较大值。

wal_receiver_timeout中止处于非活动状态超过指定毫秒数的复制链接。这对于正在接收的后备服务器检测主服务器崩溃或网络断开有用。设置为0会禁用超时机制。这个参数只能在postgresql.conf文件中或在服务器命令行上设置。默认值是 60 秒。

wal_sender_timeout中断那些停止活动超过指定毫秒数的复制连接。这对发送服务器检测一个后备机崩溃或网络中断有用。设置为0将禁用该超时机制。这个参数只能在postgresql.conf文件中或在服务器命令行上设置。默认值是 60 秒。

补充:Postgresql数据库修改deadlock_timeout参数

某产品线提出要将Postgresql测试库中 deadlock_timeout 参数 修改为1s

该库平时不在自己手中维护,故实际操作步骤如下

(1)确定数据库安装所属用户

查看下都有哪些账户,可能是postgresql使用的

bash-4.1$ cd /homebash-4.1$ lsaquota.user enterprisedb lost+found prouser puppet

(2)确定数据库安装路径:

bash-4.1$ ps -ef | grep post 查看服务进程,找到应用安装目录 /opt/app/PostgresPlus/9.2AS/

1500 1891 1 0 2018 ? 01:01:47 /opt/app/PostgresPlus/9.2AS/bin/edb-postgres -D /DATA/data_utl

(3)切换到 enterprisedb 用户,并登陆数据库

bash-4.1$ su - enterprisedbbash-4.1$ psql -U enterprisedbpsql (9.2.14.31)Type “help” for help.

查看当前该参数配置 3s

edb=# show deadlock_timeout;

deadlock_timeout

3s(1 row)

(4)查看该参数

1pending_restart —boolean— true if the value has been changed in the configuration file but needs a restart; or false otherwise.

即该参数为实时生效型参数

(5)尝试使用

1test=# alter system set deadlock_timeout=‘1s';

报错如下:

ERROR: syntax error at or near “system”LINE 1:

alter system set deadlock_timeout=‘1s';

查询到解释:

alter system 命令 只对 9.4以后的版本 的版本有效,

(6)尝试执行

1set deadlock_timeout=‘1s'

edb=# show deadlock_timeout;

显示为1s

但是其余用户登录路,发现该参数依然为 3s

----即该方法为session级别设置,类似于oracle的alter session set

(7) 尝试修改 pg配置文件,进入/DATA/data_utl 路径修改

bash-4.1$ pwd/DATA/data_utlbash-4.1$ lsbase pgbin pg_ident.conf pg_notify pg_stat_tmp pg_twophase postgresql.conf postmaster.optsdbms_pipe pg_clog pg_log pg_serial pg_subtrans PG_VERSION postgresql.conf.20191119 postmaster.pidglobal pg_hba.conf pg_multixact pg_snapshots pg_tblspc pg_xlog postgresql.conf.bak utlp.sqlvi postgresql.conf

将其中 deadlock_timeout 配置修改为1s

(8)重新加载数据库

bash-4.1$ ./pg_ctl reloadserver signaled

(9)查看该参数已生效

edb=# show deadlock_timeout;deadlock_timeout1s(1 row)

退出

1edb=# \q

第9步也可通过重启数据库生效

停止指令:

1./pg_ctl stop -m fast

启动指令:

1./pg_ctl -D /DATA/data_utl start

文章来源:脚本之家

来源地址:https://www.jb51.net/article/204221.htm

尊敬的看官您对postgresql中的几个timeout参数用法说明有什么看法呢?互联网品牌制作专家愿与您共同探讨!版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请加微信号oem365 举报,一经查实,本站将立刻删除。

上一篇: 解决PostgreSQL执行超时的情况   返 回   下一篇:postgresql中的参数查看和修改方式

相关资讯

小程序应用场景 | 小程序解决方案 | 小程序案例 | 小程序应功能 | 软文发布资源 | 网站设计

酒店预约解决方案
酒店预约小程序走红网络,也是传统转型的重要变化
详情
投票解决方案
强大功能,傻瓜式管理,有效防止作弊刷票
详情
新零售解决方案
小程序是现在新零售的新方式,深度结合线上线下
详情
预约服务解决方案
预约到店小程序通过用户在线预约到店等
详情
企业官网解决方案
企业展示小程序主要展示企业信息、产品案例等
详情
教育培训解决方案
主要展示教育机构的课程、可在线预约与购买课程
详情
推广解决方案
可以让企业通过推广模式全面展示自己的产品
详情
到店解决方案
到店服务解决方案,主要是面向实体餐饮门店
详情

我们的服务是否能满足您的需求?

如果不能,请联系我们或给我们留言,我们收到后会第一时间联系您!感谢您对我们的关注!

粤公网安备 44200002005005号