AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-135861

Mika's questions

Martin Hope
Mika
Asked: 2019-12-27 08:29:09 +0800 CST

使用 etcd 启动的 Patroni

  • 0

我有一个带有流复制的现有 PostgreSQL 集群 v11.5。
我想设置由 Patroni 管理的高可用性。
我在两台机器上都安装了 Patroni,在另外三台虚拟机上设置了 etcd 集群 [' http://10.AA191:2379 '、' http://10.BB99:2379 '、' http://10. CC170:2379 '] 但使用 systemctl 启动 Patroni 失败。
当我使用patroni -c /etc/patroni.yml命令启动 Patroni 时,出现以下错误:

2019-12-26 16:51:38,207 DEBUG: Selection next machine in cache. Available machines: ['http://10.A.A.191:2379', 'http://10.B.B.99:2379', 'http://10.C.C.170:2379']
2019-12-26 16:51:38,207 INFO: Selected new etcd server http://10.C.C.170:2379
2019-12-26 16:51:38,208 DEBUG: Converted retries value: 0 -> Retry(total=0, connect=None, read=None, redirect=0, status=None)
2019-12-26 16:51:38,208 DEBUG: Starting new HTTP connection (1): 10.C.C.170:2379
2019-12-26 16:51:38,210 DEBUG: http://10.C.C.170:2379 "GET /v2/machines HTTP/1.1" 404 19
2019-12-26 16:51:38,211 ERROR: Failed to get list of machines from http://10.C.C.170:2379/v2: EtcdException('Bad response : 404 page not found\n',)
2019-12-26 16:51:38,211 INFO: Retrying on http://10.A.A.191:2379
2019-12-26 16:51:38,211 DEBUG: Converted retries value: 0 -> Retry(total=0, connect=None, read=None, redirect=0, status=None)
2019-12-26 16:51:38,211 DEBUG: Starting new HTTP connection (1): 10.237.132.191:2379
2019-12-26 16:51:38,214 DEBUG: http://10.A.A.191:2379 "GET /v2/machines HTTP/1.1" 404 19
2019-12-26 16:51:38,214 ERROR: Failed to get list of machines from http://10.A.A.191:2379/v2: EtcdException('Bad response : 404 page not found\n',)
2019-12-26 16:51:38,214 INFO: Retrying on http://10.B.B.99:2379
2019-12-26 16:51:38,215 DEBUG: Converted retries value: 0 -> Retry(total=0, connect=None, read=None, redirect=0, status=None)
2019-12-26 16:51:38,215 DEBUG: Starting new HTTP connection (1): 10.B.B.99:2379
2019-12-26 16:51:38,217 DEBUG: http://10.B.B.99:2379 "GET /v2/machines HTTP/1.1" 404 19
2019-12-26 16:51:38,217 ERROR: Failed to get list of machines from http://10.B.B.99:2379/v2: EtcdException('Bad response : 404 page not found\n',)
2019-12-26 16:51:38,217 INFO: waiting on etcd

问题似乎出在 API 级别DEBUG: http://10.B.B.99:2379 "GET /v2/machines HTTP/1.1" 404 19
etcd 可从 PostgreSQL 主机访问: curl -s http://10.B.B.99:2380/members |jq -r返回

[
  {
    "id": 730XXXXXXXXXXX000,
    "peerURLs": [
      "http://10.B.B.99:2380"
    ],
    "name": "etcd1",
    "clientURLs": [
      "http://0.0.0.0:2379"
    ]
  },
  {
    "id": 956XXXXXXXXXXX000,
    "peerURLs": [
      "http://10.C.C.170:2380"
    ],
    "name": "etcd3",
    "clientURLs": [
      "http://0.0.0.0:2379"
    ]
  },
  {
    "id": 1551XXXXXXXXXXX000,
    "peerURLs": [
      "http://10.A.A.191:2380"
    ],
    "name": "etcd2",
    "clientURLs": [
      "http://0.0.0.0:2379"
    ]
  }
]

etcd1 启动命令:

ExecStart=/usr/local/bin/etcd \
--name etcd1 \
--advertise-client-urls http://0.0.0.0:2379 \
--listen-client-urls http://0.0.0.0:2379 \
--initial-advertise-peer-urls http://10.B.B.99:2380 \
--listen-peer-urls http://0.0.0.0:2380 \
--initial-cluster etcd1=http://10.B.B.99:2380,etcd2=http://10.A.A.191:2380,etcd3=http://10.C.C.170:2380 \
--initial-cluster-token etcd-cluster-atom \
--initial-cluster-state new \
--logger zap \
--log-outputs stdout \
--log-level debug

有人可以帮助我吗?
怎么了?
非常感谢

版本:
etcd 版本:3.4.0
etcdctl 版本:3.4.0
API 版本:3.4
赞助人1.6.3
python-etcd== 0.4.5

postgresql configuration
  • 1 个回答
  • 1150 Views
Martin Hope
Mika
Asked: 2019-05-18 02:50:42 +0800 CST

PostgreSQL 中差异备份的哪个 PgBackRest 策略

  • 1

我在两个不同的服务器上设置了 pgBackRest 和 PostgreSQL 配置。

我使用 crontab 设置每周一次完整备份和每天一次差异备份。

0  1   *   *   0     pgbackrest --type=full --stanza=stanzaname backup  
0  1   *   *   1-6   pgbackrest --type=diff --stanza=stanzaname backup

我如下设置保留以节省磁盘使用量:

repo1-retention-full=2  
repo1-retention-diff=1
repo1-retention-archive-type=full

使用此保留配置是否可以确保 PITR 最多涵盖 2 周?

如果是,将差异保留设置为大于 1 是否有好处?
因为保留更多的差异备份可能会占用大量磁盘空间。

postgresql backup
  • 1 个回答
  • 717 Views
Martin Hope
Mika
Asked: 2018-03-14 04:15:54 +0800 CST

使用 pglogical 的 PostgreSQL 逻辑复制

  • 4

我正在使用 Pglogical 和 Postgresql v9.5 测试逻辑复制。

简单的配置似乎还可以。它的意思是:

  • 在两个节点中创建 pglogical 扩展
  • 创建一个集合并将公共模式中的表添加到该集合中,
  • 创建一个节点并在另一台服务器中创建订阅。

但是,订阅包含来自特定模式的表的新 replication_set 不起作用。

此命令通过(在提供程序节点中):

select pglogical.replication_set_add_all_tables(
set_name := 'new_replication_set',
schema_names := '{myschema}',
synchronize_data := 'true'
);

此命令通过(在订阅者节点中):

select pglogical.create_subscription(
subscription_name := 'subscription',
replication_sets := array['new_replication_set'],
provider_dsn := 'host=10.20.30.40 port=6432 dbname=production user=pglogical_prod',
synchronize_data := 'true'
);

但是订阅者节点中的表是空的。

我错过了什么?谢谢并恭祝安康。

附加信息:

  • select pglogical.alter_subscription_synchronize(...)并select pglogical.alter_subscription_resynchronize_table(...)发出命令,

  • 订阅者节点中的表也在特定模式中,

  • select * from pglogical.queue;请求不为空。

以下是从订阅者节点获取的日志消息:

我在订阅者节点中设置了 log_min_message = debug5。

并在下面的错误消息:

792 < 2018-03-14 11:38:56.449 CET >LOG:  starting apply for subscription subscription
793 < 2018-03-14 11:38:56.449 CET >DEBUG:  StartTransaction
794 < 2018-03-14 11:38:56.449 CET >DEBUG:  name: unnamed; blockState:       DEFAULT; state: INPROGR, xid/subid/cid: 0/1    /0, nestlvl: 1, children:
795 < 2018-03-14 11:38:56.449 CET >DEBUG:  CommitTransaction
796 < 2018-03-14 11:38:56.449 CET >DEBUG:  name: unnamed; blockState:       STARTED; state: INPROGR, xid/subid/cid: 0/1    /0, nestlvl: 1, children:
797 < 2018-03-14 11:38:56.449 CET >ERROR:  subscriber subscription initialization failed during nonrecoverable step (d)    , please try the setup again
798 < 2018-03-14 11:38:56.449 CET >DEBUG:  shmem_exit(1): 2 before_shmem_exit callbacks to make
799 < 2018-03-14 11:38:56.449 CET >LOG:  apply worker [16870] at slot 1 generation 4 exiting with error
800 < 2018-03-14 11:38:56.449 CET >DEBUG:  shmem_exit(1): 6 on_shmem_exit callbacks to make
801 < 2018-03-14 11:38:56.449 CET >DEBUG:  proc_exit(1): 2 callbacks to make
802 < 2018-03-14 11:38:56.449 CET >DEBUG:  exit(1)
803 < 2018-03-14 11:38:56.449 CET >DEBUG:  shmem_exit(-1): 0 before_shmem_exit callbacks to make
804 < 2018-03-14 11:38:56.449 CET >DEBUG:  shmem_exit(-1): 0 on_shmem_exit callbacks to make
805 < 2018-03-14 11:38:56.449 CET >DEBUG:  proc_exit(-1): 0 callbacks to make
806 < 2018-03-14 11:38:56.450 CET >DEBUG:  reaping dead processes
807 < 2018-03-14 11:38:56.450 CET >LOG:  worker process: pglogical apply 16385:2875150205 (PID 16870) exited with exit     code 1

谢谢并恭祝安康。

postgresql replication
  • 1 个回答
  • 2494 Views
Martin Hope
Mika
Asked: 2018-02-21 05:10:34 +0800 CST

如何优化请求

  • 2

Postgresql 执行一个 sql 请求的时间比 Oracle 长 10 倍。我们如何使用 Postgresql 加速该查询?

以下请求:

select t1.c1, t1.c2 from MyTable t1
where t1.c3='string'
and t1.c2=(select max(t2.c2) from MyTable t2 where t2.c4=t1.c4);

完整查询:

select t1.c1, t1.c2 from MyTable t1
left outer join Table t3
on t1.c1=t3.c1
where t1.c3='string'
and t1.c2=(select max(t2.c2) from MyTable t2 where t2.c4=t1.c4);
postgresql performance
  • 1 个回答
  • 53 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目

    • 12 个回答
  • Marko Smith

    如何让sqlplus的输出出现在一行中?

    • 3 个回答
  • Marko Smith

    选择具有最大日期或最晚日期的日期

    • 3 个回答
  • Marko Smith

    如何列出 PostgreSQL 中的所有模式?

    • 4 个回答
  • Marko Smith

    列出指定表的所有列

    • 5 个回答
  • Marko Smith

    如何在不修改我自己的 tnsnames.ora 的情况下使用 sqlplus 连接到位于另一台主机上的 Oracle 数据库

    • 4 个回答
  • Marko Smith

    你如何mysqldump特定的表?

    • 4 个回答
  • Marko Smith

    使用 psql 列出数据库权限

    • 10 个回答
  • Marko Smith

    如何从 PostgreSQL 中的选择查询中将值插入表中?

    • 4 个回答
  • Marko Smith

    如何使用 psql 列出所有数据库和表?

    • 7 个回答
  • Martin Hope
    Jin 连接到 PostgreSQL 服务器:致命:主机没有 pg_hba.conf 条目 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane 如何列出 PostgreSQL 中的所有模式? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh 为什么事务日志不断增长或空间不足? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland 列出指定表的所有列 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney MySQL 能否合理地对数十亿行执行查询? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx 如何监控大型 .sql 文件的导入进度? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison 你如何mysqldump特定的表? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 对 SQL 查询进行计时? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas 如何从 PostgreSQL 中的选择查询中将值插入表中? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas 如何使用 psql 列出所有数据库和表? 2011-02-18 00:45:49 +0800 CST

热门标签

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve