Search code examples
postgres-xl

installing postgres-xl in linux in distributed environment


I am very new to postgres-xl. I am planning to use it to my application. There is no properdocumentation to download and install in distributed mode. Please guide me, from where to download, install, configuration, what are the dependent packages for centOS 6 to support postgres-xl, what are the services need to start and how to start them, configuration changes for distributed environment.In a distribued environment, what are the services to start and how. Please guide me. Thanks..!


Solution

  • Following are key points to install Postgres-XL. Detailed information, please see https://ruihaijiang.wordpress.com/2015/09/17/postgres-xl-installation-example-on-linux/

    1. Plan your hosts, IP, ports, etc. For example,

    GTM:
    hostname=host1
    nodename=gtm
    IP=192.168.187.130
    port=6666
    
    Coordinator:
    hostname=host2
    nodename=coord1
    IP=192.168.187.131
    pooler_port=6668,port=5432
    
    Datanode1:
    hostname=host3
    nodename=datanode1
    IP=192.168.187.132
    pooler_port=6669, port=15432
    
    Datanode2:
    hostname=host4
    nodename=datanode2
    IP=192.168.187.133
    pooler_port=6670, port=15433
    

    2. Write your pgxc_ctl.conf

    #user and path
    pgxcOwner=postgres
    pgxcUser=$pgxcOwner
    pgxcInstallDir=/usr/local/pgsql
    
    #gtm and gtmproxy
    gtmMasterDir=$HOME/pgxc/nodes/gtm
    gtmMasterPort=6666
    gtmMasterServer=192.168.187.130
    gtmSlave=n
    
    #gtm proxy
    gtmProxy=n
    
    #coordinator
    coordMasterDir=$HOME/pgxc/nodes/coord
    coordNames=(coord1)
    coordPorts=(5432)
    poolerPorts=(6668)
    coordPgHbaEntries=(192.168.187.0/24)
    coordMasterServers=(192.168.187.131)
    coordMasterDirs=($coordMasterDir/coord1)
    coordMaxWALsernder=0
    coordMaxWALSenders=($coordMaxWALsernder)
    coordSlave=n
    coordSpecificExtraConfig=(none none none)
    coordSpecificExtraPgHba=(none none none)
    
    #datanode
    datanodeNames=(datanode1 datanode2)
    datanodePorts=(15432 15433)
    datanodePoolerPorts=(6669 6670)
    datanodePgHbaEntries=(192.168.187.0/24)
    datanodeMasterServers=(192.168.187.132 192.168.187.133)
    datanodeMasterDir=$HOME/pgxc/nodes/dn_master
    datanodeMasterDirs=($datanodeMasterDir/datanode1  $datanodeMasterDir/datanode2)
    datanodeMaxWalSender=0
    datanodeMaxWALSenders=($datanodeMaxWalSender $datanodeMaxWalSender)
    datanodeSlave=n
    primaryDatanode=datanode1
    

    3. Configure ssh authentication to avoid inputing password for pgxc_ctl

    This really spent me a few days.
    
    On host1, generate the authentication key file,
    ssh-keygen -t rsa (Just press ENTER for all input values)
    cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
    
    On host1, upload file authorized_keys to host2, host3 and host3, as following,
    scp ~/.ssh/authorized_keys [email protected]:~/.ssh/
    scp ~/.ssh/authorized_keys [email protected]:~/.ssh/
    scp ~/.ssh/authorized_keys [email protected]:~/.ssh/
    
    On every host, run following commands,
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/authorized_keys
    
    On host1, try to connect host2, host3 and host4, make sure no password is needed,
    ssh [email protected]
    ssh [email protected]
    ssh [email protected]
    

    4. Run pgxc_ctl to configure and start the cluster

    At host1, run following command:
    pgxc_ctl init all