BigData

Postgres & enterprise DB 설치 따라하기

IT오이시이 2014. 3. 7. 17:29
728x90

[Postgres & enterprise DB 설치하기]


Postgres DB를 설치하는 과정은 많은 단계를 거쳐야 설치가 되므로 mysql 이나 오라클 설치 관리자와 다르게 상당히 복잡하다고 느껴 질 것입니다. 

소스를 다운받아 설치하는 과정을 전체 적으로 보시고 따라하면 좋을듯 합니다.


Postgres manager server 설치


1.소스 다운로드

  • Current Releases : Postgres Plus Advanced Server 9.3 Release Notes


 tar xvf ppasmeta-9.3.1.3-linux-x64.tar.tar
 cd ppasmeta-9.3.1.3-linux-x64 *



2.소스 설치

[root@dev1 ppasmeta-9.3.1.3-linux-x64]# ls
ppasmeta-9.3.1.3-linux-x64.run  README_FIRST_Linux64.txt  Y
[root@dev1 ppasmeta-9.3.1.3-linux-x64]# ll
total 151216
-rwxr-xr-x  1          502          502 154825778 Nov  5 17:04 ppasmeta-9.3.1.3-linux-x64.run
-rw-r--r--  1          502          502      9468 Nov  5 21:40 README_FIRST_Linux64.txt
drwx------ 16 enterprisedb enterprisedb      4096 Jan 24 18:01 Y


3.설치 마법사 실행

[root@dev1 ppasmeta-9.3.1.3-linux-x64]# ./ppasmeta-9.3.1.3-linux-x64.run


3.1 설치 언어 설정

Language Selection

Please select the installation language
[1] English - English
[2] Japanese - 日本語
[3] Simplified Chinese - ??中文
[4] Traditional Chinese - 繁?中文
[5] Korean - 한국어
Please choose an option [1] : 5


3.2 설치 마법사 소개 및 약관

----------------------------------------------------------------------------
Postgres Plus Advanced Server 설치 마법사를 시작합니다.

----------------------------------------------------------------------------
다음 사용권 계약서를 읽어 보십시오. 설치를 계속하기 전에 이 계약서 내용에 동의해야 합니다.

계속하려면 [Enter] 키 누르기:
Limited Use Software License Agreement
Version 2.8

IMPORTANT - READ CAREFULLY
This Limited Use Software License Agreement ("Agreement") is a legal document
between you ("Customer") and EnterpriseDB Corporation ("EnterpriseDB"). It is
important that you read this document before using the EnterpriseDB-provided
software ("Software"). By clicking the "I ACCEPT" button, or by installing, or
otherwise using the Software, Customer agrees to be bound by the terms of this
계속하려면 [Enter] 키 누르기:

계속하려면 [Enter] 키 누르기:

이 사용권 계약에 동의하십니까? [y/n]: y


3.3 사용자 인증

----------------------------------------------------------------------------
사용자 인증

이 설치을(를) 실행하려면 EnterpriseDB.com에 등록해야 합니다. 아래에 자격 증명을 입력하십시오. 계정이 없 으면
https://www.enterprisedb.com/user-login-registration에서 지금 하나 만드십시오.

전자 메일 :
암호 :


3.4 설치 패키지 확인

----------------------------------------------------------------------------
Select the components you want to install.

Database Server : Y (Cannot be edited)

Connectors : Y (Cannot be edited)

Infinite Cache : Y (Cannot be edited)

Migration Toolkit : Y (Cannot be edited)

Postgres Enterprise Manager Client : Y (Cannot be edited)

pgpool-II : Y (Cannot be edited)

EDB*Plus : Y (Cannot be edited)

Slony Replication : Y (Cannot be edited)

PgBouncer : Y (Cannot be edited)

위의 선택이 정확합니까? [Y/n]:Y


3.5 설치 위치

----------------------------------------------------------------------------
기존 설치

기존 Postgres Plus Advanced Server 설치가 /opt/PostgresPlus/9.3AS에 있습니다. 이 설치가
업그레이드됩니다.
계속하려면 [Enter] 키 누르기:


3.6 추가 디렉토리 : 데이터베이스 DATA PATH

----------------------------------------------------------------------------
기존 데이터 디렉터리

5444 포트를 사용하도록 설정된 기존 데이터 디렉터리가
/usr/local/src/DBMS/postgres/ppasmeta-9.3.1.3-linux-x64/Y에 있습니다. 이 디렉터리와 해당 구성이
이 설치에 사용됩니다.
계속하려면 [Enter] 키 누르기:


3.7 추가 디렉토리 : 데이터베이스 DATA PATH

----------------------------------------------------------------------------
----------------------------------------------------------------------------
추가 디렉터리

데이터를 저장할 디렉터리를 선택하십시오.

데이터 디렉터리 [/opt/PostgresPlus/9.3AS/data]:

미리 쓰기 로그를 저장할 디렉터리를 선택하십시오.

WAL(미리 쓰기 로그) 디렉터리 [/opt/PostgresPlus/9.3AS/data/pg_xlog]:

----------------------------------------------------------------------------


3.8 구성 모드

----------------------------------------------------------------------------
구성 모드

Postgres Plus Advanced Server는 항상 Oracle(R) 호환성 기능과 함께 설치되며 PostgreSQL을 완벽하게 준수합 니다. 설치 기본 값과 샘플을 위한 스타일 기본 설정을 선택하십시오.

Oracle 구성을 통해 특정 개체(예: DATE 데이터 형식, 문자열 연산 등)를 사용하여 Oracle과 호환되는 결과를  생성하고, 동일한 Oracle 샘플 테이블을 만들며, 문서에 사용된 Oracle 예제와 데이터베이스를 일치시킵니다.

구성 모드

[1] Oracle Compatible
[2] PostgreSQL Compatible
옵션을 선택하십시오. [1] : 1


3.9 데이터베이스 시스템 관리자 PW 설정

----------------------------------------------------------------------------
데이터베이스 superuser(enterprisedb)의 암호를 제공하십시오. 잠긴 Unix 사용자 계정(enterprisedb)을
만듭니다(없을 경우).
암호 :edbpw
암호 다시 입력 :edbpw
----------------------------------------------------------------------------
추가 구성

서버에서 수신할 포트 번호를 선택하십시오.

포트 [5444]:


3.10 환경 파일 확인

[pgplus_env.sh]
export PATH=/opt/PostgresPlus/9.3AS/bin:$PATH
export EDBHOME=/opt/PostgresPlus/9.3AS
export PGDATA=/opt/PostgresPlus/9.3AS/pgdata
export PGDATABASE=edb
# export PGUSER=enterprisedb
export PGPORT=5444
export PGLOCALEDIR=/opt/PostgresPlus/9.3AS/share/locale

[/etc/passwd]
 enterprisedb:x:2001:2001:Postgres Plus Advanced Server:/opt/PostgresPlus/9.3AS:/bin/bash


3.11 새 데이터베이스 클러스터에 사용할 로케일 설정

새 데이터베이스 클러스터에 사용할 로캘을 선택하십시오.
로캘
[1] [기본 로캘]
[222] en_US
[223] en_US.iso88591
[224] en_US.iso885915
[225] en_US.utf8
[443] ko_KR
[444] ko_KR.euckr
[445] ko_KR.utf8
[446] korean
[447] korean.euc
옵션을 선택하십시오. [1] :445

h3.샘플 테이블과 프로시저를 설치하십시오

샘플 테이블과 프로시저를 설치하십시오. [Y/n]:Y


3.12 DynaTune 동적 조정:

----------------------------------------------------------------------------
DynaTune 동적 조정:
서버 사용

이 서버 유형을 선택하여 사용할 시스템 리소스 양을 확인하십시오.

[1] 개발(예: 개발자 랩톱)
[2] 범용(예: 웹 또는 응용 프로그램 서버)
[3] 전용(Postgres Plus만 실행하는 서버)
옵션을 선택하십시오. [2] :2
----------------------------------------------------------------------------
DynaTune 동적 조정:
작업 프로필

이 서버가 사용될 작업 유형을 선택하십시오.

[1] 트랜잭션 처리(OLTP 시스템)
[2] 범용(OLTP 및 보고 작업)
[3] 보고(복잡한 쿼리 또는 OLAP 작업)
옵션을 선택하십시오. [1] :2


3.13 고급 구성

----------------------------------------------------------------------------
고급 구성

----------------------------------------------------------------------------
서비스 구성

PgBouncer 서비스 자동 시작 [Y/n]:n
pgAgent 서비스 자동 시작 [Y/n]: n
업데이트 알림 서비스 [Y/n]: n

업데이트 알림 서비스는 Postgres Plus Advanced Server 설치에 사용할 수 있는 보안 패치 및 다른 업데이트가 있을 때마다
알리고 다운로드하고 설치합니다.


3.14 사전 설치 요약

----------------------------------------------------------------------------
사전 설치 요약

설치에 다음 설정 사용:

설치 디렉터리: /opt/PostgresPlus/9.3AS
데이터 디렉터리: /opt/PostgresPlus/9.3AS/data
WAL 디렉터리: /opt/PostgresPlus/9.3AS/data/pg_xlog
데이터베이스 포트: 5444
데이터베이스 Superuser: enterprisedb
운영 체제 계정: enterprisedb
데이터베이스 서비스: ppas-9.3

계속하려면 [Enter] 키 누르기:
----------------------------------------------------------------------------
이제 컴퓨터에 Postgres Plus Advanced Server을(를) 설치할 준비가 되었습니다.
계속하시겠습니까? [Y/n]: Y


3.15 설치 바이너리 파일 설치 실행

----------------------------------------------------------------------------
컴퓨터에 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 설치 ...
 pgpool-II 설치 ...
 PgBouncer 설치 ...
 StackBuilder Plus 설치 ...
 #

----------------------------------------------------------------------------
컴퓨터에 Postgres Plus Advanced Server 설치를 완료했습니다.


4. 서비스 실행


4.1 실행 스크립트 확인

[root@dev1 bin]# ls -al /etc/rc.d/init.d/ppas-*
-rwxr-xr-x 1 root root 3005 Jan 28 08:44 /etc/rc.d/init.d/ppas-9.3
-rwxr-xr-x 1 root root 2341 Jan 28 08:45 /etc/rc.d/init.d/ppas-agent-9.3
-rwxr-xr-x 1 root root 1688 Jan 28 08:45 /etc/rc.d/init.d/ppas-infinitecache-9.3
-rwxr-xr-x 1 root root 2700 Jan 28 08:46 /etc/rc.d/init.d/ppas-pgpool-9.3
-rwxr-xr-x 1 root root 2695 Jan 28 08:45 /etc/rc.d/init.d/ppas-replication-9.3


4.2 ppas-9.3 start

[root@dev1 bin]# /etc/rc.d/init.d/ppas-9.3 start
[root@dev1 bin]# /etc/rc.d/init.d/ppas-9.3 status
pg_ctl: server is running (PID: 3857)
/opt/PostgresPlus/9.3AS/bin/edb-postgres "-D" "/opt/PostgresPlus/9.3AS/data" 
tcp 0 0 0.0.0.0:5444 0.0.0.0:* LISTEN 3857/edb-postgres


4.3 ppas-agent-9.3 start

[root@dev1 bin]# /etc/rc.d/init.d/ppas-agent-9.3 start
ppas-agent-9.3 started
[root@dev1 bin]# /etc/rc.d/init.d/ppas-agent-9.3 status
ppas-agent-9.3 is running (PID: 6493)

tcp        0      0 127.0.0.1:57719             127.0.0.1:5444              ESTABLISHED 6493/pgagent


5. 데이터 베이스 연결 확인

[iparkm@dev1 9.3AS]$ psql -p 5444  -U enterprisedb edb
Password for user enterprisedb:edb
psql (8.4.18, server 9.3.1.3)
WARNING: psql version 8.4, server version 9.3.
         Some psql features might not work.
Type "help" for help.

edb=#


5.1 data/pg_hba.conf 접근제어

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local     all             all                                     md5
host    all         all         127.0.0.1/32          trust
host    all         all         ::1/128               trust
host    all         all         10.20.4.0/24          trust
host    all         all         180.70.96.0/24          trust
#hostssl    all         all         10.20.4.0/24          trust
#hostssl    all         all         180.70.96.0/24          trust


5.2 JDBC Drivers


* JAVA_HOME/jre/lib/ext directory  에 jdbc 드라이버를 복사한다.


 http://www.enterprisedb.com/downloads/third-party-jdbc-drivers Oracle Client Connectivity 

 : ojdbc14.jar MySQL Client Connectivity : 

 (mysql-connector-java-5.0.8-bin.jar) 

 Download the mysql-connector-java-5.0.8-bin.jar file and place it in the JAVA_HOME/jre/lib/ext directory. 

 


6. uninstall

  PPAS Component     Uninstaller Name            By default, resides in
  --------------     ----------------            ----------------------
  Connectors         uninstall-connectors        /opt/PostgresPlus/9.3AS/connectors
  EDB*Plus           uninstall-edbplus           /opt/PostgresPlus/9.3AS/edbplus
  StackBuilder Plus  uninstall-stackbuilderplus  /opt/PostgresPlus/9.3AS/stackbuilderplus
  PEM Client         uninstall-pemclient         /opt/PostgresPlus/9.3AS/client

To uninstall Advanced Server and all of the supporting modules, assume superuser
privileges, navigate to the directory that contains the uninstaller, and enter:

    ./uninstall-ppas_complete


7. Connections with SSL

http://www.enterprisedb.com/docs/en/9.0/pg/ssl-tcp.html
To create a quick self-signed certificate for the server, use the following OpenSSL command: 

openssl req -new -text -out server.reqFill out the information that openssl asks for. Make sure you enter the local host name as "Common Name"; the challenge password can be left blank. The program will generate a key that is passphrase protected; it will not accept a passphrase that is less than four characters long. To remove the passphrase (as you must if you want automatic start-up of the server), run the commands: 

openssl rsa -in privkey.pem -out server.key
rm privkey.pemEnter the old passphrase to unlock the existing key. Now do: 

openssl req -x509 -in server.req -text -key server.key -out server.crtto turn the certificate into a self-signed certificate and to copy the key and certificate to where the server will look for them. Finally do: 

chmod og-rwx server.keybecause the server will reject the file if its permissions are more liberal than this. For more details on how to create your server private key and certificate, refer to the OpenSSL documentation. 


7.1 make ssl key

 openssl req -new -text -out server.req

[root@dev1 etc]# openssl req -new -text -out server.req
[root@dev1 ssl]# openssl req -new -text -out server.req
Generating a 2048 bit RSA private key
..........................+++
.......+++
writing new private key to 'privkey.pem'
Enter PEM pass phrase:interpark
Verifying - Enter PEM pass phrase:interpark
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:KO
State or Province Name (full name) []:Korea
Locality Name (eg, city) [Default City]:Seoul
Organization Name (eg, company) [Default Company Ltd]:interpark
Organizational Unit Name (eg, section) []:devlopment
Common Name (eg, your name or your server's hostname) []:edb
Email Address []:edb@interpark.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

openssl rsa -in privkey.pem -out server.key

[root@dev1 ssl]# openssl rsa -in privkey.pem -out server.key
Enter pass phrase for privkey.pem:interpark
writing RSA key
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod og-rwx server.key

chown -R enterprisedb:enterprisedb  *
-rw-r--r-- 1 enterprisedb enterprisedb 1834 Jan 28 09:21 privkey.pem
-rw-r--r-- 1 enterprisedb enterprisedb 4535 Jan 28 09:23 server.crt
-rw------- 1 enterprisedb enterprisedb 1675 Jan 28 09:22 server.key
-rw-r--r-- 1 enterprisedb enterprisedb 3546 Jan 28 09:21 server.req


7.2 postgressql.conf

ssl = on                                # (change requires restart)
ssl_cert_file = '/opt/PostgresPlus/9.3AS/etc/ssl/server.crt'            # (change requires restart)
ssl_key_file = '/opt/PostgresPlus/9.3AS/etc/ssl/server.key'             # (change requires restart)


7.3 서비스 재기동

[root@dev1 ssl]# /etc/rc.d/init.d/ppas-9.3 start
Starting Postgres Plus Advanced Server 9.3:
waiting for server to start.... done
server started
Postgres Plus Advanced Server 9.3 started successfully


7.4 작동 상태 확인 

   작동 상태 확인은 다음과 같이 startup.log 파일을 확인합니다. ( tail -f data/pg_log/startup.log )

2014-01-28 09:28:13 KST 치명적오류: 서버 인증서 파일 "etc/ssl/server.crt"을 불러들일 수 없습니다: 그런 파일이나 디렉터由 2014-01-28 09:29:39 KST 로그: ** EnterpriseDB Dynamic Tuning Agent ******************************************** * System Utilization: 66 % * * Database Version: 9.3.1.3 * * Operating System Version: * * Number of Processors: 0 * * Processor Type: * * Processor Architecture: * * Database Size: 0.1 GB * * RAM: 3.9 GB * * Shared Memory: 3923 MB * * Max DB Connections: 0 * * Autovacuum: on * * Autovacuum Naptime: 60 Seconds * * InfiniteCache: off * * InfiniteCache Servers: 0 * * InfiniteCache Size: 0.000 GB * ********************************************************************************* 2014-01-28 09:29:39 KST 로그: "$libdir/dbms_pipe" 라이브러리 로드 완료 2014-01-28 09:29:39 KST 로그: "$libdir/edb_gen" 라이브러리 로드 완료 2014-01-28 09:29:39 KST 로그: redirecting log output to logging collector process 2014-01-28 09:29:39 KST 힌트: Future log output will appear in directory "pg_log".



728x90
반응형