Mac용 Docker에 Postgres XL 설치

2017. 11. 24. 18:47서버 프로그래밍

AWS의 EBS만으로 저렴하게 대용량의 클러스터를 구성하여 처리할 수 있다는 이유로 "Postgres XL"을 테스트해보기로 했다. RDBMS인 PostgreSQL을 이용하여 NOSQL처럼 처리가 가능하다고 한다. 텐센트에서도도 사용한다고 하는데, 레퍼런스가 너무나도 부족하다.

https://pgconf.ru/media/2017/04/06/20170316H1_Jasonysli_PGXC_In_Tencent_Moscow.pdf


처음에는 Mac OS X에 Postgres XL을 설치하려고 했으나, Linux에서만 설치되는 것 같아서 Docker를 사용하기로 했다.

https://www.postgres-xl.org/documentation/intro-whatis-postgres-xl.html

https://www.postgres-xl.org/documentation/tutorial-createcluster.html

https://www.postgres-xl.org/documentation/install-procedure.html


윈도우즈기반-도커에-postgres-xl-설치하기

http://www.popit.kr/%EC%9C%88%EB%8F%84%EC%9A%B0%EC%A6%88%EA%B8%B0%EB%B0%98-%EB%8F%84%EC%BB%A4%EC%97%90-postgres-xl-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0/


Postgres-XL Installation Example on Linux

https://ruihaijiang.wordpress.com/2015/09/17/postgres-xl-installation-example-on-linux/


초보를 위한 도커 안내서 - 도커란 무엇인가?

https://subicura.com/2017/01/19/docker-guide-for-beginners-1.html


일반적인 방법으로 Centos Docker로 세팅을 하면 "Failed to get D-Bus connection: Operation not permitted" 에러가 발생한다. 

이것은 다음 포스팅을 참고하면 해결 할 수 있다.


Centos 에 Docker 설치하기

http://www.daftdevil.com/17


그래도 역시 빠진 패키지들이 있어서 일일이 찾아서 추가해준다.

yum reinstall initscripts

https://superuser.com/questions/774291/centos-6-5-bash-service-command-not-found

sudo yum install openssh-server

https://serverfault.com/questions/741760/unable-to-start-openssh-service-in-centos-7-1

yum -y install readline-devel.x86_64

yum -y install zlib.x86_64 zlib-devel.x86_64

https://m.blog.naver.com/PostView.nhn?blogId=lionlyloveil&logNo=220721358000&proxyReferer=https%3A%2F%2Fwww.google.co.kr%2F


윈도기반 도커에 PostgresXL을 설치한 예제에 pgxc_ctl.conf 이 잘못 적혀 있어서 불필요한 것으로 헤맸다. 


pgxcOwner=$USER

pgxcUser=$pgxcOwner

tmpDir=/tmp/pgxl

localTmpDir=$tmpDir

configBackup=n

pgxcInstallDir=$TARGET_DIR


gtmName=gtm

gtmMasterServer=localhost

gtmMasterPort=20001

gtmMasterDir=$DATA_DIR/gtm

gtmSlave=n

gtmProxy=n


coordMasterDirs=($DATA_DIR/coord)

coordNames=(coord)

coordMasterServers=(localhost)

coordPorts=($USER_DB_PORT)

poolerPorts=(20002)

coordMaxWALSenders=(5)

coordSlave=n


datanodeMasterDirs=($DATA_DIR/data1 $DATA_DIR/data2)

datanodeNames=(data1 data2)

datanodeMasterServers=(localhost localhost)

datanodePorts=(3001 3002)

datanodePoolerPorts=(4001 4002)

datanodeMaxWALSenders=(5 5)

datanodeSpecificExtraConfig=(none none)

datanodeSpecificExtraPgHba=(none none)

datanodeSlave=n


coordExtraConfig=$TARGET_DIR/share/postgresql/postgresql.coordinator.conf

datanodeExtraConfig=$TARGET_DIR/share/postgresql/postgresql.datanode.conf



겨우 세팅 문제를 해결하고 실행을 하면 command not found 가 여러개 뜬다. 하라는대로 열심히 따라했는데 없다는 게 뭐 이리 많은지 원....


[postgres@moby pgxl]$ ./pgxc_ctl init all

/bin/bash

Installing pgxc_ctl_bash script as /svc/pgxl/pgxc_ctl_bash.

Installing pgxc_ctl_bash script as /svc/pgxl/pgxc_ctl_bash.

Reading configuration using /svc/pgxl/pgxc_ctl_bash --home /svc/pgxl --configuration /svc/pgxl/pgxc_ctl.conf

Finished reading configuration.

   ******** PGXC_CTL START ***************


Current directory: /svc/pgxl

Initialize GTM master

ERROR: target directory (/data/pgxl/nodes/gtm) exists and not empty. Skip GTM initilialization

bash: gtm: command not found

bash: gtm_ctl: command not found

Done.

Start GTM master

bash: gtm_ctl: command not found

Initialize all the coordinator masters.

Initialize coordinator master coord.

ERROR: target directory (/data/pgxl/nodes/coord) exists and not empty. Skip Coordinator initilialization

Done.

Starting coordinator master.

Starting coordinator master coord

bash: pg_ctl: command not found

Done.

Initialize all the datanode masters.

Initialize the datanode master data1.

Initialize the datanode master data2.

ERROR: target directory (/data/pgxl/nodes/data1) exists and not empty. Skip Datanode initilialization

ERROR: target directory (/data/pgxl/nodes/data2) exists and not empty. Skip Datanode initilialization

Done.

Starting all the datanode masters.

Starting datanode master data1.

Starting datanode master data2.

bash: pg_ctl: command not found

bash: pg_ctl: command not found

Done.

psql: could not connect to server: Connection refused

Is the server running on host "localhost" (::1) and accepting

TCP/IP connections on port 5432?

could not connect to server: Connection refused

Is the server running on host "localhost" (127.0.0.1) and accepting

TCP/IP connections on port 5432?

Done.

Done.


우선, PostgresXL만 있으면 되는 줄 알았는데 PostgreSQL을 찾는 것 같아서 PostgresSQL도 설치했다.

http://altkeycode.tistory.com/9


하지만 아직 안끝났다!