pg_rman的安装与使用
1.下载对应数据库版本及操作系统的pg_rman源码
https://github.com/ossc-db/pg_rman/releases
本例使用的是centos6.9+pg10,因此下载的是pg_rman-1.3.7-pg10.tar.gz
源码是与操作系统无关的,在编译安装的时候会适配对应的操作系统
2.上传安装包并解压安装
# tar vxf pg_rman-1.3.7-pg10.tar.gz
# cd pg_rman-1.3.7-pg10
# export PATH=$PATH:/usr/local/pgsql/bin
# make
make时出现以下错误,提示找不到connect.h
pgut/pgut.c:11:30: error: fe_utils/connect.h: No such file or directory
pgut/pgut.c: In function ‘pgut_connect’:
pgut/pgut.c:949: error: ‘ALWAYS_SECURE_SEARCH_PATH_SQL’ undeclared (first use in this function)
pgut/pgut.c:949: error: (Each undeclared identifier is reported only once
pgut/pgut.c:949: error: for each function it appears in.)
make: *** [pgut/pgut.o] Error 1
解决方法,从其他版本copy一个connect.h过来
# cp /usr/local/pgsql-12.0/include/server/fe_utils/connect.h /usr/local/pgsql/include/server/fe_utils/
之后执行make
# make
# make install
验证rman,使用make installcheck验证
# chown -R postgres.postgres pg_rman-1.3.7-pg10
# su - postgres
$ cd /data/software/pg_rman-1.3.7-pg10
$ make installcheck
3.开启数据库归档
# su - postgres
$ cd /archlog
$ mkdir pg-10.0
$ cd $PGDATA
$ vi postgresql.conf
修改如下部分
# - Archiving - archive_mode = on # enables archiving; off, on, or always
# (change requires restart)
archive_command = 'test ! -f /archlog/pg-10.0/%f && cp %p /archlog/pg-10.0/%f' # command to use to archive a logfile segment
# placeholders: %p = path of file to archive
# %f = file name only
# e.g. 'test ! -f /mnt/server/archivedir/%f && cp %p /mnt/server/archivedir/%f'
archive_timeout = 1800 # force a logfile segment switch after this
# number of seconds; 0 disables
修改后,需要重启数据库
$ pg_ctl restart
$ psql
#切换以下redo,测试归档设置是否OK
select pg_switch_wal();
4.配置环境变量
# su - postgres
$ vi .bash_profile
添加如下环境变量
export BACKUP_PATH=/pgdata/pg_rman_backup
5.初始化pg_rman,并全备测试
$ pg_rman init
$ pg_rman backup --backup-mode=full -C -P
$ pg_rman show
6.删除归档的脚本和后台执行全备的脚本
$ pg_archivecleanup -d /archlog/archivedir 000000010000EEF700000060
$ nohup pg_rman backup --backup-mode=full -C -P > /archlog/pg_rman_backup/full_backup.log 2>&1 &
第二个nohub,意思是no hung up,在每一个ssh断开的时候,会向其所有子进程发送hung up信号,子程序会停止,使用nohub后,在ssh退出时,程序会继续执行
&是后台执行的意思,会让这个命令在后台执行,但是在ssh退出后,程序会被退出,两者结合起来可以实现后台执行
pg_rman的安装与使用的更多相关文章
- PostgreSQL 使用PG_Rman进行物理备份
背景 在Oracle下我们可以使用rman进行物理备份,支持数据库的全量.增量.归档的备份模式而PostgreSQL作为开源数据库,近些时间来也一直向商业版数据库看齐,也推出了开源功工具pg_rman ...
- 记录一次编译安装Pg_rman缺少依赖包的问题
系统版本:CentOS版本6.10(最终版) pg_rman:https://github.com/ossc-db/pg_rman -bash-4.1$ makegcc -Wall -Wmissing ...
- POSTGRESQL9.5之pg_rman工具
pg_rman是一款专门为postgresql设计的在线备份恢复的工具.其支持在线和基于时间点备份方式,还可以通过创建backup catalog来维护DB cluster备份信息. 看起来好像是模仿 ...
- docker——容器安装tomcat
写在前面: 继续docker的学习,学习了docker的基本常用命令之后,我在docker上安装jdk,tomcat两个基本的java web工具,这里对操作流程记录一下. 软件准备: 1.jdk-7 ...
- 网络原因导致 npm 软件包 node-sass / gulp-sass 安装失败的处理办法
如果你正在构建一个基于 gulp 的前端自动化开发环境,那么极有可能会用到 gulp-sass ,由于网络原因你可能会安装失败,因为安装过程中部分细节会到亚马逊云服务器上获取文件.本文主要讨论在不变更 ...
- Sublime Text3安装JsHint
介绍 Sublime Text3使用jshint依赖Nodejs,SublimeLinter和Sublimelinter-jshint. NodeJs的安装省略. 安装SublimeLinter Su ...
- Fabio 安装和简单使用
Fabio(Go 语言):https://github.com/eBay/fabio Fabio 是一个快速.现代.zero-conf 负载均衡 HTTP(S) 路由器,用于部署 Consul 管理的 ...
- gentoo 安装
加载完光驱后 1进行ping命令查看网络是否通畅 2设置硬盘的标识为GPT(主要用于64位且启动模式为UEFI,还有一个是MBR,主要用于32位且启动模式为bois) parted -a optima ...
- Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级
Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part3:db安装和升级 环境:OEL 5.7 + Oracle 10.2.0.5 RAC 5.安装Database软件 5. ...
随机推荐
- 移动端 canvas基础1
一.canvas画布 Canvas是HTML5中新出的一个元素,开发者可以通过JS脚本动态绘制图像. #1. 创建canvas画布 在页面中创建canvas标签,并设置其id和宽高 (不要通过css设 ...
- DRF比Django的认证和权限高在哪里
Django可以用LoginRequiredMixin和PermissionRequiredMixin给类视图添加认证和权限,DRF做了高级封装,提供了更简洁的实现方式.我们通过继续学习官网教程来进行 ...
- C#爬虫,让你不再觉得神秘
1.使用第三方类库 HtmlAgilityPack 官方网址:https://html-agility-pack.net/?z=codeplex. // From File 从文件获取html信息 v ...
- linux重启后nginx服务无法启动
查看ngin.conf pid的内容 例如: pid /usr/local/nginx/logs/nginx.pid 根据以上配置内容来做,检查/usr/local/nginx/logs/是否存在,如 ...
- Kubernetes学习笔记_尚硅谷
https://www.bilibili.com/video/BV1w4411y7Go?p=1 一.K8s介绍 k8s是一个编排容器的工具,其实也是管理应用的全生命周期的一个工具,从创建应用,应用的部 ...
- 使用form表单上传文件
在使用form表单上传文件时候,input[type='file']是必然会用的,其中有一些小坑需要避免. 1.form的 enctype="multipart/form-data" ...
- 企业运维案例:xxx is not in the sudoers file.This incident will be reported” 错误解决方法
CentOS6系统下,普通用户使用sudo执行命令时报错: xxx is not in the sudoers file.This incident will be reported" 解决 ...
- 简单谈谈contextlib的使用
简单谈谈contextlib的使用 写在前面 做这件事的原因: 在看书的时候,我发现了有大佬们用contextlib管理上下文,真的很牛皮,但是百度了以下,每个大佬都写了很多很全很深刻,讲道理五花八门 ...
- 深入浅出JVM(一):你写得.java文件是如何被加载到内存中执行的
众所周知,.java文件需要经过编译生成.class文件才能被JVM执行. 其中,JVM是如何加载.class文件,又做了些什么呢? .class文件通过 加载->验证->准备->解 ...
- 将notepad++关联到右键菜单
Step1: 新建txt文本, 将以下内容复制到文本中: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT*\Shell\NotePad+ ...