Patroni 修改配置

背景

  • 使用 Patroni 部署 postgresql 集群的时候,不能单独修改单点的配置,这里需要通过 Patroni 来修改配置。

修改步骤

1. 修改 postgres 集群的 max_connections 参数。

[root@postgres0 ~]# patronictl -c /etc/patroni.yml edit-config postgres

loop_wait: 10

maximum_lag_on_failover: 1048576

postgresql:

parameters:

# 注意:添加参数的时候,max_connections: 500 中间的冒号紧跟着一个**空格**,然后才是属性值。

max_connections: 500

use_pg_rewind: true

retry_timeout: 10

ttl: 30

---

+++

@@ -1,6 +1,8 @@

loop_wait: 10

maximum_lag_on_failover: 1048576

postgresql:

+ parameters:

+ max_connections: 500

use_pg_rewind: true

retry_timeout: 10

ttl: 30

# 这里输入 y ,应用所有更改。

Apply these changes? [y/N]:

1. 查看集群状态,最后一列状态栏 Pending restart 里面都是 * 号,表示配置已经修改,需要重启生效。

[root@loanapi ~]# patronictl -c /etc/patroni.yml list

+----------+--------+---------------+--------+---------+----+-----------+-----------------+

| Cluster | Member | Host | Role | State | TL | Lag in MB | Pending restart |

+----------+--------+---------------+--------+---------+----+-----------+-----------------+

| postgres | pg01 | 172.26.114.87 | | running | 4 | 0.0 | * |

| postgres | pg02 | 172.26.114.88 | | running | 4 | 0.0 | * |

| postgres | pg03 | 172.26.114.90 | Leader | running | 4 | 0.0 | * |

+----------+--------+---------------+--------+---------+----+-----------+-----------------+

1. 重启所有节点,使配置生效(重启一个再查看状态,就会发现 Pending restart 的星号没有了)。

[root@loanapi ~]# patronictl -c /etc/patroni.yml restart postgres pg01

When should the restart take place (e.g. 2019-09-11T10:49) [now]:

+----------+--------+---------------+--------+---------+----+-----------+-----------------+

| Cluster | Member | Host | Role | State | TL | Lag in MB | Pending restart |

+----------+--------+---------------+--------+---------+----+-----------+-----------------+

| postgres | pg01 | 172.26.114.87 | | running | 4 | 0.0 | * |

| postgres | pg02 | 172.26.114.88 | | running | 4 | 0.0 | * |

| postgres | pg03 | 172.26.114.90 | Leader | running | 4 | 0.0 | * |

+----------+--------+---------------+--------+---------+----+-----------+-----------------+

Are you sure you want to restart members pg01? [y/N]: y

Restart if the PostgreSQL version is less than provided (e.g. 9.5.2) []:

Success: restart on member pg01

补充信息

通过日志查看修改的内容是否正常。

# 如果你修改错了,页面上没有提示。

Sep 9 16:20:02 postgres0 patroni: 2019-09-09 16:20:02,337 INFO: Lock owner: pg01; I am pg01

Sep 9 16:20:02 postgres0 patroni: 2019-09-09 16:20:02,353 INFO: no action. i am the leader with the lock

Sep 9 16:20:02 postgres0 patroni: 2019-09-09 16:20:02,356 INFO: No PostgreSQL configuration items changed, nothing to reload.

# 如果你修改的对了,就会提示如下信息。

Sep 9 16:44:40 postgres0 patroni: 2019-09-09 16:44:40,046 INFO: no action. i am the leader with the lock

Sep 9 16:44:40 postgres0 patroni: 2019-09-09 16:44:40,081 INFO: Changed max_connections from 100 to 101 (restart required)

Sep 9 16:44:50 postgres0 patroni: 2019-09-09 16:44:50,027 INFO: Lock owner: pg01; I am pg01

Sep 9 16:44:50 postgres0 patroni: 2019-09-09 16:44:50,039 INFO: no action. i am the leader with the lock

Patroni 修改配置的更多相关文章

  1. jdk8中tomcat修改配置PermSize为MetaspaceSize

    JDK8中用metaspace代替permsize,因此在许多我们设置permsize大小的地方同样需要修改配置为metaspace 将-XX:PermSize=200m;-XX:MaxPermSiz ...

  2. Java 项目中一种简单的动态修改配置即时生效的方式 WatchService

    这种方式仅适合于比较小的项目,例如只有一两台服务器,而且配置文件是可以直接修改的.例如 Spring mvc 以 war 包的形式部署,可以直接修改resources 中的配置文件.如果是 Sprin ...

  3. Properties集合_修改配置信息

    集合中的数据来自于一个文件  注意:必须要保证该文件中的数据是键值对.  需要使用到读取流 使用load()方法读取已有文件中的数据,存储到Properties集合中 public class Pro ...

  4. mono修改配置

    当前mono安装目录为:/home/mono,安装成功后修改配置需进入这个路径: cd /home/mono 1.修改TcpBinaryFrameManager.cs文件 cd /home/mono/ ...

  5. 再战android-语音识别2(修改配置)

    可怕的半桶水一直在晃.程序中需要根据用户的选择设置语音识别的语言(目前科大讯飞支持英文.普通话.粤语),不想每次要用户去IatSetting中去改,需要能直接修改IatSetting的设置.之前移植的 ...

  6. 【原创】大叔经验分享(52)ClouderaManager修改配置报错

    Cloudera Manager中修改配置可能报错: Incorrect string value: '\xE7\xA8\x8B\xE5\xBA\x8F...' for column 'MESSAGE ...

  7. jdk8中tomcat修改配置PermSize为MetaspaceSize 标签: tomcatPermSizeMetaspaceSize

    JDK8中用metaspace代替permsize,因此在许多我们设置permsize大小的地方同样需要修改配置为metaspace 将-XX:PermSize=200m;-XX:MaxPermSiz ...

  8. PLSQL常用配置之窗口/版面保存、SQL格式化/美化、SQL注释\去掉注释等快捷键配置、登陆历史修改配置

    http://blog.csdn.net/hyeidolon/article/details/8251791   PLSQL常用配置之窗口/版面保存.SQL格式化/美化.SQL注释\去掉注释等快捷键配 ...

  9. Ubuntu 16.04修改配置静态IP和DNS

    Ubuntu 16.04修改配置静态IP和DNS 1.修改interfaces 文件 sudo gedit /etc/network/interfaces 2.添加 例如: auto enp0s25 ...

随机推荐

  1. 10 ~ express ~ 使用 cookie 保存用户 信息

    思维导图: (1) 保存 cookie (2)销毁 cookie 一,保存 cookie 1,app.js  . 新增代码 var Cookies = require('cookies') /** * ...

  2. IBGP的自己下一跳,指定源命令。

    neighbor router-id update-source loopback int 当两者并不是以物理接口为搭建邻居的时候,就得使用指定源,充当TCP接口. neighbor router-i ...

  3. 堆栈 pop push

    1.什么是堆栈 1.1堆栈 堆栈可以看作程序的心脏 所有重要的数据都会在这个里面体现(比如运算一道算术题,虽然还没算出最终答案,但是你在算出最终结果前的一些过程值可以放进堆栈) 堆栈这块内存比较特殊, ...

  4. PAT Advanced 1111 Online Map (30) [Dijkstra算法 + DFS]

    题目 Input our current position and a destination, an online map can recommend several paths. Now your ...

  5. 201771010123汪慧和《面向对象程序设计Java》第十八周实验总结

    一.总复习纲要 1. Java语言特点与开发环境配置(第1章.第2章) 2. Java基本程序结构(第3章) 3. Java面向对象程序结构(第4章.第5章.第6章) 4. 类.类间关系.类图 5. ...

  6. find_element_by_xpath()的6种方法

    Xpath (XML Path Language),是W3C定义的用来在XML文档中选择节点的语言 一:从根目录/开始 有点像Linux的文件查看,/代表根目录,一级一级的查找,直接子节点,相当于cs ...

  7. 使用idea断点调试时出现no executable code found at line问题

    问题描述 今天突然碰到了这样的一个问题: 使用断点调试时,断点的地方出现了一个叉号,而不是对勾,这就让我非常无奈了. 调了一天,终于把这个问题解决了,还是要记录一下的. 问题情况如下: 除了这里,de ...

  8. nginx log 切割

    /logs/nginx/*/*access.log { daily rotate 30 missingok dateext #compress notifempty sharedscripts pos ...

  9. nexus3安装 - CentOS7环境

    nexus3安装 - CentOS7环境 使用nexus3管理docker镜像,配合rancher进行部署. 建资料卷 资料卷默认地址:/var/lib/docker/volumes/资料卷名/_da ...

  10. 实验吧web-易-这个看起来有点简单

    看url中有id=1,明显的sql注入,这里使用手工注入不适用sqlmap,想用的话参考文章(传送门) 1.首先测试有没有sql注入漏洞, http://ctf5.shiyanbar.com/8/in ...