pg_recvlogical

제목

pg_recvlogical -- PostgreSQL 논리 디코딩 스트림 제어

요약

pg_recvlogical [옵션...]

설명

pg_recvlogical 명령은 논리 디코딩 복제 슬롯과 그 복제 슬롯에서 보내는 스트림 자료를 제어한다.

이 명령은 복제용 연결을 사용한다. 이런 이유로 pg_receivexlog 명령어의 제약 사항과 같은 제약 사항이 있다. 더불어 논리 복제의 제약 사항도 있다. (46장 참조)

옵션

이 명령어가 정상 작동 되려면 다음 옵션 가운데 하나 이상은 반드시 지정해야 한다:

--create-slot

--dbname 옵션으로 지정한 데이터베이스에 대해서, --slot 옵션으로 지정한 이름의 논리 복제 슬롯을 만들고, --plugin 옵션으로 지정한 출력 플러그인을 사용한다.

--drop-slot

--slot 옵션으로 지정한 이름의 슬롯을 삭제하고 종료한다.

--start

--slot 옵션으로 지정한 슬롯을 통해 넘어오는 내역을 출력하며, 이 작업은 시그널 신호로 종료되기 전까지 계속 진행한다. --no-loop 옵션을 지정하지 않으면, 이 출력 작업은 운영 서버의 종료되거나, 재시작되어도 계속 된다.

출력 양식은 슬롯을 만들때 지정한 플러그인의 양식을 따른다.

원본 서버 연결 정보는 그 슬롯을 만들때와 같아야 한다.

--create-slot 옵션과 --start 옵션은 같이 사용할 수 있다. --drop-slot 옵션은 같이 사용할 수 없다.

다음 옵션들은 복제 관련 위치, 출력 양식, 기타 복제 기능들을 지정하는 것들이다:

-f 파일이름
--file=파일이름

복제 내용을 해당 파일로 기록한다. 파일이름으로 - 문자를 지정하면, stdout (표준출력)으로 보낸다.

-F 간격_초
--fsync-interval=간격_초

지정한 초 단위 간격으로 pg_recvlogical 명령은 해당 자료를 안전하게 보관하기 위해서, fsync() 함수를 호출한다.

The server will occasionally request the client to perform a flush and report the flush position to the server. This setting is in addition to that, to perform flushes more frequently.

이 값을 0으로 지정하면, 원본 서버에 진행 사항을 보고하기 전까지, fsync() 함수를 호출하지 않는다. 이렇게 지정하면 이 명령이 갑자기 종료될 경우 자료 손실이 있을 수 있다.

-I lsn
--startpos=lsn

In --start mode, start replication from the given LSN. For details on the effect of this, see the documentation in 46장 and 50.3절. Ignored in other modes.

--if-not-exists

--create-slot 옵션과 함께 쓰이며, 해당 슬롯이 없는 경우에만 그 슬롯을 만든다.

-n
--no-loop

원본 서버와의 접속이 끊기면 종료한다.

-o 이름[=]
--option=이름[=]

출력 플러그인에서 사용하는 옵션들을 이름[=] 형태로 지정한다. 이 옵션 이름은 해당 출력 플러그인 문서를 참조해야 한다.

-P 출력플러그인
--plugin=출력플러그인

슬롯을 만들 때 지정한 그 플러그인 이름을 지정한다. 자세한 설명은 46장을 참조한다. 이 옵션은 이미 해당 슬롯이 만들어진 상황이라면 무시된다.

-s 간격_초
--status-interval=간격_초

이 옵션은 pg_receivexlog 명령의 옵션과 같다. 자세한 설명은 그 명령어 설명서를 참조한다.

-S 슬롯이름
--slot=슬롯이름

--start 옵션을 지정할 경우 사용할 슬롯이름을 지정한다. --create-slot 옵셥과 함께 쓰이면, 해당 이름의 슬롯을 만들고, --drop-slot 옵션과 함께 쓰이면, 해당 이름의 슬롯을 삭제한다.

-v
--verbose

작업 상황을 보다 자세히 출력한다.

다음 옵션들은 원본 데이터베이스 서버 접속에 관련된 옵션들이다:

-d 데이터베이스
--dbname=데이터베이스

The database to connect to. See the description of the actions for what this means in detail. This can be a libpq connection string; see 31.1.1절 for more information. Defaults to user name.

-h 호스트이름-또는-IP
--host=호스트이름-또는-IP

Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the PGHOST environment variable, if set, else a Unix domain socket connection is attempted.

-p 포트
--port=포트

Specifies the TCP port or local Unix domain socket file extension on which the server is listening for connections. Defaults to the PGPORT environment variable, if set, or a compiled-in default.

-U 사용자이름
--username=사용자이름

User name to connect as. Defaults to current operating system user name.

-w
--no-password

Never issue a password prompt. If the server requires password authentication and a password is not available by other means such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.

-W
--password

Force pg_recvlogical to prompt for a password before connecting to a database.

This option is never essential, since pg_recvlogical will automatically prompt for a password if the server demands password authentication. However, pg_recvlogical will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt.

다음 옵션들은 부가 옵션이다:

-V
--version

Print the pg_recvlogical version and exit.

-?
--help

Show help about pg_recvlogical command line arguments, and exit.

환경변수

이 명령어는 libpq 라이브러리를 사용함으로 대부분의 PostgreSQL 응용 프로그램처럼 해당 라이브러리에서 사용한 환경 변수를 그대로 사용할 수 있다. (31.14절 참조).

예제

46.1절 참조

관련 항목

pg_receivexlog