CentOS7 PostgreSQL 主从配置( 三)
postgres 主备切换
主备查看
方法
ps -ef | grep wal (主库 sender)
postgres 27873 27864 0 5月06 ? 00:00:10 postgres: wal sender process postgres 10.2.0.13(47582) streaming 0/906FF78
postgres 27874 27864 0 5月06 ? 00:00:11 postgres: wal sender process postgres 10.2.0.15(51872) streaming 0/906FF78
ps -ef | grep wal (备库 receiver)
postgres 25875 25828 0 5月06 ? 00:05:28 postgres: wal receiver process streaming 0/906FF78
备库切换为主库
1 关掉主库
pg_ctl stop
waiting for server to shut down.... done
server stopped
查看备库日志
tail -f /var/lib/pgsql/9.5/data/pg_log/postgresql-Fri.log
TCP/IP connections on port 5432?
< 2016-05-13 17:24:09.493 CST >FATAL: could not connect to the primary server: could not connect to server: Connection refused
Is the server running on host "10.2.0.14" and accepting
TCP/IP connections on port 5432?
< 2016-05-13 17:24:14.500 CST >FATAL: could not connect to the primary server: could not connect to server: Connection refused
Is the server running on host "10.2.0.14" and accepting
TCP/IP connections on port 5432?
< 2016-05-13 17:24:19.508 CST >FATAL: could not connect to the primary server: could not connect to server: Connection refused
Is the server running on host "10.2.0.14" and accepting
TCP/IP connections on port 5432?
在备机PGDATA对应目录下生成recovery.conf文件中指定的文件trigger_file = '/home/postgres.trigger' (此时备机正常运行状态)
touch /home/postgres.trigger
会看到 recovery.conf 文件变为 recovery.done
tail -f /var/lib/pgsql/9.5/data/pg_log/postgresql-Fri.log
TCP/IP connections on port 5432?
< 2016-05-13 17:27:21.714 CST >FATAL: could not connect to the primary server: could not connect to server: Connection refused
Is the server running on host "10.2.0.14" and accepting
TCP/IP connections on port 5432?
< 2016-05-13 17:27:26.719 CST >FATAL: could not connect to the primary server: could not connect to server: Connection refused
Is the server running on host "10.2.0.14" and accepting
TCP/IP connections on port 5432?
< 2016-05-13 17:27:31.719 CST >LOG: trigger file found: /home/postgres.trigger
< 2016-05-13 17:27:31.719 CST >LOG: redo is not required
< 2016-05-13 17:27:31.735 CST >LOG: selected new timeline ID: 2
< 2016-05-13 17:27:32.282 CST >LOG: archive recovery complete
< 2016-05-13 17:27:32.331 CST >LOG: MultiXact member wraparound protections are now enabled
< 2016-05-13 17:27:32.345 CST >LOG: autovacuum launcher started
< 2016-05-13 17:27:32.347 CST >LOG: database system is ready to accept connections
CentOS7 PostgreSQL 主从配置( 三)的更多相关文章
- CentOS7 PostgreSQL 主从配置( 二)
同步流复制配置PostgreSql的流复制是异步的,缺点是Standby上的数据落后于主库上的数据,如果使用Hot Standby做读写分离,就会存在数据一致性的问题.PostgreSql9.1版本后 ...
- CentOS7 PostgreSQL 主从配置( 一)
主库配置 pg_hba.conf host replication all 10.2.0.0/0 trust postgresql.conf listen_addresses = '*' max_wa ...
- Centos7 Openldap主从配置
转载 https://blog.csdn.net/htvxjl02/article/details/80336788 Centos7 Openldap主从配置 2018年05月16日 15:09:57 ...
- postgresql主从配置
master:10.0.1.114 slaver:10.0.1.116 一.yum安装https://blog.csdn.net/weixin_41048363/article/details/803 ...
- postgresql 主从配置
安装postgresql 主从是否一定需要分两台机器,主从必须要同一个版本,不然启动会报错. 3. 配置Master数据库 su – postgres /usr/local/pgsql/bin/pg_ ...
- centos7 postgresql安装配置
2021-07-15 1.添加用户 # 添加用户 postgres useradd postgres # 给用户 postgres 设置密码 passwd postgres 2.切换到该用户,下载 p ...
- postgresql pgsql最新版安装指南及数据存储路径更改及主从配置
postgresql pgsql最新版安装指南及数据存储路径更改及主从配置 安装指南 首先在apt的list添加你当前系统版本对应的apt列表 目前官网有16.04,14.04,12.04 分别对应下 ...
- Redis集群(三):主从配置一
一.本文目的 Redis的主从配置分为两篇文章,第一篇主要介绍了Redis主从配置的搭建过程及使用,第二篇主要说明各种情况下Redis主从状态,如Master挂掉,Slaver挂掉, ...
- CentOS7+mysql5.6配置主从
一.安装环境 操作系统:CentOS-7-x86_64-DVD-1611.iso数据库版本:mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz数据库地址: 192.1 ...
随机推荐
- 使用hexo搭建github博客
Win7系统已经安装了node.js和npm npm install -g hexo-cli 全局安装hexo客户端 hexo init blog 在喜欢的位置初始化blog目录 cd blog np ...
- UITextField(一)监听输入内容的变化(开发笔记)
//添加事件UIControlEventEditingChanged [textField addTarget:self action:@selector(textFieldDidChange:) f ...
- Google Dremel 原理 - 如何能3秒分析1PB
简介 Dremel 是Google 的“交互式”数据分析系统.可以组建成规模上千的集群,处理PB级别的数据.MapReduce处理一个数据,需要分钟级的时间.作为MapReduce的发起人,Googl ...
- MYSQL导入中文数据乱码的四种解决办法
方法一:通过增加参数 --default-character-set = utf8 解决乱码问题 方法一:通过增加参数 --default-character-set = utf8 解决乱码问题 my ...
- [妙味DOM]第四课:Event-事件详解2
知识点总结 事件捕获 obj.addEventListener('click',fn,true) 从外往里 obj.addEventListener('click',fn,false) 从里往外(冒泡 ...
- 一起看看2016中国第三届CSS开发者大会有哪些大咖演讲
中国第三届CSS开发者大会于2016年12月17日在广州举办.由W3C.w3ctech.前端圈主办.本次大会我们将邀请行业内知名讲师,与大家共聚广州,畅聊CSS. 快捷报名通道:http://www. ...
- jQuery第五章
jQuery对表单.表格的操作以及更多应用 一.表单应用 1.单行文本框应用 (1)获取和失去焦点改变样式 HTML代码如下: <form action="#" method ...
- PHP 时间与字符串的相互转化
1.求两个日期的差数,例如2007-3-5 ~ 2007-3-6 的日期差数 echo abs(strtotime("2007-3-5") - strtotime("20 ...
- 如何提升 CSS 选择器性能
CSS 选择器性能损耗来自? CSS选择器对性能的影响源于浏览器匹配选择器和文档元素时所消耗的时间,所以优化选择器的原则是应尽量避免使用消耗更多匹配时间的选择器.而在这之前我们需要了解CSS选择器匹配 ...
- vultr和digitalocean vps使用感受
中国用户购买海外vps看中的是欧美vps性价比高,不必备案,隐私保护好.但是,由于涉及到vps代理推广,国内涌现大量vps推广站点,他们纯粹发布一些vps促销信息去吸引潜在买家,甚至根本没有使用过所推 ...