企业级PG:EnterpriseDB的安装使用

概述

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

下载

EDB官网 www.enterprisedb.com
下载需要申请账号密码
本来是想选择最新的PG11,但是系统版本只是支持Windows,这里我们选择的是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.

#安装完毕

配置环境

新建用户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数据库

启动数据库

[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@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

猜你喜欢

转载自blog.csdn.net/qq_43303221/article/details/84755987