티스토리 뷰

Database

PostgreSQL 간단 가이드

파란크리스마스 2007. 8. 1. 08:04
728x90
참고 사이트

http://www.hqunix.com/wp/?p=266
http://blog.naver.com/ladom/60026225972
http://www.linux.com/guides/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/chap27sec224.shtml

사용자 만들기

C:\Documents and Settings\bluesanta>net user postgres 1234 /add
명령을 잘 실행했습니다.

postgres 사용자로 cmd 실행하기

C:\Documents and Settings\bluesanta>runas /user:postgres cmd
postgres의 암호 입력:
cmd을(를) 사용자 "SHRYU\postgres"(으)로 시작하려고 합니다...

데이타베이스 생성

C:\WINDOWS\system32>cd \pgsql

C:\pgsql>path C:\pgsql\lib;%path%

C:\pgsql>bin\initdb -D data -E unicode --no-locale
이 데이터베이스 시스템에서 만들어지는 파일들은 그 소유주가 "postgres" id로
지정될 것입니다. 또한 이 사용자는 서버 프로세스의 소유주가 됩니다.

데이터베이스 클러스터는 C 로케일로 초기화 될 것입니다.

data 디렉토리 만드는 중 ...완료
data/global 디렉토리 만드는 중 ... 완료
data/pg_xlog 디렉토리 만드는 중 ... 완료
data/pg_xlog/archive_status 디렉토리 만드는 중 ... 완료
data/pg_clog 디렉토리 만드는 중 ... 완료
data/pg_subtrans 디렉토리 만드는 중 ... 완료
data/pg_twophase 디렉토리 만드는 중 ... 완료
data/pg_multixact/members 디렉토리 만드는 중 ... 완료
data/pg_multixact/offsets 디렉토리 만드는 중 ... 완료
data/base 디렉토리 만드는 중 ... 완료
data/base/1 디렉토리 만드는 중 ... 완료
data/pg_tblspc 디렉토리 만드는 중 ... 완료
max_connections 초기값을 선택하는 중 ...100
shared_buffers 초기값을 선택하는 중 ...1000
환경설정 파일을 만드는 중 ...완료
data/base/1 안에 template1 데이터베이스를 만드는 중 ...완료
initializing pg_authid ... 완료
시스템 테이블들을 위한 제한 없는 로우 크기를 활성화 하고 있음 ...완료
initializing dependencies ... 완료
시스템 뷰들을 만드는 중 ... 완료
pg_description 자료 입력 중 ...완료
인코딩 변환규칙(conversion)들을 만드는 중 ...완료
내장객체들의 접근 권한을 설정 중 ... 완료
information schema 만드는 중 ...완료
template1 데이터베이스 vacuum 작업 중 ...완료
template1 데이터베이스를 template0 데이터베이스로 복사 중 ...완료
copying template1 to postgres ... 완료

경고: 로컬 연결의 인증 방법을 "trust" 방식을 지정했습니다.
이 값을 바꾸려면, pg_hba.conf 파일을 수정하든지,
다음번 initdb 명령을 사용할 때, -A 옵션을 사용해서 인증방식을 지정할 수 있습니다
.

Success. You can now start the database server using:

    "bin\postmaster" -D "data"
or
    "bin\pg_ctl" -D "data" -l logfile start


C:\pgsql>

NT 서비스에 등록

C:\Documents and Settings\shryu>cd \pgsql\bin

C:\pgsql\bin>pg_ctl register -N postmaster -U postgres -P 1234 -D c:\pgsql\data

PostgreSQL 서버 실행하기

C:\pgsql\bin>net start postmaster
postmaster 서비스를 시작합니다..
postmaster 서비스가 잘 시작되었습니다.

커맨드 실행

c:\pgsql\bin\psql -U postgres template1

외부 스크립트 실행

c:\pgsql\bin\psql -U postgres < D:\DB_DDL\data.20061014.sql

Port 수정

C:\pgsql\data\postgresql.conf

# 제거후, 수정하고 싶은 Port 번호로 변경하고 데이타베이스 재실행

#port = 5432

리눅스 서비스로 등록

- 서비스에 등록

[root@localhost ~]# cp postgresql-8.1.4/contrib/start-scripts/linux /etc/rc.d/init.d/postgresql
[root@localhost ~]# chmod 755 /etc/rc.d/init.d/postgresql
[root@localhost ~]# chkconfig --add postgresql
[root@localhost ~]# chkconfig --level 2345 postgresql on

- /etc/rc.d/init.d/postgresql 수정

prefix, PGDATA의 경로를 설치되어 있는 경로로 설정합니다.

prefix=/usr/local/pgsql-8.1.4
PGDATA=/usr/local/pgsql-8.1.4/data

- SELinux 비활성화(방화벽으로 실행이 안될경우 사용)

/etc/selinux/config에 SELINUX=disabled 설정
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함