EnterpriseDB(阿里云PPAS)自建与使用

本文涉及的产品
云原生数据库 PolarDB MySQL 版,通用型 2核4GB 50GB
云原生数据库 PolarDB PostgreSQL 版,标准版 2核4GB 50GB
简介: 概述EnterpriseDB是全球唯一一家提供基于PostgreSQL企业级产品与服务的厂商EnterpriseDB是PostgreSQL的一个分支,在PostgreSQL基础上,针对企业级应用进行了专门的优化,同时,增加了一系列如动态 性能调优(DynaTune)、EDB Loader、高效批量SQL处理等高级特性;在众多功能亮点中,EnterpriseDB的兼容性技术尤为惹眼,可以兼容oracle的数据库,目前,IBM 的DB2的数据库直接用EnterpriseDB的兼容包。

概述

EnterpriseDB是全球唯一一家提供基于PostgreSQL企业级产品与服务的厂商
EnterpriseDB是PostgreSQL的一个分支,在PostgreSQL基础上,针对企业级应用进行了专门的优化,同时,增加了一系列如动态 性能调优(DynaTune)、EDB Loader、高效批量SQL处理等高级特性;在众多功能亮点中,EnterpriseDB的兼容性技术尤为惹眼,可以兼容oracle的数据库,目前,IBM 的DB2的数据库直接用EnterpriseDB的兼容包。

云数据库PPAS版,基于PostgreSQL,高度兼容Oracle语法,由阿里云与EnterpriseDB公司合作提供
也就是常说的EDB,EDB其实就是商业版PostgreSQL,主要因为他是和Oracle最接近的数据库,这里主要是指语句的语法,或者说开发层面,对于原来使用Oracle的产品和服务,改造起来成本可能略小
目前PPAS支持的版本是9.3 与10

下载

EDB官网 www.enterprisedb.com
下载需要申请账号密码
这里我们选择的是10.5,可以安装在Linux 64位系统上。

安装

将安装包上传

将安装包上传到已经准备好的系统上,并赋予执行权限

[root@stephen opt]# chmod +x edb-as10-server-10.5.12-1-linux-x64.run

执行run安装文件

[root@stephen opt]# ./edb-as10-server-10.5.12-1-linux-x64.run 
----------------------------------------------------------------------------
Welcome to the EDB Postgres Advanced Server Setup Wizard.

----------------------------------------------------------------------------
Please read the following License Agreement. You must accept the terms of this 
agreement before continuing with the installation.

Press [Enter] to continue:
Limited Use Software License Agreement
Version 2.9

............................................(忽略这些声明)

Press [Enter] to continue:

Do you accept this license? [y/n]: y

----------------------------------------------------------------------------
Please specify the directory where EDB Postgres Advanced Server will be 
installed.

Installation Directory [/opt/edb/as10]: /opt/edb/as10   
# 选择要安装到的路径,全路径,如例

----------------------------------------------------------------------------
Select the components you want to install; clear the components you do not want
to install. Click Next when you are ready to continue.
# 手动选择一些需要安装的东西,这里我随便选了几样,可以根据需要选择安装

EDB Postgres Advanced Server [Y/n] :y

pgAdmin 4 [Y/n] :y

StackBuilder Plus [Y/n] :n

Command Line Tools [Y/n] :y

Is the selection above correct? [Y/n]: y

----------------------------------------------------------------------------
Additional Directories

Please select a directory under which to store your data.

Data Directory [/opt/edb/as10/data]: /sas_pgdata

Please select a directory under which to store your Write-Ahead Logs.

Write-Ahead Log (WAL) Directory [/opt/edb/as10/data/pg_wal]: /opt/edb/as10/data/pg_wal
# 这里是选择wal放的地方,理论上来说最好是将这个放在pgdata的位置,也就是数据目录里,我安装的时候没太注意,不过影响也不大,各位在安装的时候推荐放在数据目录下
----------------------------------------------------------------------------
Advanced Server Dialect

EDB Postgres Advanced Server can be configured in one of two "Dialects" - 1) Compatible with Oracle or 2) Compatible with Postgres.

If you select Compatible with Oracle, Advanced Server will be configured with appropriate data type conversions, time and date formats, Oracle-styled operators, dictionary views and more. This makes it easier to migrate or write new applications that are more compatible with the Oracle database.

If you select Compatible with Postgres, Advanced Server will be configured with standard PostgeSQL data types, time/date formats and operators.

Advanced Server Dialect

[1] Compatible with Oracle
[2] Compatible with Postgres
Please choose an option [1] : 2

#这里是选择高级服务器可以配置两种方言(Dialects),我更熟悉PG一点,所以选择2

----------------------------------------------------------------------------
Please provide a password for the database superuser (postgres). A locked Unix 
user account (postgres) will be created if not present.

#给postgres超级用户一个密码

Password :
Retype Password :
----------------------------------------------------------------------------
 Additional Configuration

Please select the port number the server should listen on.

Port [5432]: 5444

# 因为安装的系统还有一个postgres数据库,选择换一个端口进行安装

Select the locale to be used by the new database cluster.

Locale


Please choose an option [1] : 

Would you like to install sample tables and procedures?

Install sample tables and procedures. [Y/n]: y


----------------------------------------------------------------------------
Dynatune Dynamic Tuning:
Server Utilization

Please select the type of server to determine the amount of system resources 
that may be utilized:

#请选择服务器类型以确定系统资源的数量
#[1]开发(例如开发人员的笔记本电脑)
#[2]通用(例如web或应用服务器)
#[3]专用的(只运行高级服务器的服务器)
#这里我们只是安装测试,所以就选择1


[1] Development (e.g. a developer's laptop)
[2] General Purpose (e.g. a web or application server)
[3] Dedicated (a server running only Advanced Server)
Please choose an option [2] : 1

----------------------------------------------------------------------------
Dynatune Dynamic Tuning:
Workload Profile

Please select the type of workload this server will be used for:

#选择工作概要
#[1]事务处理(OLTP系统)
#[2]通用(OLTP和报告工作负载)
#[3]报告(复杂查询或OLAP工作负载)
#选择安装数据库用来做工作的类型,我这里这里选择2

[1] Transaction Processing (OLTP systems)
[2] General Purpose (OLTP and reporting workloads)
[3] Reporting (Complex queries or OLAP workloads)
Please choose an option [1] : 2

----------------------------------------------------------------------------
Pre Installation Summary

The following settings will be used for the installation::

Installation Directory: /opt/edb/as10
Server Installation Directory: /opt/edb/as10
Data Directory: /sas_pgdata
WAL Directory: /opt/edb/as10/data/pg_wal
Database Port: 5432
Database Superuser: postgres
Operating System Account: postgres
Database Service: edb-as-10
Command Line Tools Installation Directory: /opt/edb/as10
pgAdmin4 Installation Directory: /opt/edb/as10/pgAdmin4

Press [Enter] to continue:

#确认安装信息

----------------------------------------------------------------------------
Setup is now ready to begin installing EDB Postgres Advanced Server on your 
computer.

Do you want to continue? [Y/n]: y

----------------------------------------------------------------------------
Please wait while Setup installs EDB Postgres Advanced Server on your computer.

 Installing EDB Postgres Advanced Server 
 0% ______________ 50% ______________ 100%
 #########################################

----------------------------------------------------------------------------
Setup has finished installing EDB Postgres Advanced Server on your computer.

#安装完毕

ppas的安装步骤

有幸得到分享一个阿里云ppas的自建安装包,安装步骤与edb类似,如下

您是否接受此软件授权协议? [y/n]: y

----------------------------------------------------------------------------
安装 需要在 EnterpriseDB.com 上注册。 请在下方输入您的凭据。 如果您没有帐户,请在 
https://www.enterprisedb.com/user-login-registration 上创建帐户

电子邮件 []: stephenmysql@163.com

密码 :
----------------------------------------------------------------------------
请指定将要安装 Postgres Plus Advanced Server 的目录。

安装目录 [/opt/PostgresPlus]:          
----------------------------------------------------------------------------
Select the components you want to install.

Database Server [Y/n] :y

Connectors [Y/n] :y

Infinite Cache [Y/n] :y

Migration Toolkit [Y/n] :y

Postgres Enterprise Manager Client [Y/n] :y

pgpool-II [Y/n] :n

pgpool-II Extensions [Y/n] :n

EDB*Plus [Y/n] :y

Slony Replication [Y/n] :y

PgBouncer [Y/n] :y

上述选择是否正确? [Y/n]: y

----------------------------------------------------------------------------
其它目录

请选择一个用于存储数据的目录.

目录 [/opt/PostgresPlus/9.5AS/data]: 

请选择用于存储预写日志的目录。

预写日志(WAL)目录 [/opt/PostgresPlus/9.5AS/data/pg_xlog]: 

----------------------------------------------------------------------------
配置模式

Postgres Plus Advanced Server 始终附带安装适用于 Oracle(R) 的数据库兼容性功能并完全遵守 PostgreSQL 合规性。选择安装默认设置和示例的样式首选项。

Oracle 配置将导致使用特定对象(例如,DATE 数据类型、字符串操作等)生成与 Oracle 兼容的结果、创建相同的 Oracle 示例表格,并使该数据库与文档中所用的 Oracle 示例匹配。

配置模式

[1] Compatible with Oracle
[2] Compatible with PostgreSQL
请选择选项 [1] : 2

----------------------------------------------------------------------------
请提供数据库超级用户(postgres)的口令.如果没有提供口令,那么将创建一个已锁定的Unix用户帐户(postgres).

口令 :
重新输入口令 :
----------------------------------------------------------------------------
其它配置

请选择用于服务器监听的端口号.

端口 [5433]: 

请选择新数据库集群时所使用的语言环境.

安装示例表和存储过程. [Y/n]: y


----------------------------------------------------------------------------
Dynatune 动态性能调整:
服务器使用情况

请选择服务器的类型来确定会利用到的系统资源总合:


[1] 开发模式(例如, 一台开发人员的笔记本)
[2] 通用用途(例如. WEB或应用服务器)
[3] 专有模式(服务器只运行Postgres Plus)
请选择选项 [2] : 2

----------------------------------------------------------------------------
Dynatune Dynamic Tuning:
工作负载概要

请选择这台服务器将要使用到的工作负载类型:

[1] 在线事务处理(OLTP系统)
[2] 通用用途(数据库将用于事务处理和报表类型应用)
[3] 报表(运行复杂查询或OLAP类型的工作负载)
请选择选项 [1] : 1

----------------------------------------------------------------------------
高级选项配置
----------------------------------------------------------------------------
PgBouncer 侦听端口 [6432]: 
----------------------------------------------------------------------------
服务配置

自启动PgBouncer服务 [Y/n]: n

自启动pgAgent服务 [Y/n]: y

更新通知服务 [Y/n]: y

更新通知服务用于通知,下载和安装您所使用的Postgres Plus Advanced Server的安全补丁以及其它更新程序。
----------------------------------------------------------------------------
安装前概述

下面的设置将被用于安装:

安装目录: /opt/PostgresPlus
数据目录: /opt/PostgresPlus/9.5AS/data
WAL目录: /opt/PostgresPlus/9.5AS/data/pg_xlog
数据库端口: 5433
数据库的超级用户: postgres
操作系统帐户: postgres
数据库服务: ppas-9.5
PgBouncer所使用的监听端口: 6432

按 [Enter] 继续:
----------------------------------------------------------------------------
安装程序已经准备好将 Postgres Plus Advanced Server 安装到您的电脑。

您确定要继续吗? [Y/n]: y

----------------------------------------------------------------------------
正在安装 Postgres Plus Advanced Server 至您的电脑中,请稍候。

 正在安装Postgres Plus Advanced Server
 0% ______________ 50% ______________ 100%
 ########################################
 正在安装Database Server ...
 正在安装pgAgent ...
 正在安装Connectors ...
 正在安装Migration Toolkit ...
 正在安装EDB*Plus ...
 正在安装Infinite Cache ...
 正在安装Postgres Enterprise Manager Client ...
 正在安装Slony Replication ...
 正在安装PgBouncer ...
 正在安装StackBuilder Plus ...
 #

----------------------------------------------------------------------------
安装程序已经将 Postgres Plus Advanced Server 安装于您的电脑中。

启动edb数据库

启动数据库

[edb@stephen ~]$ pg_ctl start
waiting for server to start....2018-12-03 11:01:01 CST LOG: listening on IPv4 address "0.0.0.0", port 5444
2018-12-03 11:01:01 CST LOG: listening on IPv6 address "::", port 5444
2018-12-03 11:01:01 CST LOG: listening on Unix socket "/tmp/.s.PGSQL.5444"
2018-12-03 11:01:01 CST LOG: redirecting log output to logging collector process
2018-12-03 11:01:01 CST HINT: Future log output will appear in directory "log".
 done
server started

其余步骤与edb相同

配置环境

新建用户edb

为了方便使用和管理,我们新建edb用户来使用edb。

useradd -U edb

然后将安装好的安装目录和数据目录赋予用户权限

chown -R edb:edb /opt/edb/
chown -R edb:edb /sas_pgdata

配置环境变量

将新建的环境变量加到.bash_profile中

export PATH=/opt/edb/as10/bin:$PATH
export LD_LIBRARY_PATH=/opt/edb/as10/lib:$LD_LIBRARY_PATH
export PGDATA=/sas_pgdata
export PGHOST=/tmp

查看数据库是否正常

[edb@stephen ~]$ psql -Upostgres
Password for user postgres: 
psql.bin (10.5.12)
Type "help" for help.

postgres=# 
postgres=# \d
             List of relations
 Schema | Name | Type | Owner   
--------+------------+----------+----------
 public | dept | table | postgres
 public | emp | table | postgres
 public | jobhist | table | postgres
 public | next_empno | sequence | postgres
 public | salesemp | view | postgres
(5 rows)

postgres=# \l
                                     List of databases
   Name | Owner | Encoding | Collate | Ctype | ICU | Access privileges   
-----------+----------+----------+-------------+-------------+-----+-----------------------
 postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 
 template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | =c/postgres +
           | | | | | | postgres=CTc/postgres
 template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | =c/postgres +
           | | | | | | postgres=CTc/postgres
(3 rows)

postgres=# \q

查看数据库后台进程是否正常

[edb@stephen ~]$ ps -ef|grep edb
postgres 3668 1 0 10:45 ? 00:00:00 /opt/edb/as10/bin/edb-postgres -D /sas_pgdata
root 4007 2079 0 10:57 pts/1 00:00:00 su - edb
edb 4008 4007 0 10:57 pts/1 00:00:00 -bash
edb 4112 1 0 11:01 pts/1 00:00:00 /opt/edb/as10/bin/edb-postgres
edb 4113 4112 0 11:01 ? 00:00:00 postgres: logger process   
edb 4129 4112 0 11:01 ? 00:00:00 postgres: checkpointer process  
edb 4130 4112 0 11:01 ? 00:00:00 postgres: writer process   
edb 4131 4112 0 11:01 ? 00:00:00 postgres: wal writer process  
edb 4132 4112 0 11:01 ? 00:00:00 postgres: autovacuum launcher process  
edb 4133 4112 0 11:01 ? 00:00:00 postgres: stats collector process  
edb 4134 4112 0 11:01 ? 00:00:00 postgres: bgworker: dbms_aq launcher  
edb 4135 4112 0 11:01 ? 00:00:00 postgres: bgworker: logical replication launcher  
edb 4165 4008 0 11:02 pts/1 00:00:00 ps -ef
edb 4166 4008 0 11:02 pts/1 00:00:00 grep --color=auto edb
相关实践学习
使用PolarDB和ECS搭建门户网站
本场景主要介绍基于PolarDB和ECS实现搭建门户网站。
阿里云数据库产品家族及特性
阿里云智能数据库产品团队一直致力于不断健全产品体系,提升产品性能,打磨产品功能,从而帮助客户实现更加极致的弹性能力、具备更强的扩展能力、并利用云设施进一步降低企业成本。以云原生+分布式为核心技术抓手,打造以自研的在线事务型(OLTP)数据库Polar DB和在线分析型(OLAP)数据库Analytic DB为代表的新一代企业级云原生数据库产品体系, 结合NoSQL数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
相关文章
|
5月前
|
关系型数据库 Serverless 分布式数据库
PolarDB MySQL 版 Serverless-测评
通过函数计算调用PolarDB数据,拉起暂停状态的PolarDB MySQL 集群。
111573 8
|
2月前
|
弹性计算 关系型数据库 数据库
手把手带你从自建 MySQL 迁移到云数据库,一步就能脱胎换骨
阿里云瑶池数据库来开课啦!自建数据库迁移至云数据库 RDS原来只要一步操作就能搞定!点击阅读原文完成实验就可获得一本日历哦~
|
6天前
|
安全 关系型数据库 数据库
阿里云RDS PostgreSQL版支持 PG17,还不来体验?
PostgreSQL被誉为最先进的开源数据库,具有强大的扩展性和灵活架构。9月26日,社区官方正式发布了PostgreSQL 17.0版本,在性能、逻辑复制、开发者体验等方面进行了优化。阿里云RDS PostgreSQL 版已支持 PostgreSQL 17.0,并在社区17.0基础上,进行了安全、成本、可运维性等多方面提升,增加多种内核特性及插件特性。
|
3月前
|
关系型数据库 MySQL 分布式数据库
PolarDB MySQL版 GDN:实现真正的全球异地多活
【7月更文第31天】随着全球化业务的发展,企业需要确保其数据库能够在不同地理位置之间提供一致的服务质量和高可用性。阿里云PolarDB MySQL版的全球数据库网络(GDN)功能为此类需求提供了一个理想的解决方案。本文将深入探讨PolarDB MySQL版在GDN下的表现,并通过实际场景评测其异地多活能力。
136 3
|
5月前
|
新零售 关系型数据库 MySQL
POLARDB:新零售用户MySQL上云最佳选择
POLARDB是阿里云的云原生数据库,专为互联网场景设计,兼容MySQL并优化高并发处理。适用于新零售、电商和SaaS,支持百万级用户应用,保证数据一致性,可应对业务高峰,实现秒杀活动的顺畅运行。具备读写分离的集群架构,实现数据共享。自2018年商用以来,已在多个行业得到广泛应用。产品特性包括超快SQL性能、大容量存储、弹性扩容和高级安全性。
372 2
|
5月前
|
关系型数据库 MySQL 分布式数据库
PolarDB MySQL企业版产品系列:满足不同场景需求的解决方案
PolarDB MySQL企业版产品系列:满足不同场景需求的解决方案 在数字化时代,企业对于数据处理的需求越来越多样化,对于数据库的选择也更为谨慎。PolarDB MySQL版为了满足不同场景的需求,提供了单节点、集群版、高压缩引擎(X-Engine)和多主集群(库表)4种不同的产品系列。下面我们将对这4种产品系列进行简要介绍,以帮助您更好地了解它们的特点和适用场景。
172 1
|
11月前
|
SQL 关系型数据库 MySQL
阿里云国际站代理商:如何优化阿里云RDS MySQL云数据库?
阿里云国际站代理商:如何优化阿里云RDS MySQL云数据库?随着互联网的快速发展,越来越多的企业开始关注和使用云计算技术。阿里云作为全球领先的云计算服务提供商,其云数据库产品——RDS MySQL在市场上备受欢迎。那么,如何优化阿里云RDS MySQL云数据库呢?本文将从以下几个方面为大家详细介绍。
|
前端开发 关系型数据库 MySQL
自建MySQL 5.7数据库备份上云
本场景介绍用户从OSS拉取数据库备份文件,并导入到RDS备份管理仓库,RDS会对导入后的备份文件进行校验,并生成一个云盘快照,通过该快照可以在3-5分钟内快速拉起RDS实例,实现准实时灾备响应。
220 0
|
弹性计算 安全 关系型数据库
阿里云数据库RDS MySQL Serverless测评
就像云服务器和本地服务器的区别一样,云数据库就是云计算版本的数据库。 阿里云数据库有多种,今天尝试的是RDS MySQL Serverless,可以按需付费、动态匹配资源,这样的话如果是短期内使用的话比较划算。 例如某时间段搞活动导致数据库访问量暴涨,就可以临时购买该产品,动态提升性能,还是比较方便的
1463 1
|
存储 资源调度 监控
云数据库RDS MySQL Serverless已来
RDS MySQL Serverless公测结束,正式对外服务!
1508 0
云数据库RDS MySQL Serverless已来
下一篇
无影云桌面