小编Yog*_*ogi的帖子

PostgreSQL | 剩余的连接槽保留用于非复制超级用户连接

我在 PostgreSQL 实例之一收到错误“剩余连接槽为非复制超级用户连接保留”。

但是,当我从超级用户运行以下查询以检查可用连接时,我发现有足够的可用连接。但仍然得到同样的错误。

select max_conn,used,res_for_super,max_conn-used-res_for_super 
res_for_normal 
from 
  (select count(*) used from pg_stat_activity) t1,
  (select setting::int res_for_super from pg_settings where 
name='superuser_reserved_connections') t2,
  (select setting::int max_conn from pg_settings where name='max_connections') t3
Run Code Online (Sandbox Code Playgroud)

输出

在此处输入图片说明

我搜索了这个错误,每个人都建议像下面的链接一样增加最大连接数。 Heroku“psql:致命:剩余的连接槽是为非复制超级用户连接保留的”

编辑

我重新启动了服务器,一段时间后使用的连接数接近 210,但我能够从普通用户连接到服务器。

postgresql postgresql-9.6

18
推荐指数
1
解决办法
9791
查看次数

将AWS RDS Postgresql复制到本地Postgresql

我需要将数据从AWS RDS Postgres(9.6)数据库复制到本地Postgres(9.5)数据库。我发现了有关从本地复制到本地的内容。但是,我们如何才能将其实现到AWS RDS本地?

postgresql replication database-replication

6
推荐指数
2
解决办法
3624
查看次数

PostgreSQL PITR 无法正常工作

我正在尝试将 PostgreSQL 数据库恢复到某个时间点。

当我仅使用restore_commandrecovery.conf,它工作正常。

restore_command = 'cp /var/lib/pgsql/pg_log_archive/%f %p'
Run Code Online (Sandbox Code Playgroud)

当我使用时recovery_target_time parameter,它没有恢复到目标时间。

restore_command = 'cp /var/lib/pgsql/pg_log_archive/%f %p'
recovery_target_time='2018-06-05 06:43:00.0'
Run Code Online (Sandbox Code Playgroud)

以下是日志文件内容:

2018-06-05 07:31:39.166 UTC [22512] LOG:  database system was interrupted; last known up at 2018-06-05 06:35:52 UTC
2018-06-05 07:31:39.664 UTC [22512] LOG:  starting point-in-time recovery to 2018-06-05 06:43:00+00
2018-06-05 07:31:39.671 UTC [22512] LOG:  restored log file "00000005.history" from archive
2018-06-05 07:31:39.769 UTC [22512] LOG:  restored log file "00000005000000020000008F" from archive
2018-06-05 07:31:39.816 UTC [22512] LOG:  redo …
Run Code Online (Sandbox Code Playgroud)

postgresql postgresql-9.6 pitr

5
推荐指数
1
解决办法
1627
查看次数

PostgreSQL | 设备上没有剩余空间

在PostgreSQL数据库上运行批处理时遇到空间问题。

但是,df -h命令显示计算机有足够的空间

在此处输入图片说明

以下是确切的错误

org.springframework.dao.DataAccessResourceFailureException: PreparedStatementCallback; SQL [INSERT into BATCH_JOB_INSTANCE(JOB_INSTANCE_ID, JOB_NAME, JOB_KEY, VERSION) values (?, ?, ?, ?)]; ERROR: could not extend file "base/16388/16452": No space left on device
  Hint: Check free disk space.
Run Code Online (Sandbox Code Playgroud)

是什么导致此问题?

编辑

postgres数据目录为 /var/opt/rh/rh-postgresql96/lib/pgsql/data

df -h /var/opt/rh/rh-postgresql96/lib/pgsql/data
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda2      100G   63G   38G  63% /
Run Code Online (Sandbox Code Playgroud)

postgresql database-administration postgresql-9.6

4
推荐指数
1
解决办法
8332
查看次数

PostgreSQL 错误:进程仍在等待数据库 0 的关系 2676 上的 AccessShareLock

我们无法连接到 PostgreSQL 实例,我们必须重新启动 PostgreSQL 服务才能连接到该实例,但几天后我们开始收到相同的错误。

日志显示以下错误

2019-02-18 08:00:03.043 UTC [5053] postgres@utilitydbLOG:  process 5053 still waiting for AccessShareLock on relation 2676 of database 0 after 1000.431 ms
2019-02-18 08:04:04.486 UTC [5170] bucardo@bucardoLOG:  process 5170 still waiting for AccessShareLock on relation 2676 of database 0 after 1001.006 ms
2019-02-18 08:15:02.802 UTC [5445] postgres@utilitydbLOG:  process 5445 still waiting for AccessShareLock on relation 2676 of database 0 after 1000.425 ms
2019-02-18 08:30:02.844 UTC [5846] postgres@utilitydbLOG:  process 5846 still waiting for AccessShareLock on relation 2676 …
Run Code Online (Sandbox Code Playgroud)

database postgresql database-locking postgresql-9.6

1
推荐指数
1
解决办法
2952
查看次数

PostgreSQL SSL 中客户端证书的要求

我是 DBA 角色的新手,第一次设置 SSL。我在本文的帮助下创建了一个密钥并生成了一个用于使用 openssl 进行测试的证书。本文说还要为客户端生成密钥和证书。我已经生成了它并针对本地服务器进行了测试。

我们有一个测试 aws rds 实例,我已经下载了此链接中提供的 RDS 证书。我可以使用以下命令连接到 rds 实例,而无需使用任何客户端密钥/证书。

psql -h somehost.rds.amazonaws.com -p 5432     "dbname=test user=testuser sslrootcert=rds-ca-2019-root.pem sslmode=verify-full"
Run Code Online (Sandbox Code Playgroud)

但是,如果我不指定 sslrootcert 那么我会收到以下错误

psql: root certificate file "/root/.postgresql/root.crt" does not exist
Either provide the file or change sslmode to disable server certificate verification.
Run Code Online (Sandbox Code Playgroud)

我想知道为什么我不需要 AWS 的客户端密钥和证书?

如果我们使用由证书颁发机构签名的证书,我们将不需要客户端密钥和秘密?

如果我们想要为所有客户端提供一个证书,我需要做什么额外的工作才能在生产中启用 SSL?

我想使用 sslmode=verify-full

postgresql ssl openssl amazon-rds postgresql-9.6

1
推荐指数
1
解决办法
1万
查看次数