Patroni 修改配置
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 修改配置的更多相关文章
- jdk8中tomcat修改配置PermSize为MetaspaceSize
JDK8中用metaspace代替permsize,因此在许多我们设置permsize大小的地方同样需要修改配置为metaspace 将-XX:PermSize=200m;-XX:MaxPermSiz ...
- Java 项目中一种简单的动态修改配置即时生效的方式 WatchService
这种方式仅适合于比较小的项目,例如只有一两台服务器,而且配置文件是可以直接修改的.例如 Spring mvc 以 war 包的形式部署,可以直接修改resources 中的配置文件.如果是 Sprin ...
- Properties集合_修改配置信息
集合中的数据来自于一个文件 注意:必须要保证该文件中的数据是键值对. 需要使用到读取流 使用load()方法读取已有文件中的数据,存储到Properties集合中 public class Pro ...
- mono修改配置
当前mono安装目录为:/home/mono,安装成功后修改配置需进入这个路径: cd /home/mono 1.修改TcpBinaryFrameManager.cs文件 cd /home/mono/ ...
- 再战android-语音识别2(修改配置)
可怕的半桶水一直在晃.程序中需要根据用户的选择设置语音识别的语言(目前科大讯飞支持英文.普通话.粤语),不想每次要用户去IatSetting中去改,需要能直接修改IatSetting的设置.之前移植的 ...
- 【原创】大叔经验分享(52)ClouderaManager修改配置报错
Cloudera Manager中修改配置可能报错: Incorrect string value: '\xE7\xA8\x8B\xE5\xBA\x8F...' for column 'MESSAGE ...
- jdk8中tomcat修改配置PermSize为MetaspaceSize 标签: tomcatPermSizeMetaspaceSize
JDK8中用metaspace代替permsize,因此在许多我们设置permsize大小的地方同样需要修改配置为metaspace 将-XX:PermSize=200m;-XX:MaxPermSiz ...
- PLSQL常用配置之窗口/版面保存、SQL格式化/美化、SQL注释\去掉注释等快捷键配置、登陆历史修改配置
http://blog.csdn.net/hyeidolon/article/details/8251791 PLSQL常用配置之窗口/版面保存.SQL格式化/美化.SQL注释\去掉注释等快捷键配 ...
- Ubuntu 16.04修改配置静态IP和DNS
Ubuntu 16.04修改配置静态IP和DNS 1.修改interfaces 文件 sudo gedit /etc/network/interfaces 2.添加 例如: auto enp0s25 ...
随机推荐
- 1. react 简书 项目初始化
1. 创建 react 项目 npx create-react-app my-app 2. src 目录下删除 除了 index.js index.css app.js 的文件 3. 引入 style ...
- COGS1487 麻球繁衍
不会做%%http://blog.csdn.net/doom_bringer/article/details/50428503 #include<bits/stdc++.h> #defin ...
- JS照片轮换
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Day 6:Vector类和实现Hashset以及登录窗口的模拟
LinkedList作业:生成扑克牌并且洗牌? import java.util.*; class Poker{ String color; String number; public Poker(S ...
- IDEA控制台输出中文乱码日志文件正常
控制台中文输出乱码但输出的日志文件正常 idea.exe.vmoptions与idea64.exe.vmoptions已经配置 -Dfile.encoding=UTF-8 logback.xml中也配 ...
- [GXYCTF2019]Ping Ping Ping
0x00 知识点 命令执行变量拼接 /?ip=127.0.0.1;a=g;cat$IFS$1fla$a.php 过滤bash用sh执行 echo$IFS$1Y2F0IGZsYWcucGhw|base6 ...
- luogu P4219 [BJOI2014]大融合
题解:原来LCT也能维护子树信息,我太Naive了 用LCT维护当前子树节点个数 具体做法维护siz[x]=当前Splay子树和指向当前Splay子树的虚边所代表的节点个数 auxsiz[x]=指向x ...
- CodeForces 1000B Light It Up(贪心、思维)
https://codeforces.com/problemset/problem/1000/B 题意: 一个模拟思维题.就是有一盏灯,0时刻开着.n次操作,你可以在其中加入一次操作(或者不加),操作 ...
- 实战Arch Unit
在以前的文章中介绍了通过 [<实战PMD>](https://zhuanlan.zhihu.com/p/105585075).[<实战Checkstyle>](https:// ...
- 201703-1 分蛋糕 Java
思路: 注意最后如果剩余蛋糕的重量小于k,也算一个人分到 import java.util.Scanner; public class Main { public static void main(S ...