PostgreSQL Database Integration

Revision as of 04:35, 4 June 2012 by Hung (Talk | contribs)



Contents

Contents

  1. Preface
    1. Audience
    2. Introduction
    3. Naming Conventions
    4. Documentation Feedback
  2. Prerequisites to install
    1. Install required softwares
    2. Create a database
  3. How to run the product
    1. PostgreSQL working model
      1. Introduction
      2. Step-by-step to run the model
    2. PostgreSQL tutorial model
      1. Introduction
      2. Step-by-step to run the model

Preface

PostgreSQL Database Integration guide provides the system requirements, running procedures for PostgreSQL SAFplus integration product.

Audience

PostgreSQL Database Integration is designed for system integrators, designers, and developers. To use the product, you must be aware of the fundamentals of design, development, operation, management and configuration of SAFplus and PostgreSQL database. You must also be familiar with C programming, PostgreSQL database development and administration, UML notations, and have the basic knowledge of Linux.

Introduction

The PostgreSQL Database Integration lets a redundant Postgres database to be easily added to your cluster. The Postgres database servers will be running in Active/Standby mode. By using a “virtual” (or moving) IP addresses, the currently “active” database can be directly accessed by applications via a single well-known IP address. This allows your applications to access the Active Postgres database regardless of which machine it is being hosted on.

Additionally, your applications can make read-only queries to the standby postgres databases via well-known IP addresses. This allows read accesses to be distributed across many database replicas.

Prerequisites to install

Install required softwares

  • Install SAFplus SDK-6.0 or higher on your development machine (machine on which builds the model, makes images)
  • Install PostgreSQL-9.1 or higher on the deployment machines
  • Install expect tool (on ubuntu: sudo apt-get install expect)
  • rsync tool must be in the user execution's PATH

Create a database

If there are Postgres databases available (you have already created them), there is nothing to do. But you must know the super user on that database or create a new user (see below).

If Postgres has been installed but database cluster has not been created, you must create it first. How to create a Postgres database if beyond the scope of this tutorial, however the following “recipe” can be used. Creating the database as per this recipe will mean less customization of the tutorial’s example application later since the example application needs to access this database.

  • <postgresBinDir>/initdb <path to location where the database cluster is in> For example,

initdb /usr/local/pgsql/data

  • start postgres database: <postgresBinDir>/pg_ctl start -D <postgresDataDir> -m fast For example,

pg_ctl start -D /usr/local/pgsql/data -m fast

  • create database: <postgresBinDir>/createdb <database name> For example,

createdb movies

  • log on to database: <postgresBinDir>/psql <database name>. For example,

psql movies

  • create a super user to manipulate with this database: for example,

create user postgres with superuser password '123456';

How to run the product

PostgreSQL working model

Introduction

This product provides high availability for postgreSQL database which has been installed on your machine. Please see REAME for more information. The following diagram shows the basic architecture: