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

简介: 概述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数据库、数据库生态工具、云原生智能化数据库管控平台,为阿里巴巴经济体以及各个行业的企业客户和开发者提供从公共云到混合云再到私有云的完整解决方案,提供基于云基础设施进行数据从处理、到存储、再到计算与分析的一体化解决方案。本节课带你了解阿里云数据库产品家族及特性。
相关文章
|
存储 弹性计算 安全
阿里云数字新基建系列——混合云架构(第2章-1)
阿里云经过12年的发展,以IaaS、PaaS分层为标准的云计算基础技术已经非常成熟,同时围绕这两层的泛网络、泛存储、泛安全等对云计算攸关的技术也起着关键支撑作用。当然,阿里云的核心技术有很多,包括但不限于数据库、大数据、IoT、AI等技术。限于篇幅,本章不会涉及这些内容,后续章节主要是介绍IaaS和PaaS层及相关的泛网络、泛存储、泛安全技术原理。
阿里云数字新基建系列——混合云架构(第2章-1)
|
存储 关系型数据库 PostgreSQL
深入浅出PostgreSQL B-Tree索引结构
PostgreSQL 的B-Tree索引页分为几种类别 meta page root page # btpo_flags=2 branch page # btpo_flags=0 leaf page # btpo_flags=1 如果即
15714 0
|
9月前
|
人工智能 弹性计算 运维
从ChatGPT被禁到OpenClaw预警:阿里云开发者如何安全选型AI产品
本文剖析ChatGPT与OpenClaw在阿里云环境中的安全风险,揭示AI选型中“安全合规、生态适配、可控可溯”远比“零成本”重要;并推介玄晶引擎AI数字员工——专为阿里云深度优化的安全可控方案,支持沙箱运行、本地闭环、一键部署及200+云服务集成,助力开发者高效、安心落地AI。
878 2
|
12月前
|
算法 搜索推荐
如何使用概率模型中的 BM25 算法进行打分?
BM25是一种基于概率模型的文本相关性打分算法,可视为TF-IDF的升级版。它综合考虑词频(TF)、逆文档频率(IDF)、文档长度及查询词频,并引入非线性增长与饱和机制。通过参数k1、k2和b调节词频权重、文档长度影响和查询词权重,使评分更精准。广泛应用于Elasticsearch、Lucene等搜索引擎中。
|
SQL 数据库 Docker
【赵渝强老师】在Docker中运行达梦数据库
本文介绍了在Docker容器中部署达梦数据库(DM 8)的具体步骤,包括创建文件夹、下载安装包、导入镜像、启动容器、登录数据库及查看状态等操作。同时,通过视频讲解辅助理解。文中还分析了将数据库服务容器化的潜在问题,如数据安全性、硬件资源争用、网络带宽占用和额外隔离带来的挑战,指出数据库服务在生产环境中可能不适合容器化的原因。
2542 4
【赵渝强老师】在Docker中运行达梦数据库
|
缓存 并行计算 算法
《突破极限:用Python量化技术将700B参数MoE模型塞进消费级显卡》
通过量化技术,700B参数的混合专家模型(MoE)可从2.8TB显存压缩至18GB,适配单张RTX 4090显卡运行。这一突破基于三重策略:移除无效参数、分层量化与显存优化。测试显示,量化后模型在Llama 3 MoE架构上保持高性能,显存占用显著降低,推理速度媲美云端A100集群,精度仅下降1.2%。未来方向包括1-bit量化、光追加速及生物启发压缩,推动消费级硬件运行万亿参数模型的可能性。
805 1
|
JSON Java API
原生Feign使用详解(HTTP客户端)(一)
原生Feign使用详解(HTTP客户端)(一)
1069 1
|
SQL 关系型数据库 数据库
PostgreSQL 如何潇洒的处理每天上百TB的数据增量
本文主要介绍并测试一下PostgreSQL 在中高端x86服务器上的数据插入速度,帮助企业用户了解PostgreSQL在这种纯插入场景的性能。(例如运营商网关数据,金融行业数据,产生量大,并且要求快速插入大数据库中持久化保存。) 测试结果写在前面:每32K的block存储89条记录, 每条记录约3
41748 131
成功解决报错:editor does not contain a main type
成功解决报错:editor does not contain a main type