# yum install -y wget vim gcc make kernel-devel perl-ExtUtils-MakeMaker perl-ExtUtils-Embed readline-devel zlib-devel openssl-devel pam-devel libxml2-devel openldap-devel tcl-devel python-devel flex bison docbook-style-dsssl libxslt
# yum update -y
# wget http://sourceforge.net/projects/postgres-xl/files/latest/download # mv download pgxl-9.2.src.tar.gz
# wget http://sourceforge.net/projects/postgres-xl/files/latest/download -O pgxl-9.2.src.tar.gz
# cp pgxl-9.2.src.tar.gz /usr/local/src/ # cd /usr/local/src/ # tar -xzvf pgxl-9.2.src.tar.gz
# ls
# useradd postgres # passwd postgres
# chown -R postgres.postgres postgres-xl # cd postgres-xl
# ./configure --with-tcl --with-perl --with-python --with-pam --with-ldap --with-openssl --with-libxml
# ./configure
# ./configure --prefix=/usr/local/pgsql --disable-rpath
# su postgres $ gmake world
# su postgres -c 'gmake world'
Postgres-XL, contrib and HTML documentation successfully made. Ready to install.
# gmake install-world
# echo 'export PGUSER=postgres' >> /etc/profile # echo 'export PGHOME=/usr/local/pgsql' >> /etc/profile # echo 'export PATH=$PATH:$PGHOME/bin' >> /etc/profile # echo 'export LD_LIBRARY_PATH=$PGHOME/lib' >> /etc/profile
# exit
# mkdir $PGHOME/gtm_data # chown -R postgres.postgres $PGHOME/gtm_data # su - postgres -c "initgtm -Z gtm -D $PGHOME/gtm_data"
# mkdir -p $PGHOME/data/data_gtm_proxy1 # mkdir -p $PGHOME/data/data_coord1 # mkdir -p $PGHOME/data/data_datanode1 # chown -R postgres.postgres $PGHOME/data/ # su - postgres -c "initdb -D $PGHOME/data/data_coord1/ --nodename coord1" # su - postgres -c "initdb -D $PGHOME/data/data_datanode1/ --nodename datanode1" # su - postgres -c "initgtm -D $PGHOME/data/data_gtm_proxy1/ -Z gtm_proxy"
# mkdir -p $PGHOME/data/data_gtm_proxy2 # mkdir -p $PGHOME/data/data_coord2 # mkdir -p $PGHOME/data/data_datanode2 # chown -R postgres.postgres $PGHOME/data/ # su - postgres -c "initdb -D $PGHOME/data/data_coord2/ --nodename coord2" # su - postgres -c "initdb -D $PGHOME/data/data_datanode2/ --nodename datanode2" # su - postgres -c "initgtm -D $PGHOME/data/data_gtm_proxy2/ -Z gtm_proxy"
# vi $PGHOME/gtm_data/gtm.conf nodename = 'gtm_master' listen_addresses = '*' port = 6666 startup = ACT log_file = 'gtm.log' log_min_messages = WARNING
# vi $PGHOME/gtm_data/gtm.conf nodename = 'gtm_slave' listen_addresses = '*' port = 6666 startup = STANDBY active_host = 'GTM1' # IP GTM , '192.168.1.100' active_port = 6666 log_file = 'gtm.log' log_min_messages = WARNING
# vi $PGHOME/data/data_gtm_proxy1/gtm_proxy.conf nodename = 'gtm_proxy1' listen_addresses = '*' port = 6666 gtm_host = 'GTM1' gtm_port = 6666 log_file = 'gtm_proxy1.log' log_min_messages = WARNING
# vi $PGHOME/data/data_coord1/postgresql.conf listen_addresses = '*' port = 5432 pooler_port = 6667 gtm_host = 'localhost' # / gtm_proxy, - localhost gtm_port = 6666 pgxc_node_name = 'coord1'
# vi $PGHOME/data/data_coord1/pg_hba.conf host all all 192.168.1.0/24 trust
# vi $PGHOME/data/data_datanode1/postgresql.conf listen_addresses = '*' port = 15432 pooler_port = 6668 gtm_host = 'localhost' gtm_port = 6666 pgxc_node_name = 'datanode1'
# vi $PGHOME/data/data_datanode1/pg_hba.conf host all all 192.168.1.0/24 trust
# vi $PGHOME/data/data_gtm_proxy2/gtm_proxy.conf nodename = 'gtm_proxy2' listen_addresses = '*' port = 6666 gtm_host = 'GTM1' gtm_port = 6666 log_file = 'gtm_proxy2.log' log_min_messages = WARNING
# vi $PGHOME/data/data_coord2/postgresql.conf listen_addresses = '*' port = 5432 pooler_port = 6667 gtm_host = 'localhost' gtm_port = 6666 pgxc_node_name = 'coord2'
# vi $PGHOME/data/data_coord2/pg_hba.conf host all all 192.168.1.0/24 trust
# vi $PGHOME/data/data_datanode2/postgresql.conf listen_addresses = '*' port = 15432 pooler_port = 6668 gtm_host = 'localhost' gtm_port = 6666 pgxc_node_name = 'datanode2'
# vi $PGHOME/data/data_datanode2/pg_hba.conf host all all 192.168.1.0/24 trust
# firewall-cmd --zone=public --add-port=5432/tcp --permanent # firewall-cmd --zone=public --add-port=15432/tcp --permanent # firewall-cmd --zone=public --add-port=6666/tcp --permanent # firewall-cmd --zone=public --add-port=6667/tcp --permanent # firewall-cmd --zone=public --add-port=6668/tcp --permanent # firewall-cmd --reload
# su - postgres $ gtm_ctl start -Z gtm -D $PGHOME/{data_dir} $ gtm_ctl start -Z gtm_proxy -D $PGHOME/{data_dir} $ pg_ctl start -Z datanode -D $PGHOME/{data_dir} $ pg_ctl start -Z coordinator -D $PGHOME/{data_dir}
# cat /usr/local/src/postgres-xl/contrib/start-scripts/linux #! /bin/sh # chkconfig: 2345 98 02 # description: PostgreSQL RDBMS # This is an example of a start/stop script for SysV-style init, such # as is used on Linux systems. You should edit some of the variables # and maybe the 'echo' commands. # # Place this file at /etc/init.d/postgresql (or # /etc/rc.d/init.d/postgresql) and make symlinks to # /etc/rc.d/rc0.d/K02postgresql # /etc/rc.d/rc1.d/K02postgresql # /etc/rc.d/rc2.d/K02postgresql # /etc/rc.d/rc3.d/S98postgresql # /etc/rc.d/rc4.d/S98postgresql # /etc/rc.d/rc5.d/S98postgresql # Or, if you have chkconfig, simply: # chkconfig --add postgresql # # Proper init scripts on Linux systems normally require setting lock # and pid files under /var/run as well as reacting to network # settings, so you should treat this with care. # Original author: Ryan Kirkpatrick <pgsql@rkirkpat.net> # contrib/start-scripts/linux ## EDIT FROM HERE # Installation prefix prefix=/usr/local/pgsql # Data directory PGDATA="/usr/local/pgsql/data" # Who to run the postmaster as, usually "postgres". (NOT "root") PGUSER=postgres # Where to keep a log file PGLOG="$PGDATA/serverlog" # It's often a good idea to protect the postmaster from being killed by the # OOM killer (which will tend to preferentially kill the postmaster because # of the way it accounts for shared memory). Setting the OOM_SCORE_ADJ value # to -1000 will disable OOM kill altogether. If you enable this, you probably # want to compile PostgreSQL with "-DLINUX_OOM_SCORE_ADJ=0", so that # individual backends can still be killed by the OOM killer. #OOM_SCORE_ADJ=-1000 # Older Linux kernels may not have /proc/self/oom_score_adj, but instead # /proc/self/oom_adj, which works similarly except the disable value is -17. # For such a system, enable this and compile with "-DLINUX_OOM_ADJ=0". #OOM_ADJ=-17 ## STOP EDITING HERE # The path that is to be used for the script PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin # What to use to start up the postmaster. (If you want the script to wait # until the server has started, you could use "pg_ctl start -w" here. # But without -w, pg_ctl adds no value.) DAEMON="$prefix/bin/postmaster" # What to use to shut down the postmaster PGCTL="$prefix/bin/pg_ctl" set -e # Only start if we can find the postmaster. test -x $DAEMON || { echo "$DAEMON not found" if [ "$1" = "stop" ] then exit 0 else exit 5 fi } # Parse command line parameters. case $1 in start) echo -n "Starting PostgreSQL: " test x"$OOM_SCORE_ADJ" != x && echo "$OOM_SCORE_ADJ" > /proc/self/oom_score_adj test x"$OOM_ADJ" != x && echo "$OOM_ADJ" > /proc/self/oom_adj su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1 echo "ok" ;; stop) echo -n "Stopping PostgreSQL: " su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast" echo "ok" ;; restart) echo -n "Restarting PostgreSQL: " su - $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w" test x"$OOM_SCORE_ADJ" != x && echo "$OOM_SCORE_ADJ" > /proc/self/oom_score_adj test x"$OOM_ADJ" != x && echo "$OOM_ADJ" > /proc/self/oom_adj su - $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1 echo "ok" ;; reload) echo -n "Reload PostgreSQL: " su - $PGUSER -c "$PGCTL reload -D '$PGDATA' -s" echo "ok" ;; status) su - $PGUSER -c "$PGCTL status -D '$PGDATA'" ;; *) # Print help echo "Usage: $0 {start|stop|restart|reload|status}" 1>&2 exit 1 ;; esac exit 0
# cp /usr/local/src/postgres-xl/contrib/start-scripts/linux /etc/rc.d/init.d/pgxl_gtm # cp /usr/local/src/postgres-xl/contrib/start-scripts/linux /etc/rc.d/init.d/pgxl_gtm_prx # cp /usr/local/src/postgres-xl/contrib/start-scripts/linux /etc/rc.d/init.d/pgxl_dn # cp /usr/local/src/postgres-xl/contrib/start-scripts/linux /etc/rc.d/init.d/pgxl_crd
# vi /etc/rc.d/init.d/pgxl_gtm #! /bin/sh # chkconfig: 2345 98 02 # description: PostgreSQL RDBMS # Installation prefix prefix=/usr/local/pgsql # Data directory PGDATA="$prefix/gtm_data" # Who to run the postmaster as, usually "postgres". (NOT "root") PGUSER=postgres # Where to keep a log file PGLOG="$PGDATA/serverlog" # The path that is to be used for the script PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:$prefix/bin # What to use to shut down the postmaster PGCTL="$prefix/bin/gtm_ctl" # Which cluster role PGROLE="gtm" set -e # Only start if we can find the postmaster. test -x $PGCTL || { echo "$PGCTL not found" if [ "$1" = "stop" ] then exit 0 else exit 5 fi } # Parse command line parameters. case $1 in start) echo -n "Starting PostgreSQL: " test x"$OOM_SCORE_ADJ" != x && echo "$OOM_SCORE_ADJ" > /proc/self/oom_score_adj test x"$OOM_ADJ" != x && echo "$OOM_ADJ" > /proc/self/oom_adj su - $PGUSER -c "$PGCTL start -Z $PGROLE -D '$PGDATA' &" >>$PGLOG 2>&1 echo "ok" ;; stop) echo -n "Stopping PostgreSQL: " su - $PGUSER -c "$PGCTL stop -Z $PGROLE -D '$PGDATA' -m fast" echo "ok" ;; restart) echo -n "Restarting PostgreSQL: " su - $PGUSER -c "$PGCTL stop -Z $PGROLE -D '$PGDATA' -m fast -w" test x"$OOM_SCORE_ADJ" != x && echo "$OOM_SCORE_ADJ" > /proc/self/oom_score_adj test x"$OOM_ADJ" != x && echo "$OOM_ADJ" > /proc/self/oom_adj su - $PGUSER -c "$PGCTL start -Z $PGROLE -D '$PGDATA' &" >>$PGLOG 2>&1 echo "ok" ;; reload) echo -n "Reload PostgreSQL: " su - $PGUSER -c "$PGCTL restart -Z $PGROLE -D '$PGDATA'" echo "ok" ;; status) su - $PGUSER -c "$PGCTL status -Z $PGROLE -D '$PGDATA'" ;; *) # Print help echo "Usage: $0 {start|stop|restart|reload|status}" 1>&2 exit 1 ;; esac exit 0
# vi /etc/rc.d/init.d/pgxl_gtm_prx PGDATA="$prefix/data/data_gtm_proxy1" PGCTL="$prefix/bin/gtm_ctl" PGROLE="gtm_proxy"
# vi /etc/rc.d/init.d/pgxl_gtm_prx PGDATA="$prefix/data/data_gtm_proxy2" PGCTL="$prefix/bin/gtm_ctl" PGROLE="gtm_proxy"
# vi /etc/rc.d/init.d/pgxl_crd PGDATA="$prefix/data/data_coord1" PGCTL="$prefix/bin/pg_ctl" PGROLE="coordinator"
# vi /etc/rc.d/init.d/pgxl_crd PGDATA="$prefix/data/data_coord2" PGCTL="$prefix/bin/pg_ctl" PGROLE="coordinator"
# vi /etc/rc.d/init.d/pgxl_dn PGDATA="$prefix/data/data_datanode1" PGCTL="$prefix/bin/pg_ctl" PGROLE="datanode"
# vi /etc/rc.d/init.d/pgxl_dn PGDATA="$prefix/data/data_datanode2" PGCTL="$prefix/bin/pg_ctl" PGROLE="datanode"
# chmod a+x /etc/rc.d/init.d/pgxl_gtm # chmod a+x /etc/rc.d/init.d/pgxl_gtm_prx # chmod a+x /etc/rc.d/init.d/pgxl_crd # chmod a+x /etc/rc.d/init.d/pgxl_dn
# chkconfig --add pgxl_gtm # chkconfig --add pgxl_gtm_prx # chkconfig --add pgxl_crd # chkconfig --add pgxl_dn
# service pgxl_gtm start # service pgxl_gtm_prx start # service pgxl_crd start # service pgxl_dn start
# service pgxl_gtm status # service pgxl_gtm_prx status # service pgxl_crd status # service pgxl_dn status
# su - postgres $ psql -p 5432 -c "DELETE FROM pgxc_node" $ psql -p 5432 -c "CREATE NODE coord1 WITH (TYPE='coordinator',HOST='192.168.1.102',PORT=5432)" $ psql -p 5432 -c "CREATE NODE coord2 WITH (TYPE='coordinator',HOST='192.168.1.103',PORT=5432)" $ psql -p 5432 -c "CREATE NODE datanode1 WITH (TYPE='datanode',HOST='192.168.1.102',PORT=15432)" $ psql -p 5432 -c "CREATE NODE datanode2 WITH (TYPE='datanode',HOST='192.168.1.103',PORT=15432)"
$ psql -p 5432 -c "select * from pgxc_node"
$ psql -p 5432 -c "select pgxc_pool_reload()"
STATEMENT: insert into test select 112233445566, 0123456789; ERROR: Invalid Datanode number
STATEMENT: SET global_session TO coord2_21495; SET datestyle TO iso; SET client_min_messages TO notice; SET client_encoding TO UNICODE; SET bytea_output TO escape; ERROR: Invalid Datanode number STATEMENT: Remote Subplan ERROR: node "coord2_21580" does not exist STATEMENT: SET global_session TO coord2_21580; SET datestyle TO iso; SET client_min_messages TO notice; SET client_encoding TO UNICODE; SET bytea_output TO escape; ERROR: Invalid Datanode number STATEMENT: Remote Subplan ERROR: Invalid Datanode number STATEMENT: Remote Subplan ERROR: Invalid Datanode number STATEMENT: Remote Subplan LOG: Will fall back to local snapshot for XID = 96184, source = 0, gxmin = 0, autovac launch = 0, autovac = 0, normProcMode = 0, postEnv = 1 ERROR: node "coord2_22428" does not exist STATEMENT: SET global_session TO coord2_22428; ERROR: Invalid Datanode number
$ psql -p 5432 -c "EXECUTE DIRECT ON (datanode1) 'DELETE FROM pgxc_node'" $ psql -p 5432 -c "EXECUTE DIRECT ON (datanode1) 'create NODE coord1 WITH (TYPE=''coordinator'',HOST=''192.168.1.102'',PORT=5432)'" $ psql -p 5432 -c "EXECUTE DIRECT ON (datanode1) 'create NODE coord2 WITH (TYPE=''coordinator'',HOST=''192.168.1.103'',PORT=5432)'" $ psql -p 5432 -c "EXECUTE DIRECT ON (datanode1) 'create NODE datanode1 WITH (TYPE=''datanode'',HOST=''192.168.1.102'',PORT=15432)'" $ psql -p 5432 -c "EXECUTE DIRECT ON (datanode1) 'create NODE datanode2 WITH (TYPE=''datanode'',HOST=''192.168.1.103'',PORT=15432)'" $ psql -p 5432 -c "EXECUTE DIRECT ON (datanode1) 'SELECT pgxc_pool_reload()'"
EXECUTE DIRECT ON (datanode1)
EXECUTE DIRECT ON (datanode2)
'/ usr / bin / perl' /bin/collateindex.pl -f -g -i 'bookindex' -o bookindex.sgml HTML.index Can't open perl script "/bin/collateindex.pl": No such file or directory make [4]: ​​*** [bookindex.sgml] Error 2 make [4]: ​​Leaving directory `/ usr / local / src / postgres-xl / doc-xc / src / sgml ' make [3]: *** [sql_help.h] Error 2 make [3]: Leaving directory `/ usr / local / src / postgres-xl / src / bin / psql ' make [2]: *** [all-psql-recurse] Error 2 make [2]: Leaving directory `/ usr / local / src / postgres-xl / src / bin ' make [1]: *** [all-bin-recurse] Error 2 make [1]: Leaving directory `/ usr / local / src / postgres-xl / src ' make: *** [all-src-recurse] Error 2
Source: https://habr.com/ru/post/261457/
All Articles