Installing BDR from source
Prerequisites for installing from source
To install BDR the prerequisites for compiling PostgreSQL must be installed. These are described in PostgreSQL's documentation on build requirements and build requirements for documentation.
On several systems the prerequisites for compiling PostgreSQL and BDR can be installed using simple commands.
- Debian and Ubuntu: First add the apt.postgresql.org repository to your sources.list if you have not already done so. Then install the pre-requisites for building PostgreSQL with:
sudo apt-get update sudo apt-get build-dep postgresql-9.4
- RHEL or CentOS 6.x or 7.x: install the appropriate repository RPM for your system from yum.postgresql.org. Then install the prerequisites for building PostgreSQL with:
sudo yum check-update sudo yum groupinstall "Development Tools" sudo yum install yum-utils openjade docbook-dtds docbook-style-dsssl docbook-style-xsl sudo yum-builddep postgresql94
3.3.2. Getting BDR source code
There are two ways to get the BDR source code: with git, or by downloading tarballs of released versions.
3.3.2.1. Using git to get the BDR sources
Use git if you expect to update often, you want to keep track of development or if you want to contribute changes to BDR. There is no reason not to use git if you're familiar with it.
The source for BDR is maintained at https://github.com/2ndQuadrant/bdr. There are actually two independent source trees in this repository - one tree for the BDR plugin, and one for the modified version of PostgreSQL 9.4 that it requires to run. At the time of writing the main branches are:
- bdr-plugin/RELX_Y_STABLE: the stable releases of the BDR plugin (for example bdr-plugin/REL0_9_STABLE is latest source of 0.9.x).
- bdr-plugin/next: the in-progress development version of the BDR plugin
- bdr-pg/REL9_4_STABLE: the current stable release of the modified PostgreSQL that BDR requires.
There are also tags for each BDR release, e.g. bdr-plugin/0.8.0.
To clone the source code using git you will need to run two clones, one for the BDR plugin sources and one for the patched PostgreSQL sources, e.g. (for the 0.9.x version of BDR):
git clone -b bdr-pg/REL9_4_STABLE https://github.com/2ndQuadrant/bdr.git postgresql-bdr git clone -b bdr-plugin/REL0_9_STABLE https://github.com/2ndQuadrant/bdr.git bdr-plugin
For more information on using git see git-scm.org.
3.3.2.2. Downloading release source tarballs
Official BDR release source code is uploaded as tarballs to the BDR website along with a tarball checksum and a matching GnuPG signature. See http://2ndquadrant.com/bdr for the download information. See Verifying digital signatures for information on verifying digital signatures.
You will need to download both the patched PostgreSQL source (postgresql-bdr-[...].tar.gz) and the associated BDR release (bdr-[...].tar.gz).
You may optionally verify the package checksums from the .md5 files and/or verify the GnuPG signatures per Verifying digital signatures.
After you unpack the source code archives using tar xf the installation process is the same as if you were installing from a git clone.
3.3.3. Installation of BDR from source
Installing BDR from source consists out of two steps: First compile and install PostgreSQL with the BDR additions; secondly compile and install the BDR plugin.
The patched PostgreSQL required for BDR can be compiled using the normal documented procedures. That will usually be something like:
cd /path/to/bdr-pg-source/ ./configure --prefix=/path/to/install --enable-debug --with-openssl make -j4 -s install-world
To then install BDR execute its configure script with the pg_config installed by the patched PostgreSQL in the PATH environment variable, e.g.:
cd /path/to/bdr-plugin-source/ PATH=/path/to/postgres/install/bin:"$PATH" ./configure make -j4 -s all make -s install
Comments
Post a Comment