Using VMware vFabric Postgres for Data Director vFabric Postgres 9.1

Using VMware vFabric Postgres for Data Director vFabric Postgres 9.1
Using VMware vFabric Postgres for
Data Director
vFabric Postgres 9.1
vFabric Data Director 2.0
vFabric Data Director 2.5
This document supports the version of each product listed and
supports all subsequent versions until the document is replaced
by a new edition. To check for more recent editions of this
document, see http://www.vmware.com/support/pubs.
EN-001028-01
Using VMware vFabric Postgres for Data Director
You can find the most up-to-date technical documentation on the VMware Web site at:
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
[email protected]
Copyright © 2011, 2012 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and
intellectual property laws. VMware products are covered by one or more patents listed at
http://www.vmware.com/go/patents.
VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions. All other marks
and names mentioned herein may be trademarks of their respective companies.
VMware, Inc.
3401 Hillview Ave.
Palo Alto, CA 94304
www.vmware.com
2
VMware, Inc.
Contents
Preface 5
1 VMware Customizations for Postgres 7
vFabric Postgres Enhancements 7
Differences Between Standalone vFabric Postgres Databases and Data Director vFabric Postgres
Databases 8
2 Installing vFabric Postgres 11
Installation Overview 11
System Requirements 11
Deploy the OVA File on vSphere 5.x
12
3 vFabric Postgres Client Tools and Libraries 13
Overview of Tools and Libraries 13
Client Tool Packages and Drivers 14
Install the Client Tools Package 15
Add an x86 vFabric Postgres ODBC Data Source on Windows 16
Relink Your Application with vFabric Postgres libpq 16
4 Managing vFabric Postgres 19
Use the Data Director vFabric Postgres Console 19
Connecting to a vFabric Postgres Database 20
Using psql to Load Data and to Query vFabric Postgres Databases 23
Services that Accept Remote Connections 23
Stop and Start the Service on the Appliance 24
Import Postgres or vFabric Postgres Databases 24
Troubleshooting Guidelines 25
Index 27
VMware, Inc.
3
Using VMware vFabric Postgres for Data Director
4
VMware, Inc.
Preface
Using vFabric Postgres for Data Director provides information about installing and using the VMware
vFabric Postgres for Data Director DBMS together with VMware vFabric Data Director. This version of this
publication is for vFabric Data Director 2.x and for vFabric Postgres 9.1.
Intended Audience
This information is intended for anyone who wants to install or use a vFabric Postgres Standard Edition DBMS
in conjunction with VMware vFabric Data Director. The information is written for experienced Windows or
Linux system administrators who are familiar with virtual machine technology and datacenter operations.
Related Publications
The vFabric Data Director Administrator and User Guide explains how to use vFabric Data Director how to manage
vFabric Postgres databases.
To access the current versions of these and other VMware books, go to
http://www.vmware.com/support/pubs.
VMware, Inc.
5
Using VMware vFabric Postgres for Data Director
6
VMware, Inc.
VMware Customizations for Postgres
1
VMware vFabric Postgres is an ACID-compliant, ANSI-SQL-compliant transactional, relational database
designed for the virtual environment and optimized for vSphere. It is based on the Postgres open-source
relational database and is compatible with PostgreSQL.
vFabric Postgres databases are managed by a DBMS that consists of a server and a client. VMware supports
two versions of vFabric Postgres, vFabric Postgres Standard Edition and vFabric Postgres Standard Edition
for Data Director.
vFabric Postgres
Standard Edition
Supports all standard Postgres connection tools and interaction methods.
vFabric Postgres
Standard Edition for
Data Director
Seamlessly integrates with Data Director and can be managed from the Data
Director GUI. You can also use traditional database tools to interact with this
version, but some modifications, for example to connection strings, might be
required.
This chapter includes the following topics:
n
“vFabric Postgres Enhancements,” on page 7
n
“Differences Between Standalone vFabric Postgres Databases and Data Director vFabric Postgres
Databases,” on page 8
vFabric Postgres Enhancements
A VMware vFabric Postgres DBMS includes memory, checksum, and performance features that are not
available with an open source Postgres/PostgreSQL DBMS.
Elastic Database
Memory
VMware, Inc.
Elastic database memory enables vFabric Postgres to run with graceful
performance degradation under heavy over-commitment of memory.
vFabric Postgres participates in memory resource management with the guest
operating system and the vSphere hypervisor to achieve elastic database
memory.
7
Using VMware vFabric Postgres for Data Director
vFabric Postgres monitors requests for memory from the vSphere hypervisor
and monitors swap activity within the guest operating system. When the
hypervisor or the guest operating system needs more memory, the
vFabric Postgres buffer manager shrinks the database buffer pool to make
memory available. When more memory becomes available, the buffer manager
increases the amount of memory dedicated to the buffer pool.
Elastic database memory is enabled by default in the virtual appliance, but is
disabled if you use the RPM files. RPM installation is supported only for the
standalone version of vFabric Postgres.
Ease of Tuning on the
Appliance
If you deploy the vFabric Postgres appliance or the vFabric Postgres for Data
Director appliance, associated vFabric Postgres databases have higher default
values than standard Postgres databases for many critical settings, including
shared_buffers, checkpoint_segments, and wal_buffers. The higher default
values improve out-of-box vFabric Postgres performance with a slight increase
in disk space and memory requirements. The result is that users of an
embedded vFabric Postgres database can more easily tune the database for
their workload.
If you are using vFabric Postgres, and you use the RPM installation, these
changes to default values are not made.
Automatic Checksums
By default, vFabric Postgres performs checksums on each write operation to
tables or indexes. Performing checksums on each write ensures that when
vFabric Postgres retrieves data, that data is clean.
Checkpoint Tuning
vFabric Postgres improves on the Postgres algorithm to make the tuning more
dynamic.
In I/O-constrained environments, periods of heavy checkpointing activity often
alternate with periods of light checkpoint activity.
By default, vFabric Postgres performs dynamic tuning of checkpoint
parameters so that rapid changes in available I/O bandwidth or changes in the
database workload reduce the likelihood of database throughput oscillations.
Differences Between Standalone vFabric Postgres Databases and Data
Director vFabric Postgres Databases
vFabric Postgres databases that are deployed with Data Director differ from standalone vFabric Postgres
databases in several ways.
8
Simplified Configuration
To configure vFabric Postgres databases deployed from Data Director, users
select a database configuration template, and then customize settings such as
name, storage allocation, database owner account, and backup template. Data
Director updates the postgresql.conf file’s tunable parameters.
No Superuser Admin
Privileges
Each Data Director database user has only database administrator rights. As a
result, tools that require superuser privileges, such as COPY FROM, COPY TO,
and tools that operate on the system catalog, do not work.
No pg_dumpall
The pg_dumpall tool requires superuser privileges, and does not work with
vFabric Postgres databases deployed from Data Director.
VMware, Inc.
Chapter 1 VMware Customizations for Postgres
No CREATE or DROP
Database Privileges
Data Director users have privileges only within the database. You cannot use
database client tools to create or drop databases. Use the Data Director UI to
create and drop databases.
Object Naming
Database names can only use alphanumeric characters, underscore (‘_’) or
hyphen (‘-’).
For object names, the standard Postgres requirements apply.
VMware, Inc.
9
Using VMware vFabric Postgres for Data Director
10
VMware, Inc.
Installing vFabric Postgres
2
Before you install vFabric Postgres, review the requirements and the deployment or installation process.
This chapter includes the following topics:
n
“Installation Overview,” on page 11
n
“System Requirements,” on page 11
n
“Deploy the OVA File on vSphere 5.x,” on page 12
Installation Overview
Installing vFabric Postgres in a Data Director environment consists of several tasks.
1
Deploy the OVA files on a vSphere 5.x system. See “Deploy the OVA File on vSphere 5.x,” on page 12.
2
In Data Director, build a DBVM template from the deployed OVA. See Building DBVMs and Base
Templates in the vFabric Data Director Administrator and User Guide.
3
Create a vFabric Postgres database by following the instructions in the vFabric Data Director Administrator
and User Guide
System Requirements
For vFabric Postgres for Data Director, you always deploy a virtual appliance (OVA) on vSphere 5.x.
Resource Requirements
The host where you deploy the OVA, or the virtual machine where you install the RPM files (standalone only),
has the following minimum requirements.
RAM
512 MB
CPUs or vCPUs
1
Disk Space
12 GB
Database Clients
In most cases, you interact with vFabric Postgres for Data Director from the Data Director UI.
As part of vFabric Postgres, you can download custom JDBC, ODBC, and LIBPQ drivers and client tools.
Different sets of drivers and tools are available for the standalone vFabric Postgres Standard Edition and the
vFabric Postgres Standard Edition for Data Director.
VMware, Inc.
11
Using VMware vFabric Postgres for Data Director
Database clients for Windows, Linux, and MAC OS X, both 32 bit and 64 bit, are included.
Many community PostgreSQL clients, such as Npgsql, and psycopg2 are supported in both 32-bit and 64-bit
configurations.
Deploy the OVA File on vSphere 5.x
You can deploy the OVA file on vSphere 5.x for use during development or for production environments.
Prerequisites
Download the OVA file from the VMware download site.
NOTE Different OVA files exist for vFabric Postgres Standard Edition and vFabric Postgres Standard Edition
for Data Director.
Procedure
1
Connect to a vCenter Server with the vSphere Web Client.
2
Select an inventory object that is a valid parent object of a virtual machine, such as a datacenter, folder,
cluster, resource pool, or host.
3
Select Actions > All vCenter Actions > Deploy OVF Template.
4
If prompted, download the client plug-in.
You have to close all browsers to download the plug-in.
5
Specify the source location and click Next.
6
If prompted, accept the license agreement and wait for the deployment process to complete.
7
(Optional) Change the resource allocation for the virtual appliance. The default configuration is as follows.
8
Resource
Value
Memory
512 MB
vCPU
1
Hard Disk 1 - root disk
(vmname.vmdk)
2 GB
Hard Disk 2 - data disk
(vmname_1.vmdk)
8 GB
Hard Disk 3 - swap disk
(vmname_2.vmdk)
1 GB
Hard Disk 4 - diagnostic disk and
core disk (vmname_3.vmdk)
1 GB
Set the network configuration if you want to set a static IP address, or leave the settings blank to have the
virtual machine use DHCP.
You can use the network configuration script /opt/vmware/share/vami/vami_config_net to change the IP
address of the virtual appliance.
9
Power on the new virtual machine and log in as root, using the random password that is displayed.
10
Change the password with the /opt/aurora/sbin/setpassword command.
The command sets the password for the user with user name root and the user with user name postgres
on both system and the database.
12
VMware, Inc.
vFabric Postgres Client Tools and
Libraries
3
You can use vFabric Postgres client tools on Windows or Linux to print configuration parameters and to back
up and restore vFabric Postgres databases. The command line front end to PostgreSQL, psql, is also included.
NOTE Different client tools and libraries are available for vFabric Postgres and for vFabric Postgres for Data
Director. Go to the correct download location to download the tools and libraries you need.
This chapter includes the following topics:
n
“Overview of Tools and Libraries,” on page 13
n
“Client Tool Packages and Drivers,” on page 14
n
“Install the Client Tools Package,” on page 15
n
“Add an x86 vFabric Postgres ODBC Data Source on Windows,” on page 16
n
“Relink Your Application with vFabric Postgres libpq,” on page 16
Overview of Tools and Libraries
The vFabric Postgres client tools are based on the Postgres client database tools and are customized for
vFabric Postgres. The tools support common configuration commands. The libraries include several APIs and
the ODBC driver for PostgreSQL.
Separate download packages are available for vFabric Postgres and for vFabric Postgres for Data Director.
Versions for Linux x86, 32 bit and 64 bit, for Windows x86, 32 bit and 64 bit, and for Mac-OS are available.
Linux
The Linux RPM includes ODBC drivers for vFabric Postgres. The Linux ODBC
driver requires unixODBC-2.3.1 or greater.
Windows
The vFabric Postgres client tool installer package for Windows includes ODBC
and JDBC drivers for vFabric Postgres
The following vFabric Postgres client database tools are included in the vFabric Postgres client tools packages.
Table 3-1. vFabric Postgres Client Tools
Tool
Description
pg_config
Prints the current vFabric Postgres installation's
configuration parameters.
pg_dump
Backs up vFabric Postgres databases
pg_restore
Restores vFabric Postgres databases from archives created by
pg_dump.
psql
Command line based front end to PostgreSQL.
VMware, Inc.
13
Using VMware vFabric Postgres for Data Director
The vFabric Postgres client tools ship with the following libraries.
Table 3-2. vFabric Postgres Client Tool Libraries
Library
Description
libpq.so (Linux) or libpq.dll (Windows)
The C API to PostgreSQL. Libpq is the underlying engine for
several PostgreSQL APIs such as those written for C++, Perl,
Python, Tcl, and ECPG.
psqlodbcw.so (Linux) or psqlodbc35w.dll (Windows)
The ODBC driver for PostgreSQL.
The vFabric Postgres client tool libraries are customized for use with vFabric Postgres databases, but you can
use the standard Postgres libraries. To ensure that you link with the vFabric Postgres libraries, do one of the
following.
n
If you want to keep the standard Postgres libraries on your system, ensure that your
LD_LIBRARY_PATH environment variable specifies the location of the vFabric Postgres libraries first.
n
If you do not want to keep the standard Postgres libraries, remove them and ensure that your
LD_LIBRARY_PATH environment variable points to the location of the vFabric Postgres libraries on your
system.
Client Tool Packages and Drivers
You can download client tool packages for Windows and Linux from the VMware download site. After you
download the tools, you can use the drivers included in the packages.
Packages
If you plan to write code, and you plan on compiling an application to link with libpq, download both the
client package and the development package.
You can download the client tool package for your platform from the VMware download site. Be sure to
download the appropriate package for your environment.
vFabric Postgres
http://vmware.com/go/download-vfabric-postgres
vFabric Postgres for
Data Director
http://www.vmware.com/go/download-datadirector
You can download tools and drivers for Windows, Linux, Java, or Macintosh.
Drivers
The vFabric Postgres client tools package includes a JDBC driver and an ODBC driver customized for
vFabric Postgres. Use the vFabric Postgres JDBC or ODBC drivers, not the standard Postgres drivers, to connect
to Data Director.
JDBC Driver
After installation, you can find the JDBC driver in the following locations.
Microsoft
Windows
C:\Program Files\VMware\vPostgres\9.1\JDBC
Linux
/opt/vmware/vpostgres/current/JDBC
The Samples directory contains a simple Java example and README file that show
how to connect to Data Director using JDBC.
14
VMware, Inc.
Chapter 3 vFabric Postgres Client Tools and Libraries
For example, if your application uses the JDBC driver to access a database, and
you install the application as /usr/local/lib/myapp.jar and the PostgreSQL
JDBC driver as /usr/local/pgsql/share/java/postgresql.jar, you run the
application as follows.
export
CLASSPATH=/usr/local/lib/myapp.jar:/usr/local/pgsql/share/java/postgr
esql.jar:.java MyApp
ODBC Driver
The vFabric Postgres installation process installs the vFabric Postgres ODBC
driver. You can verify the Windows ODBC driver installation as follows.
1
Select Start > Administrative Tools > Data Sources (ODBC).
2
Click the Drivers tab.
3
Verify that the VMware vFabric Postgres ODBC driver appears in the list
of installed ODBC drivers.
Install the Client Tools Package
You can install the vFabric Postgres Client Tools on Windows or Linux systems. The package includes drivers
customized for vFabric Postgres. You can install only the base package, or install the development RPMs as
well.
Prerequisites
n
Download the package.
n
If you are using vFabric Postgres for Data Director, verify that the Data Director ESXi host is running.
Procedure
1
Install the package.
Operating System
Installation Process
Linux
Install the RPM files by running the following command.
rpm -ivh pathToClientRpms
pathToClientRpms is the full pathname of the RPM package location on your
system. The default installed location is /opt/vmware/vpostgres/9.1.
Use -Uvh instead of -ivh if you perform an upgrade.
2
Windows
a Double-click the installer to start the installer.
b Accept the license agreement and confirm the install location.
Installation proceeds. The default installed location is \Program
Files\VMware\vPostgres\9.1\. If you install the x86 vFabric Postgres
client tools on a Windows 64-bit system, the Windows installer places the
client tools in \Program Files (x86)\VMware\vPostgres\9.1\.
Macintosh
Run or rerun the installer. You can double-click the PKG file to start the
installer GUI or install from the command line by running the following
command.
# sudo installer -pkg /path/to/VMware-vPostgresclient-....pkg -target /
Ensure that your PATH environment variable includes the location of the vFabric Postgres client tools, for
example C:\Program Files\VMware\vPostgres\9.1\bin.
What to do next
If you install both the x86 and the 64 bit vFabric Postgres client tools on a 64-bit Windows system, see “Add
an x86 vFabric Postgres ODBC Data Source on Windows,” on page 16.
VMware, Inc.
15
Using VMware vFabric Postgres for Data Director
If you are developing a custom application, relink with libpq. See “Relink Your Application with vFabric
Postgres libpq,” on page 16.
Add an x86 vFabric Postgres ODBC Data Source on Windows
If you install both the x86 and the 64-bit vFabric Postgres client tools on the same 64-bit Windows system, you
must explicitly add an x86 ODBC data source.
Prerequisites
Install the x86 and the 64-bit vFabric Postgres client tools.
Procedure
1
In Windows Explorer, go to C:\Windows\SysWOW64\.
2
Double-click odbcad32.exe.
3
Select the System DNS tab and click Add.
4
Click the VMware vFabric Postgres Unicode 32bit data source.
5
Click Finish.
Relink Your Application with vFabric Postgres libpq
If you want to use an existing Postgres application with vFabric Postgres, you can relink the application.
Because vFabric Postgres libpq.so is dynamically linked with libssl, the static ld linker does not recognize
the rpath of $ORIGIN. You can relink to specify the rpath.
Prerequisites
Install the vFabric Postgres client tools. You can relink without installing the development RPMs.
16
VMware, Inc.
Chapter 3 vFabric Postgres Client Tools and Libraries
Procedure
u
Relink with vFabric Postgres based on your operating system.
Operating System
Relinking Process
Linux
a
See /opt/vmware/vpostgres/current/share/libpqdoc/README.vpostgres-libpq.
b
Override the dynamic library search path by
adding /opt/vmware/vpostgres/current/lib-public to
LD_LIBRARY_PATH.
# export
LD_LIBRARY_PATH=/opt/vmware/vpostgres/current/lib-public
# mypgapp
c
- or Relink using the vFabric Postgres libpq.
# gcc -o t t.c -L/opt/vmware/vpostgres/current/lib -Wl,'rpath=/opt/vmware/vpostgres/current/lib' -lpq
Windows
Mac OS X
Copy libpq and other libraries to the directory of the application binaries
and relink.
By default , the libraries and header files are in the following locations.
Development
libraries
C:\Program Files\VMware\vPostgres\9.1\dev
libpgport.lib and
libpq.lib libraries
C:\Program
Files\VMware\vPostgres\9.1\dev\lib
libpq header
files
C:\Program
Files\VMware\vPostgres\9.1\dev\include
Perform one of the following tasks.
n Override the dynamic library search path by adding
the /opt/vmware/vpostgres/9.1/lib to the
DYLD_LIBRARY_PATH environment variable, as follows:
# export DYLD_LIBRARY_PATH=/opt/vmware/vpostgres/9.1/lib
# mypgapp
n
Relink using the vFabric Postgres libpq library during compilation.
Relinking requires the Xcode developer toolset. For example, to embed
the full path of libpq.dylib in the executable binary mypgapp, run this
command.
# gcc -o mypgapp mypgapp.c L/opt/vmware/vpostgres/9.1/lib -lpq
n
Relink using the vFabric Postgres libpq after compilation. Relinking
requires the Xcode developer toolset.
NOTE This changes the binary to use vPostgres libpq
# install_name_tool -change "/usr/lib/libpq.5.dylib"
"/opt/vmware/vpostgres/9.1/lib/libpq.5.dylib" mypgapp
To confirm which library is linked, run this command.
# otool -L mypgapp
VMware, Inc.
17
Using VMware vFabric Postgres for Data Director
18
VMware, Inc.
Managing vFabric Postgres
4
After you have installed the vFabric Postgres DBMS and the client tools, you can perform a variety of
management tasks.
NOTE If you are using the vFabric Data Director version of vFabric Postgres, you perform most of your
management tasks from the Data Director GUI. This includes creating, monitoring, and managing
vFabric Postgres databases, and managing license keys for production system. See vFabric Data Director
Administrator and User Guide.
This chapter includes the following topics:
n
“Use the Data Director vFabric Postgres Console,” on page 19
n
“Connecting to a vFabric Postgres Database,” on page 20
n
“Using psql to Load Data and to Query vFabric Postgres Databases,” on page 23
n
“Services that Accept Remote Connections,” on page 23
n
“Stop and Start the Service on the Appliance,” on page 24
n
“Import Postgres or vFabric Postgres Databases,” on page 24
n
“Troubleshooting Guidelines,” on page 25
Use the Data Director vFabric Postgres Console
The vFabric Postgres Console allows privileged users to monitor and modify a vFabric Postgres database. You
can use the vFabric Postgres console instead of client tools to manage your databases.
Prerequisites
Log in to Data Director as a user who has privileges to view and modify a database.
Procedure
1
Select the organization in which the database was created, click Manage and Monitor, and select the
database.
On this management page, you can use the available tabs to get an overview, view reports and logs, and
perform other tasks for vFabric Postgres databases or Oracle databases.
2
Click the Console icon in the top-right corner to display the vFabric Postgres management console.
You can examine and customize the database from the console.
3
VMware, Inc.
Click the Catalogs or Schemas icons on the left to review catalogs and schemas for just that database.
19
Using VMware vFabric Postgres for Data Director
4
From the console, right-click the database icon and select one of the available actions.
Action
Description
Refresh
Refreshes the database
Vacuum Analyze Database
Performs a standard Postgres Vacuum Analyze operation.
Enter SQL
Displays a window for entering and executing SQL commands and viewing
and examining output.
For more information about managing vFabric Postgres databases with Data Director, see the vFabric Data
Director Administrator and User Guide.
Connecting to a vFabric Postgres Database
If you do not want to use the Data Director UI to manage your vFabric Postgres database, you can instead
connect using standard database connections such as pgAdmin or JDBC. The connection strings differ slightly
from the standard Postgres connection strings.
Connect to a vFabric Postgres Database with the pgAdmin Tool
You can connect to a vFabric Postgres database in several different ways, including the pgAdmin tool.
The Windows pgAdmin tool works only with Windows 32-bit systems. If you run Windows 64-bit, install the
32-bit versions of the vFabric Postgres client tools. The tool's installer places the 32-bit tools in the C:\Program
Files (x86) tree.
Prerequisites
n
If you do not have pgAdmin installed, download the version of the tool that is appropriate for your system
from the Postgres Web site and install the tool.
n
Obtain the vFabric Postgres connection string. See “Obtain the Connection String,” on page 21.
n
Obtain the Data Director DB Name Service IP address. See “Obtain the DB Name Service IP Address,” on
page 22.
n
On Windows, ensure that pgAdmin uses the vFabric Postgres libpq library.
a
Copy the C:\Program Files\pgAdmin III\version directory to C:\Program Files\pgAdmin
III\version-vPostgres, where version is the pgAdmin version number, for example, 1.14.
b
Copy all the files in your C:\Program Files\VMware\vPostgres\1.0\bin directory to C:\Program
Files\pgAdmin III\<version>-vPostgres.
Procedure
20
1
Start pgAdmin from the C:\Program Files\pgAdmin III\version-vPostgres directory.
2
Select File > Add Server.
3
Specify the connection information when prompted.
Option
Description
Name
A meaningful name for the server, such as Data Director.
Host
The {UUID}.[DB Name Service IP or FQDN] part of the connection string.
Port, Service, Maintenance DB
Leave the defaults.
Username
Database user name. This is usually the database owner user ID.
Password
Password for the database user. You can optionally store the password.
pgAdmin stores the password as plain text.
VMware, Inc.
Chapter 4 Managing vFabric Postgres
Option
Description
Color (Optional)
Color to denote this server in the object browser and in diagrams.
Server group (Optional)
Enter a server group in which to place this server, or accept the default.
4
Click the Advanced tab and type the DB Name Service IP address in the Host field.
5
Click OK.
Obtain the Connection String
Before you can connect to a vFabric Postgres database, obtain the connection string.
Data Director uses its DB Name Server virtual machine to route database connections to vFabric Postgres
databases deployed with Data Director. The connection string has the following format.
{UUID}.DBNameService_IP_Address
The curly brackets, { }, are part of the connection string and enclose the UUID. You can obtain the connection
string from the Data Director UI, or you can construct the connection string if you know the UUID and DB
Name Server host name.
Procedure
1
Log in to your Data Director organization as a user with database privileges.
2
Select the database group for the database and click the database name.
The database connection string appears in the Connection String field. The connection string includes the
JDBC connection information and has the format
jdbc:postgresql://{UUID}.DB_Name_Service_IP_or_FQDN/db_name?user=user_ID.
3
{UUID}
Database name, enclosed in curly brackets.
DB_Name_Service_IP_
or_FQDN
Either the IP address of the Data Director DB Name Service network or the
fully qualified domain name.
db_name
Name of the vFabric Postgres database to connect to.
user_id
User ID to log in to the vFabric Postgres database.
Copy the connection string and paste it into the right place in your application using the appropriate
approach.
Connection mechanism
Description
Tool
If you use a tool such as pgAdmin, copy the
{UUID}.DB_Name_Service_IP_or_FQDN part of the connection string to
specify the host. Specify the user name in the pgAdmin server connection
properties.
JDBC
If you use JDBC, paste the entire connection string into the jdbc.url field in
your jdbc.properties file.
What to do next
Connect to the database. See “Connect to a vFabric Postgres Database with the pgAdmin Tool,” on page 20
and “Connecting to a vFabric Postgres Database,” on page 20.
VMware, Inc.
21
Using VMware vFabric Postgres for Data Director
Obtain the DB Name Service IP Address
If you connect to the vFabric Postgres database with the pgAdmin tool, you must obtain the DB Name Service
IP address.
You can use the vSphere Client to obtain the DB Name Service IP address from the Data Director vApp. Ask
your system administrator for help if you do not have access to the vSphere Client.
Procedure
1
Log in to vSphere Client as an administrator.
2
Select Hosts and Clusters and find and expand the Data Director vApp in the left pane.
3
Click DB Name Server to select it, and click the Summary tab.
The IP address is listed in the General pane.
What to do next
“Connect to a vFabric Postgres Database with the pgAdmin Tool,” on page 20.
Connect to a vFabric Postgres Database with JDBC
You can connect to a vFabric Postgres for Data Director database by using custom connection strings. If you
are using the standalone version of vFabric Postgres, you do not need to customize your connection strings.
Prerequisites
Deploy the vFabric Postgres Standard Edition for Data Director virtual appliance in your environment.
Procedure
u
Use the following connection string.
jdbc:postgresql://{UUID}.host_name/rdb_name?user=<user name>
The curly brackets, {}, are part of the connection string and enclose the UUID.
Example: Connecting with JDBC
Assume that you use JDBC to connect to a database with the following characteristics.
Database name
myDB
Host name
w1-devtest-22.dev.mycorp.com
UUID
d35f7ab1-d70e-4d98-c121-122f68e4ab60
User name
dbowner
You can use the following JDBC connection string.
jdbc:postgresql://{d35f7ab1-d70e-4d98-c121-122f68e4ab60}.w1-devtest-22.dev.mycorp.com/mydb?
user=dbowner
Connect to a vFabric Postgres Database with psql
You can connect to a vFabric Postgres for Data Director database with psql by using custom connection strings.
If you are using the standalone version of vFabric Postgres, you do not need to customize your connection
strings.
Prerequisites
Deploy the vFabric Postgres Standard Edition for Data Director virtual appliance in your environment.
22
VMware, Inc.
Chapter 4 Managing vFabric Postgres
Procedure
u
Use the following connection string.
psql -h {UUID}.DB_Name_Service_IP -p 5432 -d DB_name -U db_user_name
Example: Connecting with psql
For example, assume that you use psql to connect to a database with the following characteristics.
UUID
1234-5678-9012-3456
DB Name Service port
5432
DB Name Server IP
address
10.0.0.1
database user name
dbuser
You can use the following psql command to connect to the database.
$ psql -h {1234-5678-9012-3456}.10.0.0.1 -p 5432 -d myDB -U dbuser
Psql connects to myDB, prompts for the password, and logs you in.
What to do next
You can now load data and query the database using psql. See “Using psql to Load Data and to Query vFabric
Postgres Databases,” on page 23.
Using psql to Load Data and to Query vFabric Postgres Databases
You can use psql commands to load data into a vFabric Postgres database and to query a vFabric Postgres
database.
Loading Data with psql
Use the psql command \COPY (back slash-COPY) to load data into vFabric Postgres databases. Do not use the
psql COPY FROM or COPY TO command. The COPY FROM (or COPY TO) command must run on the server with
superuser privileges and cannot load data into remote clients such as vFabric Postgres for Data Director.
The \COPY FROM and \COPY TO commands use the client session to read and write from local files. These
commands support relative paths, and use the psql communication layer to load data to, or from, the server.
For example, the following psql command loads data from a text file, shelterlists.txt, into the
vFabric Postgres database table shelters in the schema rescues.
\copy rescues.shelters from 'C:\shelterslists.txt';
Querying vFabric Postgres Databases with psql
After you connect to a vFabric Postgres database, you can query the database. For example, using psql, connect
to the database and type the psql command at the database prompt.
You can run SQL script files using the psql -f SQL_script_filename command, where the file named
SQL_script_filename contains a series of SQL commands. Psql reads the file, runs the SQL commands, and exits.
Services that Accept Remote Connections
When the vFabric Postgres server is running, it includes services that accept remote connections.
If you install the vFabric Postgres DBMS as an appliance, it includes standard services and services specific to
VMware virtual appliances. These services accept remote connections by default. You can set the DBMS
parameters to add or remove services or change ports.
VMware, Inc.
23
Using VMware vFabric Postgres for Data Director
Table 4-1. vFabric Postgres Services that Accept Remote Commections
Service
Port
Postgres service
5432
SSH service
22
VAMI (Virtual Appliance Management Infrastructure) Web
Management UI. You can connect to port 5480 via https to
update or reconfigure the appliance.
5480
VAMI SFCB broker
5488 and 5489
Stop and Start the Service on the Appliance
Stop and start the service on the appliance if you change the configuration.
If you installed the vFabric Postgres database service as an appliance, use the following commands to stop and
then restart the service. For the appliance service, these commands also stop and start the VMware HA (high
availability) monitor process that makes sure the database process is up and running.
Procedure
1
Change the configuration.
2
Stop the service.
$service aurora_mon stop
3
Restart the service.
$service aurora_mon start
Import Postgres or vFabric Postgres Databases
If you cannot use an existing Postgres or vPostgres database from vFabric Postgres or vFabric Postgres for Data
Director, you can dump the database and import or restore it.
You might not be able to use a Postgres database from vFabric Postgres or vFabric Postgres for Data Director,
a database created from vFabric Postgres in Data Director, or a database created in Data Director from the
standalone version of vFabric Postgres. You might also have problems if a new major version of
vFabric Postgres has been released.
If this happens, you can export the database to text format by using either the pg_dumpall or the pg_dump utility,
as follows.
pg_dumpall
Dumps every object for all databases. You can load the resulting dump into the
vFabric Postgres appliance or a virtual machine on which the
vFabric Postgres RPMs have been installed with the psql command. You
cannot use this command with vFabric Postgres for Data Director.
pg_dump
Supports a granular dump based on schemas or tables and includes a custom
format. You can load into all versions of vFabric Postgres.
Procedure
1
24
Decide whether you want to use pg_dumpall or pg_dump.
VMware, Inc.
Chapter 4 Managing vFabric Postgres
2
Use each command with the correct corresponding restore option.
pg_dumpall > mydump.sql
psql -d postgres -f mydump.sql
pg_dump -Fc -d mydb > mydbdump.dmp
dropdb mydb
pg_restore -C -d postgres mydbdump.dmp
Troubleshooting Guidelines
Use the options listed in this section to analyze connection or performance problems.
Client Cannot Connect
If your client cannot connect to the vFabric Postgres appliance or to a vFabric Postgres server installed using
RPMs, follow these steps to troubleshoot the issue.
1
Ping the server IP from your client.
2
Verify that Postgres 9.1 is running by running the following command on the command line.
ps ax | grep postgres
3
Try to connect a local PostgresSQL client to the vFabric Postgres server.
4
Review the logs in /var/vmware/vpostgres/current/pgdata/pg_log
Database Transactions Per Second Less Than Expected
If the database transactions per seconds are less than expected, follow these steps to troubleshoot the issue.
1
Make sure your PGDATA VMDK is on a high-performance datastore.
2
Look for missing indexes in your SQL queries.
3
Analyze concurrent queries for conflicts.
4
Increase the number of vCPUs and/or memory.
5
As a last resort, turn off synchronous_commit in
var/vmware/vpostgres/current/pgdata/postgresql.conf and restart the appliance. Monitor for
performance changes. See the Postgres documentation for details.
VMware, Inc.
25
Using VMware vFabric Postgres for Data Director
26
VMware, Inc.
Index
A
aurora_mon start 24
aurora_mon stop 24
C
checkpoint 7
checksum 7
client tools 13
connection string 21
console for vFabric Postgres 19
D
DB Name Service IP address 22
pg_dump 13
pg_dumpall 8
pg_restore 13
pgAdmin 20
privileges 8
psql 13, 23
R
relinking 16
remote connections 23
requirements 11
T
troubleshooting 25
E
elastic database memory 7
enhancements 7
V
I
W
import 24
installation 11
installation overview 11
installing client tools 15
intended audience 5
Windows packages 14
vSphere 5 deployment 12
J
JDBC 20, 22
L
libpq 16
libraries 13
linking 16
Linux packages 14
M
managing databases 19
O
object naming 8
ODBC data source 16
OVA, vSphere 5 deployment 12
P
packages 14
pg_config 13
VMware, Inc.
27
Using VMware vFabric Postgres for Data Director
28
VMware, Inc.
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement