pgagent安装手册
- 本文主要介绍2种方案进行安装,默认为linux环境
- 本文环境centos8 ,postgresql13.4
第一种安装方式
采用yum 或者dnf方式进行安装
[root@ken-pg extension]# dnf search pgagent
上次元数据过期检查:1:57:40 前,执行于 2021年10月10日 星期日 19时57分59秒。
========================================================================================= 名称 和 概况 匹配:pgagent ==========================================================================================
pgagent_12-debuginfo.x86_64 : Debug information for package pgagent_12
pgagent_12-debugsource.x86_64 : Debug sources for package pgagent_12
============================================================================================= 名称 匹配:pgagent ==============================================================================================
pgagent_10.x86_64 : Job scheduler for PostgreSQL
pgagent_11.x86_64 : Job scheduler for PostgreSQL
pgagent_12.x86_64 : Job scheduler for PostgreSQL
pgagent_13.x86_64 : Job scheduler for PostgreSQL
pgagent_14.x86_64 : Job scheduler for PostgreSQL
pgagent_96.x86_64 : Job scheduler for PostgreSQL
- 进行安装
dnf install pgagent_13.x86_64 -y
- 进行使用
postgres=# create extension pgagent;
- 在主机上启动pgagent进程
postgres@stephen ~]$ pgagent hostaddr=127.0.0.1 dbname=postgres user=postgres password=postgres
[postgres@stephen ~]$
4、用pgadmin工具连接,就可以使用
第二种方式采用pgagent,二进制编译安装
1、获取pgagent
wget -O pgagent-4.2.2.tar.gz https://codeload.github.com/postgres/pgagent/tar.gz/refs/tags/REL-4_2_2
tar zvxf pgagent-4.2.2.tar.gz
cd pgagent-REL-4_2_2/
- 安装编译环境,因为需要cmake,boost等编译环境
dnf install cmake boost boost-devel -y
- 用cmake进行编译
[root@ken-pg pgagent-REL-4_2_2]# cmake ./
-- Boost version: 1.66.0
-- Found the following Boost libraries:
-- filesystem
-- regex
-- date_time
-- thread
-- system
-- chrono
-- atomic
--
-- ================================================================================
-- Configuration summary:
--
-- Project : pgagent
-- Description : pgAgent is a job scheduling engine for PostgreSQL
-- Version : 4.2.2
--
-- PostgreSQL version string : PostgreSQL 13.4
-- PostgreSQL version parts : 13
-- PostgreSQL path : /usr
-- PostgreSQL config binary : /usr/bin/pg_config
-- PostgreSQL include path : /usr/include
-- PostgreSQL library path : /usr/lib64
-- PostgreSQL share path : /usr/share/pgsql
--
-- Boost version : 1.66.0
-- Boost path : /usr/include
-- Boost include directory : /usr/include
-- Boost library directory : /usr/lib64
-- Boost Static linking : NO
-- ================================================================================
--
-- Configuring done
-- Generating done
-- Build files have been written to: /root/pgagent-REL-4_2_2
- 再用make进行编译
[root@ken-pg pgagent-REL-4_2_2]# make
Scanning dependencies of target run
[ 11%] Generating pgagent--4.2.sql, pgagent.control
[ 11%] Built target run
Scanning dependencies of target pgagent
[ 22%] Building CXX object CMakeFiles/pgagent.dir/connection.cpp.o
[ 33%] Building CXX object CMakeFiles/pgagent.dir/job.cpp.o
[ 44%] Building CXX object CMakeFiles/pgagent.dir/misc.cpp.o
[ 55%] Building CXX object CMakeFiles/pgagent.dir/pgAgent.cpp.o
[ 66%] Building CXX object CMakeFiles/pgagent.dir/precomp.cpp.o
[ 77%] Building CXX object CMakeFiles/pgagent.dir/unix.cpp.o
[ 88%] Building CXX object CMakeFiles/pgagent.dir/win32.cpp.o
[100%] Linking CXX executable pgagent
[100%] Built target pgagent
[root@ken-pg pgagent-REL-4_2_2]# make install
[ 11%] Built target run
[100%] Built target pgagent
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/bin/pgagent
-- Installing: /usr/local/share/pgagent.sql
-- Installing: /usr/local/./README
-- Installing: /usr/local/./LICENSE
-- Installing: /usr/share/pgsql/extension/pgagent--4.2.sql
-- Installing: /usr/share/pgsql/extension/pgagent.control
-- Installing: /usr/share/pgsql/extension/pgagent--3.4--4.2.sql
-- Installing: /usr/share/pgsql/extension/pgagent--4.0--4.2.sql
-- Installing: /usr/share/pgsql/extension/pgagent--4.1--4.2.sql
-- Installing: /usr/share/pgsql/extension/pgagent--unpackaged--4.2.sql
- 把生成的extention拷贝到pg13的目录,不然create extention会报错
cp /usr/share/pgsql/extension/pgagent* /usr/pgsql-13/share/extension/
- 启动pg进程
postgres@stephen ~]$ pgagent hostaddr=127.0.0.1 dbname=postgres user=postgres password=postgres
[postgres@stephen ~]$