Polardb开源版本初探

Deployment from Source Code

We extend a tool named as pgxc_ctl from PG-XC/PG-XL open source project to support cluster management, such as configuration generation, configuration modification, cluster initialization, starting/stopping nodes, and switchover, etc. Its detail usage can be found deployment.

  • download source code
  • install dependency packages (use Centos as an example)
sudo yum install libzstd-devel libzstd zstd cmake openssl-devel protobuf-devel readline-devel libxml2-devel libxslt-devel zlib-devel bzip2-devel lz4-devel snappy-devel
  • build and install binary
         ./configure --prefix=/home/postgres/polardb/polardbhome
         make
         make install
         cd contrib
         make

or you can just call build script to build.

    ./build.sh

  • setup environment variables
         vi ~/.bash_profile
         export PGUSER=postgres
         export PGHOME=/home/postgres/polardb/polardbhome
         export PGXC_CTL_HOME=/home/postgres/polardb/polardbhome/bin/pgxc_ctl

         export LD_LIBRARY_PATH=$PGHOME/lib
         export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
         export PATH=$PGHOME/bin:$PATH
  • generate default configure file
        pgxc_ctl -c $HOME/polardb/polardb_paxos.conf prepare standalone

  • deploy binary file
    pgxc_ctl -c $HOME/polardb/polardb_paxos.conf  deploy all
  • clean residual installation and init cluster
         pgxc_ctl -c $HOME/polardb/polardb_paxos.conf  clean all

         pgxc_ctl -c $HOME/polardb/polardb_paxos.conf  init all

         pgxc_ctl -c $HOME/polardb/polardb_paxos.conf  monitor all
  • install dependency packages for cluster management
     pgxc_ctl -c $HOME/polardb/polardb_paxos.conf deploy cm
  • start cluster or node
         pgxc_ctl -c $HOME/polardb/polardb_paxos.conf start all
  • stop cluster or node
         pgxc_ctl -c $HOME/polardb/polardb_paxos.conf stop all
  • failover datanode

datanode_1 is node name configured in polardb_paxos.conf.

         pgxc_ctl -c $HOME/polardb/polardb_paxos.conf failover datanode datanode_1
  • cluster health check

check cluster status and start failed node.

         pgxc_ctl -c $HOME/polardb/polardb_paxos.conf healthcheck all
  • example for other command
        pgxc_ctl -c $HOME/polardb/polardb_paxos.conf kill all
        pgxc_ctl -c $HOME/polardb/polardb_paxos.conf log var datanodeNames
        pgxc_ctl -c $HOME/polardb/polardb_paxos.conf show configuration all
  • check and test
         ps -ef | grep postgres
         psql -p 10001 -d postgres -c "create table t1(a int primary key, b int);"
         createdb test -p 10001
         psql -p 10001 -d test -c "select version();"

One-Key Deployment

onekey.sh can be used to build、configure、deploy and init a database cluster.

         ./onekey.sh all

reference deployment for detail instructions.

Regress and other test details can be found here. Some benchmarking example is here

你可能感兴趣的:(Polardb开源版本初探)