摘要: os: ubuntu 16.04postgresql: 9.6.9etcd: 3.2.18patroni: 1.4.4haproxy: 1.6.3keepalived: 1.2.24ip规划192.168.56.101 node1 master192.168... 阅读全文
posted @ 2018-10-15 11:32 peiybpeiyb 阅读(892) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04postgresql: 9.6.9etcd: 3.2.18patroni: 1.4.4haproxy: 1.6.3ip规划192.168.56.101 node1 master192.168.56.102 node2 slav... 阅读全文
posted @ 2018-10-11 15:09 peiybpeiyb 阅读(1052) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04postgresql: 9.6.8ip 规划192.168.56.102 node2 postgresqlhelp create indexpostgres=# \h create indexCommand: CREA... 阅读全文
posted @ 2018-10-09 10:24 peiybpeiyb 阅读(3472) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04postgresql: 9.6.8ip 规划192.168.56.102 node2 postgresqlhelp create indexpostgres=# \h create indexCommand: CREA... 阅读全文
posted @ 2018-10-09 08:37 peiybpeiyb 阅读(649) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04postgresql: 9.6.8barman: 2.5ip 规划192.168.56.101 node1 barman192.168.56.102 node2 postgresqlbarman 是2ndquadrant推出的... 阅读全文
posted @ 2018-10-08 16:57 peiybpeiyb 阅读(739) 评论(1) 推荐(0) 编辑
摘要: os: ubuntu 16.04postgresql: 9.6.8barman: 2.5ip 规划192.168.56.101 node1 barman192.168.56.102 node2 postgresqlbarman 是2ndquadrant推出的... 阅读全文
posted @ 2018-10-08 11:37 peiybpeiyb 阅读(710) 评论(1) 推荐(0) 编辑
摘要: os: ubuntu 16.04postgresql: 9.6.8barman: 2.5ip 规划192.168.56.101 node1 barman192.168.56.102 node2 postgresqlbarman 是2ndquadrant推出的... 阅读全文
posted @ 2018-10-08 11:18 peiybpeiyb 阅读(636) 评论(0) 推荐(0) 编辑
摘要: .pgpass 是 连接 postgresql 时使用的密码文件,通常位置为 ~/.pgpass。在使用某些组件时还真的必须使用。具体的格式为:hostname:port:database:username:password常见的使用如下:# su - po... 阅读全文
posted @ 2018-09-30 15:03 peiybpeiyb 阅读(4149) 评论(0) 推荐(0) 编辑
摘要: postgresql: 9.6一直觉得 pg_hba.conf 的行记录与顺序无关,遵循细化优先的规则。今天在回顾 pg_hba.conf 文档时发现这种认识是错的。下面这段话是从文档拷贝过来的:因为每一次连接尝试都会顺序地检查pg_hba.conf记录,所... 阅读全文
posted @ 2018-09-29 18:10 peiybpeiyb 阅读(470) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04在 /etc/rc.local 写错了一行代码,导致os无法正常启动,需要进入到单用户模式修改。1、加电至如下提示,选中第二行,按回车。 Ubuntu*Advanced options for Ubuntu2、会出现如下两行,... 阅读全文
posted @ 2018-09-28 19:28 peiybpeiyb 阅读(1917) 评论(0) 推荐(0) 编辑
摘要: os: centos 7.4postgresql: 9.6.9etcd: 3.2.18patroni: 1.4.4本篇blog介绍下 etcd + patroni 发生切换时使用 callback 来重新设定 master 的 vip。主要是方便自有机房或托... 阅读全文
posted @ 2018-09-28 17:37 peiybpeiyb 阅读(1376) 评论(0) 推荐(0) 编辑
摘要: os: centos 7.4postgresql: 9.6.9etcd: 3.2.18patroni: 1.4.4记录一下 etcd、patroni的一些命令,当个手记。etcd 的一些操作命令# systemctl status etcd.service ... 阅读全文
posted @ 2018-09-28 17:34 peiybpeiyb 阅读(829) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04linux crontab 在实际工作中大量使用,这里简单记录下。cron服务cron 在安装os都是默认安装的,如果发现没有安装,可以 apt 安装,对于 redhat 分支可以使用 yum 安装。# ps -ef|grep... 阅读全文
posted @ 2018-09-28 16:31 peiybpeiyb 阅读(217) 评论(0) 推荐(0) 编辑
摘要: os:ubunbu 16.04postgresql:9.6.8repmgr:4.1.1192.168.56.101 node1192.168.56.102 node2192.168.56.103 node3手动 rejoin$ sudo pg_ctlclus... 阅读全文
posted @ 2018-09-26 12:15 peiybpeiyb 阅读(392) 评论(0) 推荐(0) 编辑
摘要: os:ubunbu 16.04postgresql:9.6.8repmgr:4.1.1192.168.56.101 node1192.168.56.102 node2192.168.56.103 node3配置好 1 Primary + 2 Standby详... 阅读全文
posted @ 2018-09-26 11:05 peiybpeiyb 阅读(532) 评论(0) 推荐(0) 编辑
摘要: stop pgsql$ pg_ctl -D /var/lib/postgresql/9.6/main -m fast stop或者$ sudo pg_ctlcluster 9.6 main stopclone standby$ repmgr -h 192.1... 阅读全文
posted @ 2018-09-25 18:01 peiybpeiyb 阅读(672) 评论(0) 推荐(0) 编辑
摘要: /etc/repmgr.conf# more /etc/repmgr.conf############################################### node informationnode_id=1node_name=node1co... 阅读全文
posted @ 2018-09-25 17:32 peiybpeiyb 阅读(503) 评论(0) 推荐(0) 编辑
摘要: os:ubunbu 16.04postgresql:9.6.8repmgr:4.1.1192.168.56.101 node1192.168.56.102 node2生产环境确保网络稳定的前提下,数据库能够 auto failover 是最好的状态。如果是同... 阅读全文
posted @ 2018-09-25 17:10 peiybpeiyb 阅读(1003) 评论(0) 推荐(0) 编辑
摘要: os:ubunbu 16.04postgresql:9.6.8repmgr:4.1.1192.168.56.101 node1192.168.56.102 node2操作前/etc/repmgr.conf 的内容node1 节点上的文件内容,node2 节点... 阅读全文
posted @ 2018-09-25 11:08 peiybpeiyb 阅读(1435) 评论(0) 推荐(1) 编辑
摘要: os:ubunbu 16.04postgresql:9.6.8repmgr:4.1.1192.168.56.101 node1192.168.56.102 node2按照上一遍blog安装好 1 Primary + 1 Standby。编辑 /etc/sud... 阅读全文
posted @ 2018-09-24 21:36 peiybpeiyb 阅读(705) 评论(0) 推荐(0) 编辑
摘要: os:ubunbu 16.04postgresql:9.6.8repmgr:4.1.1192.168.56.101 node1192.168.56.102 node2安装 postgresql 9.6 软件node1、node2都需要使用 apt insta... 阅读全文
posted @ 2018-09-24 19:21 peiybpeiyb 阅读(716) 评论(0) 推荐(0) 编辑
摘要: os:ubunbu 16.04postgresql:9.6.8repmgr:4.1.1repmgr -f /etc/repmgr.conf --help$ repmgr -f /etc/repmgr.conf --helprepmgr: replicatio... 阅读全文
posted @ 2018-09-24 16:00 peiybpeiyb 阅读(774) 评论(0) 推荐(0) 编辑
摘要: 一些变量下列环境变量能被用于选择默认的连接参数值,如果调用代码没有直接指定值,它们将被用于PQconnectdb、PQsetdbLogin和PQsetdb。例如,这些有助于防止数据库连接信息被硬编码到简单的客户端应用中。PGHOST的行为和host连接参数相... 阅读全文
posted @ 2018-09-24 14:52 peiybpeiyb 阅读(1044) 评论(0) 推荐(0) 编辑
摘要: os:ubunbu 16.04postgresql:9.6.8repmgr:4.1.1repmgr是2ndquadrant公司维护的针对postgresql replication的工具。工具虽小,却比较精悍。需要注意的是repmgr必须安装在每个节点上。目... 阅读全文
posted @ 2018-09-21 15:33 peiybpeiyb 阅读(2103) 评论(0) 推荐(0) 编辑
摘要: postgresql 表和索引的膨胀是非常常见的,一方面是因为 autovacuum 清理标记为 dead tuple 的速度跟不上,另一方面也可能是由于长事物,未决事物,复制槽引起的。#初始化数据zabbix=# create table tmp_t0(c... 阅读全文
posted @ 2018-09-19 16:52 peiybpeiyb 阅读(2080) 评论(0) 推荐(0) 编辑
摘要: postgresql 是使用文件系统存储数据的,有时需要找表及索引对应的磁盘文件,就必须了解以下知识点。非toast情况zabbix=# create table tmp_t0(c0 varchar(100),c1 varchar(100), c2 varc... 阅读全文
posted @ 2018-09-19 11:54 peiybpeiyb 阅读(341) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04postgresql: 9.6.8sysbench: 1.0.15# lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription: ... 阅读全文
posted @ 2018-09-18 15:27 peiybpeiyb 阅读(1497) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04 postgresql: 9.6.8pg_rewind是用于在集簇的时间线分叉以后,同步一个 PostgreSQL 集簇和同一集簇的另一份拷贝的工具。一种典型的场景是在故障切换后让旧的主服务器作为新主机的备机重新上线。其结果等... 阅读全文
posted @ 2018-09-17 17:17 peiybpeiyb 阅读(938) 评论(0) 推荐(0) 编辑
摘要: archive_command 是 postgresql.conf 里的参数。restore_command 是 recovery.conf 里的参数。非压缩archive_command = 'cp %p /data/backup/pgwalarchive... 阅读全文
posted @ 2018-09-14 14:17 peiybpeiyb 阅读(1404) 评论(0) 推荐(0) 编辑
摘要: 使用 oracle vm 安装 Ubuntu 16.04 时,网卡名称显示:enp0s3,enp0s8,可以通过修改配置文件调整网卡名称。udev配置文件# vi /etc/udev/rules.d/70-persistent-net.rules:SUBSY... 阅读全文
posted @ 2018-09-13 10:22 peiybpeiyb 阅读(624) 评论(0) 推荐(0) 编辑
摘要: synchronous_commit指定在命令返回”success”指示给客户端之前,一个事务是否需要等待 WAL 记录被写入磁盘。合法的值是{local,remote_write,remote_apply,on,off}默认的并且安全的设置是on。不同于f... 阅读全文
posted @ 2018-09-12 10:24 peiybpeiyb 阅读(587) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04 zabbix: 3.4 pg_monz: 2.1ip 规划 192.168.56.101 node1 pgsql 9.6 master 192.168.56.102 node2 pgsql 9.6 slave 192... 阅读全文
posted @ 2018-09-10 18:21 peiybpeiyb 阅读(671) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04 zabbix: 3.4ip 规划 192.168.56.101 node1 pgsql 9.6 master 192.168.56.102 node2 pgsql 9.6 slave 192.168.56.103 ... 阅读全文
posted @ 2018-09-07 10:14 peiybpeiyb 阅读(335) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04 zabbix: 3.4ip 规划 192.168.56.101 node1 pgsql 9.6 master 192.168.56.102 node2 pgsql 9.6 slave 192.168.56.103 ... 阅读全文
posted @ 2018-09-06 10:13 peiybpeiyb 阅读(400) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04 zabbix: 3.4ip 规划 192.168.56.101 node1 pgsql 9.6 master 192.168.56.102 node2 pgsql 9.6 slave 192.168.56.103 ... 阅读全文
posted @ 2018-09-05 11:36 peiybpeiyb 阅读(678) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04 zabbix: 3.4ip 规划 192.168.56.101 node1 pgsql 9.6 master 192.168.56.102 node2 pgsql 9.6 slave 192.168.56.103 ... 阅读全文
posted @ 2018-09-04 15:27 peiybpeiyb 阅读(418) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04zabbix: 3.4ip 规划192.168.56.101 node1 pgsql 9.6 master192.168.56.102 node2 pgsql 9.6 slave192.168.56.103 node3 ... 阅读全文
posted @ 2018-09-04 15:20 peiybpeiyb 阅读(552) 评论(0) 推荐(0) 编辑
摘要: os: ubuntu 16.04 zabbix: 3.4ip 规划 192.168.56.101 node1 pgsql 9.6 master 192.168.56.102 node2 pgsql 9.6 slave 192.168.56.103 ... 阅读全文
posted @ 2018-09-03 20:51 peiybpeiyb 阅读(327) 评论(0) 推荐(0) 编辑
摘要: #apt重新从源仓库中同步文件索引# apt-get update列出所有可用包 apt-cache pkgnames使用关键字搜索包# apt-cache search "postgresql"列出已经安装的包# dpkg -l | grep -i pos... 阅读全文
posted @ 2018-09-03 18:00 peiybpeiyb 阅读(278) 评论(0) 推荐(0) 编辑
摘要: 备份# cp /etc/apt/sources.list /etc/apt/sources.list.bak替换# cat /dev/null > /etc/apt/sources.list# vi /etc/apt/sources.list#deb包deb... 阅读全文
posted @ 2018-09-03 08:33 peiybpeiyb 阅读(582) 评论(0) 推荐(0) 编辑