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 ...
随机推荐
- 成为java高手的八大条件
1.扎实的基础 数据结构.离散数学.编译原理,这些是所有计算机科学的基础,如果不掌握它们,很难写出高水平的程序.程序人人都会写,但当你发现写到一定程度很难再提高 的时候,就应该想想是不是要回过头来学 ...
- shell中$0,$?,$!
变量说明: $$ Shell本身的PID(ProcessID) $! Shell最后运行的后台Process的PID $? 最后运行的命令的结束代码(返回值) $- 使用Set命令设定的Flag一览 ...
- 强制改变IE中的文本模式
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
- phantomjs处理alert、confirm弹窗
一:phantomjs处理alert弹窗 脚本实现功能为:点击click me按钮弹出弹窗消息为cheese,点击确定按钮,弹窗关闭 脚本代码为:注意的是phantomjs处理alert弹窗需要将ph ...
- 4、js内置函数
前言:上一篇我介绍了函数的基本概念,和一些简单的Demo.其实很多函数是js内置的,我们无需自己去写,直接拿过来用即可.内置函数分为全局函数和js内置对象的函数区别:全局函数不属于任何一个内置对象.理 ...
- magento删除数据
1.删除一条数据: $delete = Mage::getSingleton("core/resource")->getConnection("core_wr ...
- 遮盖层实现(jQuery+css+html)
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- Apache httpd.conf配置详解
常用配置指令说明 1. ServerRoot:服务器的基础目录,一般来说它将包含conf/和logs/子目录,其它配置文件的相对路径即基于此目录.默认为安装目录,不需更改. 语法:ServerRoot ...
- Highest Rated Features
- 点(.)运算符和箭头(->)运算符的区别
本机中,char类型数据占用1byte, unsigned int, int, long int, float类型的数据占用4 bytes, double类型的数据占用8bytes. 至于指向所有基本 ...