概述
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 上建立帳戶
電子郵件 []: [email protected]
密碼 :
----------------------------------------------------------------------------
請指定将要安裝 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