Postgres plus cloud_database_getting_started_guide

1,769 views

Published on

งง

Published in: Automotive, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,769
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
33
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Postgres plus cloud_database_getting_started_guide

  1. 1. Postgres Plus Cloud Database Getting Started Guide April 18, 2012
  2. 2. Postgres Plus Cloud Database Getting Started Guide Postgres Plus Cloud Database Getting Started Guide, Version 1.3 by EnterpriseDB Corporation Copyright © 2012 EnterpriseDB Corporation. All rights reserved.EnterpriseDB Corporation, 34 Crosby Drive Suite 100, Bedford, MA 01730, USAT +1 781 357 3390 F +1 978 589 5701 E info@enterprisedb.com www.enterprisedb.comCopy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 2
  3. 3. Postgres Plus Cloud Database Getting Started GuideTable of Contents1 Introduction ......................................................................................................................5 1.1 Typographical Conventions Used in this Guide ....................................................72 Postgres Plus Cloud Database - Overview .....................................................................8 2.1 The Benefits of using Postgres Plus Cloud Database............................................8 2.2 Architecture Overview ..........................................................................................10 2.3 Postgres Plus Cloud Database...............................................................................123 Accessing Postgres Plus Cloud Database .....................................................................13 3.1 Registering a New User.........................................................................................144 Using the Cloud Database Console...............................................................................18 4.1 The Dashboard Tab................................................................................................18 4.2 The Clusters Tab ....................................................................................................19 4.2.1 The Details panel...............................................................................................22 4.2.2 The Configurations Panel..................................................................................23 4.2.2.1 Modifying postgresql.conf Parameters ....................................................27 4.2.2.2 Modifying pgpool.conf Parameters..........................................................28 4.2.2.3 Best Practices for Working with Configurations ....................................29 4.2.3 The Monitoring Panel........................................................................................31 4.2.4 The Events Panel ...............................................................................................32 4.3 The Backups Tab ...................................................................................................32 4.4 The User Tab..........................................................................................................335 Creating a New Server Cluster......................................................................................35 5.1.1 Creating a Developer Sandbox .........................................................................386 Connecting an Application to a Cloud Database Cluster ............................................407 Managing Backups and Recovery.................................................................................42 7.1 Reviewing Stored Backups ...................................................................................43 7.2 Restoring a Cluster from Backup..........................................................................44 7.3 Reassigning an Elastic IP Address on Amazon ...................................................458 Automatic Failover.........................................................................................................469 Manual Scaling...............................................................................................................4710 Automatic Scaling ..........................................................................................................49 10.1 Adjusting the Automatic Scaling Thresholds ......................................................4911 Customizing Your Cluster.............................................................................................50Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 3
  4. 4. Postgres Plus Cloud Database Getting Started Guide 11.1 Adding an Extension to a New Cluster ................................................................50 11.2 Adding an Extension to an Existing Cluster ........................................................5112 Cloud Database System Administration .......................................................................52 12.1 Moving an Existing Database into a New Cluster...............................................52 12.2 Connecting to the Cluster......................................................................................58 12.2.1 Using ssh to Access a Server............................................................................58 12.2.2 Connecting with the Postgres Enterprise Manager Client ..............................60 12.2.3 Connecting to Cloud Database with psql or edb-psql .....................................63 12.3 Securing a Cloud Database Cluster ......................................................................67 12.4 Manually Modifying Configuration Files ............................................................70 12.5 Controlling the Server ...........................................................................................7113 Troubleshooting .............................................................................................................74 13.1 Frequently Asked Questions .................................................................................75 13.2 Subscribing to the Cloud Database Email Notification System .........................78 13.3 Recovering From a Console Failure .....................................................................79Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 4
  5. 5. Postgres Plus Cloud Database Getting Started Guide1 IntroductionPostgres Plus Cloud Database automatically provisions PostgreSQL or Postgres PlusAdvanced Server databases in single instances, high-availability clusters, or applicationdevelopment sandboxes across public and private clouds or traditional data centerhardware deployments. Cloud Database allows service providers and organizations tooffer elastic and highly scalable database-as-a-service (DBaaS) environments whilefreeing DBAs and application developers from the rigors of setting up and administeringmodern and robust database environments.In minutes, Cloud Database configures new Postgres database clusters with:  Rotating user-scheduled backups  Streaming replication  Self-healing high-availability  Automatic failover  Load balancing  Connection PoolingIn addition, Cloud Database provides automatic scaling of storage resources and clusterreplicas when a database cluster reaches user-defined thresholds for disk space andconnections, providing around-the-clock responsiveness to unpredictable load demandson your database infrastructure.This document will demonstrate how to use the Cloud Database interface successfully inyour cloud-based database management activities:  Postgres Plus Cloud Database - Overview - Chapter 2 provides information about Cloud Database functionality and architecture.  Accessing Cloud Database in a Public Cloud - Chapter 3 walks you through the process of registering a new user, and logging in to Cloud Database.  Using the Cloud Database Console - Chapter 4 introduces you to the Cloud Database graphical user interface, and provides an overview of the functionality offered by the user interface controls.  Creating a New Server Cluster - Chapter 5 walks you through how to create a server cluster, how to migrate an existing database into a new cluster, and how to create a developer sandbox.  Connecting an Application - Chapter 6 describes how to locate connection information for your server nodes, so your client applications can access your cluster.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 5
  6. 6. Postgres Plus Cloud Database Getting Started Guide  Managing Backups and Recovery - Chapter 7 describes how to take a backup of the server and how to move an elastic IP address.  Automatic Failover - Chapter 8 discusses Postgres Plus Cloud Database failover functionality.  Manual Scaling - Chapter 9 describes how to manually scale up your database cluster by adding replica nodes or memory.  Automatic Scaling - Chapter 10 discusses how to set the automatic scale up threshold for your database.  Customizing Your Cluster - Chapter 11 discusses some of the ways you can customize your Cloud Database. If you add an extension (such as PostGIS) to customize a new cluster, Cloud Database will propagate that extension to new nodes, preserving your changes throughout the clusters life cycle when you scale up, restore or clone that cluster.  System Administration - Chapter 12 provides information about performing administrative tasks on a Cloud Database cluster.  Troubleshooting and FAQs - Chapter 13 provides helpful troubleshooting resources, and detailed information about how to recover from a console failure.This document provides an introduction to Postgres Plus Cloud Database and is written toacquaint you with the process of configuring and using the products core features; it isnot a comprehensive guide to using Postgres Plus database products. Depending on youroperating environment (public cloud, private cloud, or traditional hardware deployment)and hosting vendor, there may be differences in Cloud Database features and functions.This document uses Postgres to mean either the PostgreSQL or Postgres Plus AdvancedServer database. For more information about using Postgres Plus products, please visitthe EnterpriseDB website at: http://www.enterprisedb.com/documentationCopy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 6
  7. 7. Postgres Plus Cloud Database Getting Started Guide1.1 Typographical Conventions Used in this GuideCertain typographical conventions are used in this manual to clarify the meaning andusage of various commands, statements, programs, examples, etc. This section provides asummary of these conventions.In the following descriptions a term refers to any word or group of words that arelanguage keywords, user-supplied values, literals, etc. A term’s exact meaning dependsupon the context in which it is used.  Italic font introduces a new term, typically, in the sentence that defines it for the first time.  Fixed-width (mono-spaced) font is used for terms that must be given literally such as SQL commands, specific table and column names used in the examples, programming language keywords, etc. For example, SELECT * FROM emp;  Italic fixed-width font is used for terms for which the user must substitute values in actual usage. For example, DELETE FROM table_name;  A vertical pipe | denotes a choice between the terms on either side of the pipe. A vertical pipe is used to separate two or more alternative terms within square brackets (optional choices) or braces (one mandatory choice).  Square brackets [ ] denote that one or none of the enclosed term(s) may be substituted. For example, [ a | b ] , means choose one of “ a ” or “b ” or neither of the two.  Braces {} denote that exactly one of the enclosed alternatives must be specified. For example, { a | b } , means exactly one of “ a ” or “b ” must be specified.  Ellipses ... denote that the proceeding term may be repeated. For example, [ a | b ] ... means that you may have the sequence, “ b a a b a ”.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 7
  8. 8. Postgres Plus Cloud Database Getting Started Guide2 Postgres Plus Cloud Database - OverviewPostgres Plus Cloud Database simplifies the process of provisioning robust Postgresdeployments, while taking advantage of the benefits of cloud computing. When usedwith Postgres Plus Advanced Server, Cloud Database also provides an Oracle-compatibleDBaaS, offering dramatic cost savings and competitive advantages.2.1 The Benefits of using Postgres Plus Cloud DatabasePostgres Plus Cloud Database provides the following functionality in public clouds,private clouds and for in-house data center installations:  PostgreSQL database. Cloud Database provides enterprise-class database features and performance, using the mature and proven platforms of open source community PostgreSQL or EnterpriseDBs Postgres Plus Advanced Server.  Automatic Binary Replication. The moment your multi-node cluster is available for use, Postgres streaming replication is in operation, keeping all of the nodes in your cluster in sync.  Transparent/elastic scalability. Manually or automatically, Cloud Database allows you to add storage capacity and scale out horizontally to support more users online without interrupting business operations.  Automatic Load Balancing/Connection Pooling. Cloud Database implements automatic load balancing, increasing overall performance by distributing read performance across multiple nodes and re-using connections to support more users.  Self-Healing Failover. Cloud Database automatically replaces a downed read- only replica node or the read-write master node, preserving the continuity and performance of the cluster without loss of data.  Web-based interface. Cloud Database implements point-and-click cluster lifecycle management from start to finish using your favorite web browsers.  Automatic Online backup. Cloud Database provides full protection of data in the cloud, protecting against data mishaps with user-specified, grandfathered rotating backups.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 8
  9. 9. Postgres Plus Cloud Database Getting Started Guide  Database Cloning. Cloud Database allows you to quickly and easily create developer sandboxes based on real production data, saving System Administrators setup, configuration and data load time.  Supports public cloud, private cloud, and in-house data center installations. Cloud Database allows you select the environment that is most cost-effective and convenient for your organization, without vendor lock-in.  Cost-saving Oracle Compatibility. Using an Oracle-compatible Postgres database is a reliable, fast and cost-effective way to move Oracle applications to a public or private cloud.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 9
  10. 10. Postgres Plus Cloud Database Getting Started Guide2.2 Architecture OverviewThe Postgres Plus Cloud Database management console is designed to help you easilycreate and manage high-availability database clusters from a web browser. Traditionally, the expression cluster refers to a single instance of Postgres managing multiple databases; a Cloud Database database server cluster is a collection of high-availability Postgres server instances that reside in a cloud or on a traditional network.When you create a new cluster (a group of replicated database servers), Postgres PlusCloud Database initializes one or more Postgres instances (virtual machines) according toyour specifications. Cloud Database uses Postgres streaming replication to synchronizereplicas in the cluster, and pgpool-II to implement load balancing and connection poolingamong all active instances. Figure 2.1 provides a general overview of the CloudDatabase architecture. Figure 2.1 - An overview of the Cloud Database architecture.The primary node of the cluster contains a host operating system (CentOS 5.6) with arunning instance of Postgres, along with the load balancer. Database modifications areautomatically routed to the primary node; any modifications to the primary node aresubsequently propagated to each replica using Postgres streaming replication.Cloud Database installs Postgres on each replica node in a read-only hot-standby role thatautomatically duplicates all data found on the master node, and all changes made to thatdata, while making it available to service user queries (see Figure 2.2).Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 10
  11. 11. Postgres Plus Cloud Database Getting Started Guide Figure 2.2 - Cloud Database performs automatic load balancing.Replicas provide balanced user s upport as needed - if any instance in the cluster goesoffline, the clusters load is re-balanced among the remaining servers while the instance isautomatically replaced.In the event of a failure of the primary node, a new node is spun up and the disk-storagefor the old master node is attached to it, providing zero data loss when the new masterbecomes available. While the replica nodes are standing by, they are read-only resources,load balancing client queries without a risk of compromising data integrity.Postgres Plus Cloud Database automatically archives data at regular intervals; you canspecify a convenient backup window and how many backups to retain when creating adatabase cluster. Cloud Database also offers backup on demand - simply click theBackup icon to save a copy of the instance. Automatic backups are retained according toyour specifications; on-demand backups are retained until you delete them. Each backupis a complete copy of the cluster; you can use a backup to restore a cluster.Postgres Plus Cloud Database makes it easy to scale a database cluster. To increase thecapacity, performance or reliability of a cluster, you can add replicas to the cluster, orincrease the amount of storage available to each node within the cluster (or both). Youcan also change the characteristics of the virtual hardware by cloning a cluster into amore appropriate server class.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 11
  12. 12. Postgres Plus Cloud Database Getting Started Guide2.3 Postgres Plus Cloud DatabaseA public cloud (shown in Figure 2.3) is a collection of virtual machines hosted by a paidprovider such as Amazon. The virtual machine runs a separate copy of an operatingsystem and an installation of Postgres. Figure 2.3 - Using Cloud Database in a Public Cloud.Select from different combinations of CPU speed, RAM, and disk space to suit yourneeds when provisioning a Cloud Database cluster; Postgres Plus Cloud Database makesit easy to scale up to a more capable cluster, or scale down as your requirements change.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 12
  13. 13. Postgres Plus Cloud Database Getting Started Guide3 Accessing Postgres Plus Cloud DatabaseConfiguration and setup of the Postgres Plus Cloud Database is very simple. To accessCloud Database, open a web browser and navigate to the URL provided by your CloudProvider (e.g. Amazon), after purchasing Cloud Database. The URL will take the form: http://ec2_public_dns_address/Where ec2_public_dns_address is the public address of the Cloud Database.EnterpriseDB maintains a list of available Cloud Database providers at: http://enterprisedb.com/cloud-database/consolesThe Cloud Database management console currently supports the following browsers:  Chrome  Firefox  Internet Explorer  Opera  SafariWhen you first access Cloud Database, a dialog prompts you to Log in or Register ,as shown in Figure 3.1. Figure 3.1 - The Cloud Database Log in or Register dialog.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 13
  14. 14. Postgres Plus Cloud Database Getting Started GuideOn your first visit to Cloud Database, you should: 1. Register a Cloud Database user. 2. Login to the Cloud Database management console. 3. Download your SSH key (for safekeeping). 4. Launch a Postgres database cluster.After launching a cluster, you can connect to that cluster with a Postgres clientapplication such as pgAdmin, EDB-PSQL or Postgres Enterprise Manager. For moreinformation about connecting to the cluster, see Chapter 6, Connecting an Application toa Cloud Database Cluster and Chapter 12.2, Connecting to the Cluster.3.1 Registering a New UserTo register a new user, navigate to the web address of your Cloud Database console, andclick the Register button. The New User Registration dialog opens (shown inFigure 3.2). Figure 3.2 - The New User Registration dialog.Enter user information in the User Details box located on the Step 1 tab:Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 14
  15. 15. Postgres Plus Cloud Database Getting Started Guide  Enter the users first and last names in the Firstname and Lastname fields.  Enter a password for the user, and confirm the password in the Password and Verify Password fields.  Provide an email address for the user in the Email field; please note that the email address is used as the Login identity for the user.  Use the drop-down listbox in the Cloud Provider field to select the host on which the cloud will reside.When youve completed Step 1 , click Next to access the Step 2 tab.If you are using Cloud Database hosted on an Amazon EC2 cloud, the Step 2 dialogopens as shown in Figure 3.3. Figure 3.3 - Registering a user on an Amazon EC2 cloud.Use the Step 2 dialog to provide connection information for your Amazon EC2 cloud.  Enter your Access Key Id in the Access Key Id field.  Enter your Secret Key in the Secret Key field.If necessary, you can use the Find your EC2 credentials hyperlink to connect toAmazonWeb Services to retrieve your credentials.Click the Step 1 tab or the Previous button to review or edit the information on theprior tab. When youve completed the fields on the New User Registration dialog,click Finish .Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 15
  16. 16. Postgres Plus Cloud Database Getting Started GuideAfter registering your user identity and connection information, you are ready to use theLogin/Register dialog (shown in Figure 3.4) to access Cloud Database. Figure 3.4 - The Login/Register dialog.Enter the registered email address in the Username field, and the associated password inthe Password field, and click Login to connect to the Cloud Database managementconsole (shown in Figure 3.5). Figure 3.5 - The Dashboard tab of the Cloud Database management console.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 16
  17. 17. Postgres Plus Cloud Database Getting Started Guide Please note: Immediately after connecting to the Cloud Database management console, you should download your SSH key for safekeeping. The SSH key allows you to establish terminal sessions directly to any server in your cluster to perform tasks manually, or examine (in detail) other aspects of the virtual machine. To download your SSH key, navigate to the User tab of the Cloud Database management console, and click the Download ssh key button. When the download completes, ensure that the downloaded key is stored in a safe place. For information about connecting via SSH, see Chapter 12.2.1, Using SSH to Access a Server.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 17
  18. 18. Postgres Plus Cloud Database Getting Started Guide4 Using the Cloud Database ConsoleTo access the Cloud Database management console, simply open a web browser, andnavigate to the address provided by EnterpriseDB. Provide login information, and themanagement console opens to the Dashboard tab (shown in Figure 4.1).4.1 The Dashboard TabThe Dashboard tab provides an overview of the Cloud Database service status,resources, useful information links and a quick start Launch DB Instance button. Figure 4.1 - The Dashboard tab.Use the Launch DB Instance button located in the Getting Started panel to create anew Postgres cluster.The Resources panel contains an overview of the activity shown on the other tabs ofthe Cloud Database management console; click a link to navigate to the listed resource.For example, click the Events link to navigate to the Clusters tab to review the eventlogs.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 18
  19. 19. Postgres Plus Cloud Database Getting Started GuideThe Service Status panel contains a status report from the cloud provider (ie.Amazon EC2) that will alert you to any regional outages or ongoing maintenance.Navigate through the links displayed in the management console bookshelf to viewdocumentation and tutorials about Cloud Database and Postgres topics.4.2 The Clusters TabUse the Clusters tab (shown in Figure 4.2) to create, monitor and manage activeclusters that reside in the cloud. Figure 4.2 - The Clusters tab.Status indicators on the Clusters tab provide quick visual feedback about the status ofclusters that reside on the cloud: A green checkmark indicates that an object is healthy. A yellow alert symbol calls attention to an object that requires processing.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 19
  20. 20. Postgres Plus Cloud Database Getting Started Guide A red error symbol signifies that an object is not available. A busy-indicator signals that the cluster creation has not completed.Columns in the top panel of the Clusters tab contain information about the clusters thatreside within the cloud. Click on a column name to sort the contents of the column; clicka second time to reverse the sort-order.Use the icons along the left side of the Clusters tab to create new clusters or manageexisting clusters: Use the Add Cluster icon to create a new Postgres cluster in the cloud. Use the Scale Up icon to access the Scale Up dialog to manually add one or more replicas to the current cluster, or add additional memory to the current cluster servers. Use the Scale Down icon to remove a replica from the cluster. Use the Backup icon to take a backup of the entire cluster (a single backup of the cluster data, and a backup of the cluster configuration). Please note: any custom module added to the server cluster that does not reside in the PGDATA directory is not backed up, and will be lost when the cluster is terminated. By default, Cloud Database monitors and propagates changes to the following version-specific directories:  /opt/PostgreSQL/9.1/  /opt/PostgresPlus/9.0AS/  /opt/PostgresPlus/9.1AS/ Use the Clone icon to backup, and then copy the master node of the selected database into a clone of the original master node. Use this feature to create a developer sandbox that is an exact duplicate of a working server.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 20
  21. 21. Postgres Plus Cloud Database Getting Started Guide When you clone a database, only the master node is recreated in the new cluster; for information about manually adding replica servers to the new cluster, see Chapter 9, Manual Scaling. Use the Delete Cluster icon to delete the currently selected cluster. A popup dialog will ask you to confirm your decision to terminate a cluster; once terminated, a cluster may only be restored from a backup. When you terminate an active cluster, backups are not deleted. Backups (including user data) are retained until they are intentionally selected and deleted.You can also access cluster management options by right clicking on a cluster name, andselecting an option from the context menu (shown in Figure 4.4). Figure 4.4 - Right click on a cluster name to access management options.The panels located at the bottom of the Clusters tab provide easy access to helpfulstatistical usage and activity information about the currently selected cluster.Four navigation bars control the display; click a panel name on the navigation bar toaccess one of the following panels:  Select the Details bar to view information about the state of the selected cluster.  Select the Configurations bar to modify configuration parameters for the selected cluster.  Select the Monitoring bar to view usage statistics for the selected cluster.  Select the Events bar to review event logs describing activities on the selected cluster.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 21
  22. 22. Postgres Plus Cloud Database Getting Started Guide4.2.1 The Details panelClick the Details navigation bar to open the Details panel (shown in Figure 4.5). Figure 4.5 - The Details panel on the Clusters tab.The left pane of the Details panel displays information about the currently selectedcluster, and provides controls that allow you to specify auto-scaling thresholds for storageand connection resources.The right pane of the Details panel contains a status overview and connectioninformation for the selected cluster. If you have created replicas, the secondary servernodes are listed below the primary node in the tree control; expand the tree control toview the status of the replication nodes.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 22
  23. 23. Postgres Plus Cloud Database Getting Started Guide4.2.2 The Configurations PanelUse the Configurations panel (shown in Figure 4.6) to define, manage and apply anamed configuration. Figure 4.6 - The Configurations panel.A configuration is a named set of parameters that (when applied), modify the behavior ofa cluster by overriding the default parameters specified in the postgresql.conf orpgpool.conf file. If possible, you should use the Configurations panel to modifyparameters that reside in the postgresql.conf and pgpool.conf files.Before making any changes to the configuration of your Cloud Database cluster, werecommend you review Chapter 4.2.2.3, Best Practices for Working with Configurations.Using the Configurations Panel Controls Figure 4.7 - The Configurations panel controls.Use the controls along the top of the Configurations panel (see Figure 4.7) to managenamed configurations:  Use the drop down list-box under Select a configuration to select a configuration to modify, delete or apply to specified nodes of a Cloud Database cluster.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 23
  24. 24. Postgres Plus Cloud Database Getting Started Guide  Use the Add Configuration button to create a new configuration.  Use the Delete Configuration button to delete the configuration specified in the Select a configuration drop-down list box. Figure 4.8 - The Delete Selected Configuration popup. When the Delete Selected Configuration popup (shown in Figure 4.8) opens, click OK to confirm that you wish to delete the configuration.  Use the radio buttons next to Master or Replica to specify that the selected configuration should be applied to the master node of the cluster, or to all of the replica nodes that reside within the cluster.  Use the Apply button to deploy a configuration on the selected node (or nodes).Adjusting a Parameter ValueYou may not change the parameter settings shown in the Default configuration;instead, choose a configuration for modification from the Select a configurationdrop-down listbox. To create a new configuration, click the Add Configurationbutton. Figure 4.9 - The Add Configuration dialog.When the Add Configuration dialog opens (see Figure 4.9), enter the name of the newconfiguration, and click OK. When the creation is complete, Cloud Database will displayCopy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 24
  25. 25. Postgres Plus Cloud Database Getting Started Guidethe new configuration name in the Select a configuration listbox; the tabbed listbelow the Configurations controls will display the modifiable parameters within thatconfiguration (see Figure 4.10). Figure 4.10 - The Configurations panel, displaying a new named configuration .Use the tabs at the top of the parameter list to select a configuration file to modify:  Click the postgresql.conf tab to access parameters that reside in the postgresql.conf file.  Click the pgpool .conf tab to access parameters that control load balancing.To modify a parameter, right click on the parameter name, and select Edit from thecontext menu, or double-click a parameter value in the MASTERVALUE column. TheConfiguration setting dialog (shown in Figure 4.11) opens, displaying a briefdescription of the parameter and the current parameter value. Figure 4.11 - The Configuration setting dialog.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 25
  26. 26. Postgres Plus Cloud Database Getting Started GuideUse the fields on the Configuration setting dialog to specify a new value for theparameter, and to mark a parameter for deployment:  Use the Parameter Value field to specify a new value for the parameter.  Check the Enabled box to mark the parameter modification for application to your cluster. Please note that the modification will not be deployed until you select the Apply option on the Configurations control panel.Select OK to exit the dialog and preserve changes to the configuration, or Cancel to exitwithout making any changes. Upon exiting the Configuration setting dialog,parameters marked for deployment will display a checkmark next to the parameter name(if Enabled ), and the new parameter value will be displayed in the MASTERVALUEcolumn.To deploy those parameters that are marked as Enabled , click the Apply button on theConfigurations control panel. The Apply settings dialog opens (as shown in Figure4.12). Figure4.12 - The Apply settings dialog. Check the box next to the parameter file that you wish to deploy; select th e OK button to apply any parameter modifications; click Cancel to exit without applying any changes.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 26
  27. 27. Postgres Plus Cloud Database Getting Started Guide4.2.2.1 Modifying postgresql.conf ParametersParameter values in the postgresql.conf file determine Postgres server behavior as itpertains to:  File Locations  Connections and Authentication  Resource Usage  Write-Ahead Logging  Query Planning  Audit Logging  Statistic Gathering  Error HandlingParameters within the postgresql .conf file also enable and determine the behavior ofAdvanced Server utilities, such as SQL Protect, Infinite Cache, and Dynatune.Some modifications to the postgresql.conf parameters require a server restart to takeeffect, while others require a parameter reload. Parameters modified through theConfigurations panel (shown in Figure 4.13) will take affect when applied; if you aremodifying parameters directly on the server (via an ssh connection), review thecomments in the postgresql .conf file to determine if a server restart or reload isrequired.For more information about manually modifying configuration files or controlling theserver, please see Chapter 12, Cloud Database System Administration. Figure 4.13 - The postgresql.conf file.For more information about the postgresql.conf parameters, please refer to thePostgres Plus Advanced Server Guide, available from EnterpriseDB at:http://www.enterprisedb.com/docs/en/9.1/asguide/Postgres_Plus_Advanced_Server_Guide-07.htm - P 601_23230Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 27
  28. 28. Postgres Plus Cloud Database Getting Started Guide4.2.2.2 Modifying pgpool.conf ParametersUse the parameters shown on the pgpool .conf tab (shown in Figure 4.14) to modifyCloud Database server behavior related to load balancing. Figure 4.14 - The pgpool.conf file.Modifications to the pgpool.conf file do not require a Postgres server restart; theparameters are automatically updated when you save the configuration file withoutinterrupting current users.By default, all write transactions are routed to the master node of the Cloud Databasecluster; replica nodes can execute read-only queries. The white_function_list andblack_function_list parameters specify the names of Postgres functions or user-defined functions that may be invoked (or not invoked) on a replica node.  The white_function_list specifies functions that may be executed on replica nodes. Any function not specified on the list is assumed to be unsafe for execution by a replica.  The black_function_list specifies functions that are not executed on replica nodes. Any function not specified on the list is assumed to be safe for execution by a replica. Though the Postgres nextval() and setval() functions can be invoked via a SELECT statement, they perform a write function, modifying the state of the database by incrementing a sequence. By default, Cloud Database includes these functions in the black_function_list to prevent them from executing on a replica node. If you have user-defined functions that should (similarly) not be executed on a replica node, you should add the function name to the black_function_list .Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 28
  29. 29. Postgres Plus Cloud Database Getting Started GuidePlease note that you can specify either a white_function_list or ablack_function_list , but not both.  The reset_query_list parameter specifies the SQL commands sent to reset the connection to the backend when exiting a session. Use a semi- colon as a delimiter when specifying multiple commands (;). The default value of reset_query_list is ABORT; DISCARD ALL .4.2.2.3 Best Practices for Working with ConfigurationsCloud Database allows you to create and apply custom configurations to the master orreplica nodes that reside in your cluster. Please note that changing parameter settings canhave unintended consequences, ranging from degraded performance to system crashes.Consequently, we recommend that only an advanced user who accepts these risks, andhas experience with both Postgres and cloud environments modify parameter settings.There are several ways that you can minimize the risks involved when making parameterchanges:  Always make a snapshot backup of your data before making parameter changes. For information about taking a backup, refer to Chapter 7, Managing Backups and Recovery.  Always setup a test cluster to test parameter changes, to ensure they have the intended effect before deploying them to your production environment. Make the test environment mirror the final target environment as much as possible - this is easy to accomplish by restoring a production backup into a similar size cluster as the original. For more details, see Chapter 5.1.1, Creating a Developer Sandbox.  Only change one parameter at a time (or as few as possible when dealing with interdependent settings) and monitor its effect until you are comfortable with the result.  Make parameter changes on a copy of the existing configuration that is in use for the master or replicas. That way, if the parameter changes prove detrimental it will be easy for you to re-apply the original settings. If you are making changes to configuration files through ssh , make a backup of the configuration files before making any changes, so they can be easily restored.When adjusting parameters, be mindful of that fact that the master node in the clusterprocesses both read and write requests, while the replica nodes in the cluster accept onlyread requests. You can tune the master node and the replica nodes independently toquickly have an impact (either positive or negative) on your write or read performance.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 29
  30. 30. Postgres Plus Cloud Database Getting Started GuideFor a complete summary of the parameters available in PostgreSQL and Postgres PlusAdvanced Server, see Chapter 2 of the Postgres Plus Advanced Server Guide,Configuration Parameters, available at: http://www.enterprisedb.com/docs/en/9.0/asguide/Postgres_Plus_Advanced_Serv er_Guide-07.htm - P600_23360The Postgres Plus Advanced Server Guide provides information about each p arameter,including the privileges required to alter the parameter, and if parameter modificationsrequire a server restart or reload. The documentation also includes detailed sectionsabout using the parameters that affect:  Performance  Resource Consumption and Memory  Query Planning and Optimizer Hints  Error Reporting and Logging  Oracle Compatibility settings  Advanced Server feature-specific settingsCopy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 30
  31. 31. Postgres Plus Cloud Database Getting Started Guide4.2.3 The Monitoring PanelThe Monitoring panel displays graphs that allow you to review statistical usageinformation about the amount of storage and the CPU load for the selected cluster (seeFigure 4.15 ). Figure 4.15 - The Monitoring panel displays usage information.Use the Time Range drop-down listbox to specify the time period that the chartedinformation should span.The Data Space chart displays the amount of allocated data space used by the selectedcluster. The red line denotes the threshold specified by the Data Space Thresholdslider on the Details panel (the threshold at which the cluster will be scaled-up). Theblue line indicates the amount of the data space that is currently in use.The Connections chart displays a graph of the number of connections to the clusterduring the selected time range. The red line denotes the threshold specified by theConnections slider on the Details panel.The CPU Load chart displays the processing load placed on the CPU by connectingclients.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 31
  32. 32. Postgres Plus Cloud Database Getting Started Guide4.2.4 The Events PanelThe Events panel (shown in Figure 4.16) displays an event log that contains a history ofselected events within the cluster. Figure 4.16 - The Events panel displays server activity.  Click a column heading to sort the logged activity by the selected column; click again to reverse the sort order.  Use a mouse to select multiple rows from the event log for copy and paste operations.4.3 The Backups TabUse the Backups tab (shown in Figure 4.17) to manage cluster backups; the tab displaysa list of the available backups. Figure 4.17 - The Backups tab of the Cloud Database console.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 32
  33. 33. Postgres Plus Cloud Database Getting Started GuideA backup captures and stores the status and condition of a cluster at a specific point-in-time. Click a column heading to sort the column contents; click again to reverse the sortorder.Use the icons on the left side of the Backups tab to restore or delete backups: Highlight a backup in the list, and click the Recover Backup icon to open a dialog that allows you to restore a cluster from the selected backup. Specify a name for the cluster, and click the Recover button to continue. A popup confirms that the cluster is being restored; close the popup and navigate to the Clusters tab to monitor the restoration process. Highlight a backup in the list and click the Delete Backup icon to delete the selected backup. A popup will ask you to confirm that you wish to d elete the backup before the backup is actually deleted.4.4 The User TabSelect the User tab (as shown in Figure 4.18) to view information about the current user,to review a list of registered users, or to delete unwanted user accounts. Figure 4.18 - The User tab of the Cloud Database console.  Use the Download SSH Key button to download the private key file for the current user.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 33
  34. 34. Postgres Plus Cloud Database Getting Started Guide  Click the Change Password button to open a dialog that allows you to change the password for the current user.  Use the Apply Changes button to make any changes to the user information persistant; click the Discard changes button to abandon any changes, and display the previous information.Please note: user administration controls are not available to users of the DbaaS hosted onAmazon and managed by EnterpriseDB.Cloud Database recognizes the first registered user as the administrative user. Only thatuser is privileged to see the list of registered Cloud Database users, and to delete selectedusers. If you are an administrative user, you can use the controls under the UserAdministration heading to delete user accounts by highlighting a name in the list, andclicking the Delete User button. Figure 4.19 - The Delete User dialog.Before deleting the user, Cloud Database will ask you to confirm your decision (seeFigure 4.19). Click Delete to remove the user, or Cancel to exit without applying thechange.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 34
  35. 35. Postgres Plus Cloud Database Getting Started Guide5 Creating a New Server ClusterBefore you can connect to Postgres from a client application, you must create a servercluster. Use the Launch DB Instance button (located in the upper left panel of theDashboard Tab ) or click the Add Server button on the Clusters tab to open theCreate a New Server Cluster dialog, shown in Figure 5.1. Figure 5.1 - Specify information about the new cluster on the Step 1 tab.Use fields on the Create a New Server Cluster dialog to specify information aboutthe new cluster:  Specify a name for the primary node of the new server cluster in the Cluster Name field.  Use the drop-down listbox in the Engine Version field to select the version of the Postgres engine that you wish to use.  Use the drop-down listbox in the Server Class field to specify the size of each cluster node.  Use the drop-down listbox in the Number of nodes field to specify the number of server nodes that you wish to create. The name specified in the Cluster Name field will apply to the primary node; each additional node will act as a replication server for the primary node.  Use the Storage GB field to specify the initial size of the data space (in Gigabytes).Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 35
  36. 36. Postgres Plus Cloud Database Getting Started Guide  Enter the name of the cluster owner in the Master User field.  Enter the password associated with the name in the Master Password field.Click the Next button to continue to the Step 2 tab (shown in Figure 5.2). Figure 5.2 - Specify backup information on the Step 2 tab.Use the fields on the Step 2 tab to specify additional database information:  Use the # of Backups to retain field to specify the number of server backups stored. When the specified number of server backups is reached, Cloud Database will delete the oldest backup to make room for a new backup.  Use the Backup Window field to specify a time that it is convenient to backup the server (you may wish to schedule backups to occur when the CPU load is the lightest).Use the Previous button or select a specific tab to return to a completed tab to review orupdate information; when you have completed the Create a New Server dialog, clickLaunch to create the database cluster.A popup dialog confirms that Cloud Database is creating a new cluster (see Figure 5.3);click the X in the upper-right corner of the popup to close the popup.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 36
  37. 37. Postgres Plus Cloud Database Getting Started Guide Figure 5.3 - A popup confirms that the new cluster is being created.Navigate to the Clusters tab of the Cloud Database console to monitor the creation ofthe cluster.The default security rules for a newly-created cluster specify that port 9999 (the loadbalancing port) is open for connections from any IP address. You can customize thesecurity rules to selectively restrict the IP address/es from which the server will acceptconnections. For detailed information about modifying the security group to restrictaccess from unknown IP addresses, see Section 12.3, Securing a Cloud Database Cluster.Each database server is created with the default parameter settings that are displayed inthe Configurations panel of the Clusters tab. You can use the Configurationspanel to create one or more named configurations that contain customized parametervalues that, when applied to a cluster will override the default parameters specified in thepostgresql.conf and pg_hba.conf file.Selecting a Server Class for your Public Cloud ClusterWhen creating a new cluster, you must specify a server class. The server classdetermines the size and type (compute power and RAM) of each node within the cluster.Cloud Databases flexibility and scalability allow you to save money by adjusting theamount of storage used by the cluster, or number of replicas in the cluster as yourresource demands change.For instance, on Amazon:  You can start with a t1.micro instance to reduce development costs, and easily upgrade to a more capable instance as your performance requirements dictate.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 37
  38. 38. Postgres Plus Cloud Database Getting Started Guide  If you find that your application is CPU bound, you may want to move to a high- CPU instance such as an m1.large instance or a m1.xlarge instance.  High-memory instances such as m2.xlarge , m2.2xlarge and m2.4xlarge are well suited for databases accessed by high throughput applications that require a high I/O rate.  A c1.xlarge instance offers more CPU performance, and is well suited for applications that require a high CPU rate.5.1.1 Creating a Developer SandboxWith a few simple steps, you can create a developer sandbox that is an exact duplicate ofthe original master node: 1. Navigate to the Clusters tab. 2. Highlight the name of the cluster you wish to clone into the sandbox. 3. Click the Clone icon located on the left side of the window. The Clone Cluster? dialog opens (as shown in Figure 5.10). Figure 5.10 - The Clone Cluster? dialog. 4. Click the Clone button.The Clone icon instructs Cloud Database to backup, and then copy the master node ofthe selected database into a clone of the original master node. After taking a backup ofyour database, Cloud Database will open the Create clone... dialog (shown inCopy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 38
  39. 39. Postgres Plus Cloud Database Getting Started GuideFigure 5.11), prompting you to specify a name for the clone and select a Server Class .Complete the dialog, and click the Clone button to create the sandbox. Figure 5.11 - Creating a clone of a database.Please note that when you clone a database, only the master node is recreated in the newcluster; for information about manually adding replica servers to the new cluster, seeChapter 9, Manual Scaling.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 39
  40. 40. Postgres Plus Cloud Database Getting Started Guide6 Connecting an Application to a Cloud Database ClusterConnecting an application to a Postgres instance that resides in the cloud is no differentthan connecting to an instance that resides on traditional hardware. To initially connectto the Postgres database, you must specify its IP address and port, and authenticateyourself with the server (using the role defined when the server cluster was created). Figure 6.1 - The Details panel on the Clusters tab.If you have defined a cluster with two or more servers, client applications should alwaysconnect to the load balancing port of the master server. This will ensure that readrequests are distributed efficiently across the cluster replicas to maximize performance,while write requests are directed only to the cluster master. Replica server nodes arelisted below the primary node in the tree view.  The DNSNAME column displays the address of the node; a connecting client should use this address when connecting to a specific server.  The LBPORT column displays the port number to which a client application should connect to utilize load balancing. Since only the master node of a multi-server cluster operates in read/write mode, all write queries will be directed to the master node, while any read-only queries may be directed to a replica node.  The DBPORT column displays the default listener port for the Advanced Server or PostgreSQL server. To connect directly to the database listener port, you must modify the clusters security group to allow connections from your client. For more information about modifying a security group, please see Section 12.3, Securing a Cloud Database Cluster.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 40
  41. 41. Postgres Plus Cloud Database Getting Started GuideUse the authentication information (Master User and Master Password ) provided onthe Create a New Server Cluster dialog to establish the initial connection as thedatabase superuser, using a client application (such as EDB-PSQL or Postgres EnterpriseManager). Please note that connecting with this identity grants you superuser privilegeson the server; you should not share this connection information with un-trusted users.After connecting as the database superuser, you should create lesser-privileged user roleswith which non-administrative users will connect.For detailed information about connecting to a Cloud Database cluster with ssh , edb-psql (or psql ), or the Postgres Enterprise Manager client, please see Section 12.2,Connecting to the Cluster.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 41
  42. 42. Postgres Plus Cloud Database Getting Started Guide7 Managing Backups and RecoveryWhen you take a backup, Cloud Database makes a copy of the contents of thePostgreSQL PGDATA directory. The PGDATA directory contains the data and the meta-data required to construct an exact copy of the Postgres data cluster (the data and thedatabase objects that reside within that Postgres instance). To capture a backup of a cluster, navigate to the Clusters tab, highlight a name inthe cluster list, and click the Backup icon. Cloud Database asks you to confirm that youwish to backup the selected cluster (see Figure 7.1). Figure 7.1 - The Backups tab of the Cloud Database console.Click the Backup button to instruct Cloud Database to capture a backup of the selectedcluster. While Cloud Database performs a backup, the PENDING column of theClusters tab will display the message, Backup in progress .Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 42
  43. 43. Postgres Plus Cloud Database Getting Started Guide7.1 Reviewing Stored BackupsNavigate to the Backups tab (shown in Figure 7.2) to review a list of stored clusterbackups. Figure 7.2 - The Backups tab of the Cloud Database console.A backup captures and stores the status and condition of a cluster at a specific point-in-time.  The ID column contains a unique backup identifier.  The CAPACITY column contains the storage capacity of the cluster at the time that the backup was taken.  The ENGINE VERSION column contains a description of the Postgres version that the saved cluster is using.  The CLUSTER column identifies the name of the cluster preserved in the backup.  The STARTED column displays the date and time that the backup was initiated.You can use the icons on the left side of the Backups tab to restore or delete the selectedbackup: Highlight a backup in the list, and click the Recover Backup icon to open a dialog that allows you to restore a cluster from the selected backup. Highlight a backup in the list and click the Delete Backup icon to delete the selected backup. A popup will ask you to confirm that you wish to delete the specified backup before it is actually deleted.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 43
  44. 44. Postgres Plus Cloud Database Getting Started Guide7.2 Restoring a Cluster from BackupYou can restore a cluster, recovering the state of a cluster at the time that a selectedsnapshot was taken, or use the restoration process to create a developer sandbox. Torestore a cluster, navigate to the Backups tab, and highlight the backup to be restored inthe onscreen list. Click the Recover Backup icon, located on the left side of the window. Figure 7.3 - The Recover Data from a Backup dialog.When the Recover Data … dialog (shown in Figure 7.3) opens, specify a name for therestored cluster, and click the Recover button to continue. A popup confirms that thecluster is being restored (see Figure 7.4); close the popup and navigate to the Clusterstab to monitor the restoration process. Figure 7.4 - The Recover Data from a Backup dialog.Please note: when you restore a backup, the server configuration will match the originalconfiguration, but the server addresses will change.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 44
  45. 45. Postgres Plus Cloud Database Getting Started Guide7.3 Reassigning an Elastic IP Address on AmazonIf you need to recover an instance from backup, you can retain the original IP address forthe master node, so your client applications will not need to change their connectionproperties. To assign a specific IP address to a server instance: 1. Sign in to the Amazon Web Services console. 2. Navigate to the Elastic IPs tab. 3. Select the IP address you wish to assign to the new instance. If you wish to reassign an IP address that is associated with a named cluster, you must disassociate the cluster before re-associating the IP address to another cluster. Please note that disassociating the cluster from an IP address will result in the deletion of the cluster. 4. Click the Associate Address button.When the Associate Address dialog opens (as shown in Figure 7.5), select the masternode from the drop-down list box. Figure 7.5 - The Associate Address dialog.Click the Yes , Associate button to associate the selected IP address with the choseninstance. Please note that it may take a few minutes for changes on the Amazon server topropagate to the Cloud Database Management Console.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 45
  46. 46. Postgres Plus Cloud Database Getting Started Guide8 Automatic FailoverThe Cloud Database cluster manager constantly monitors the state of each cluster. Eachcluster is composed of a single master Postgres instance that operates in read -write mode(performing all writes to the database) and one or more replica Postgres instances.Replica nodes are read-only, automatically duplicating all data found on the master node,and all changes made to that data.In the event of the failure of the master instance, a new instance is automatically createdand attached to the old masters data, preventing any data loss. When failover occurs, theserver load is automatically re-balanced among the remaining servers. This self-healingproperty is at the heart of providing high availability to cluster users. After a failover is complete, the original master instance of the database server will still be available on Amazon EC2, allowing you to perform any post-mortem activities that may be required. If you do not wish to utilize the preserved instance, you should use the Amazon management console to delete the instance.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 46
  47. 47. Postgres Plus Cloud Database Getting Started Guide9 Manual ScalingAdding additional replicas to your database cluster increases the CPU power available tohandle additional client requests or applications, increasing the number of clientconnections that can be serviced. When the scale up is complete, each additional replicaautomatically assumes a share of the read-only workload from incoming queries.Cloud Databases Scale Up dialog makes it simple to manually add additional replicas toa cluster if you find that server resources are strained. The Scale Up dialog also allowsyou to increase the amount of storage available to a cluster with three simple clicks.When adding a replica to a current cluster, Cloud Database: 1. Creates a new virtual machine of the same size and type as the other virtual machines in the cluster. 2. Copies the data from the master node to the new replica. 3. Updates the cluster manager and load balancer to recognize and use the new replica. 4. Starts the server instance that resides on the new replica.The new replica then begins sharing the processing load for the cluster, allowing thecluster to handle more user and client connections.The Cloud Database Scale Up dialog (located on the Clusters tab) serves twofunctions; the dialog can be used to:  Add additional storage space to each node on the cluster. and/or  Add additional replica nodes to a cluster.If you specify that Cloud Database should add both storage and replicas, Cloud Databasewill process the request for additional storage before adding replicas to the cluster. All ofthe nodes on the cluster will be of the newly specified node size.Manually adding a Replica or MemoryTo add a replica to a cluster, navigate to the Clusters tab, and highlight the server thatyou wish to scale up. Click the Scale Up icon on the Clusters tab to open the ScaleUp dialog (shown in Figure 9.1).Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 47
  48. 48. Postgres Plus Cloud Database Getting Started Guide Figure 9.1 - The Scale Up dialog.Use the drop-down listboxes on the Step 1 tab to specify:  The number of replicas to add to the cluster.  The amount of memory (in Gigabytes) that will be added to each server in the cluster.When youve completed the dialog, click Next to continue to the Step 2 tab (shown inFigure 9.2). Figure 9.2 - The Scale Up dialog.Use the Scale Up button on the Step 2 tab to confirm that you wish to add thespecified number of replication servers, or the specified amount of memory to the cluster.Click the Previous button to return to the Step 1 tab to adjust the specified amounts,or click the X in the upper corner of the dialog to exit without saving modifications to theserver.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 48
  49. 49. Postgres Plus Cloud Database Getting Started Guide10 Automatic ScalingWhen auto-scaling in enabled, Cloud Database monitors the server resources in use, andautomatically adds additional resources when usage exceeds a user specified percent (bydefault, 90% ). Controls on the Details panel of the Clusters tab makes it easy toadjust the threshold at which Cloud Database automatically scales up resources.  When the Data Space Threshold is reached, Cloud Database adds additional storage space.  When the Connection Threshold is reached, Cloud Database adds replica nodes.Adding additional replicas to your database cluster increases the number of clientconnections and queries that each cluster can handle, while maintaining a high -level ofoverall performance. Each additional replica automatically assumes a share of the read -only workload from incoming queries.10.1 Adjusting the Automatic Scaling ThresholdsUse the Auto-Scaling controls on the Details panel to adjust the threshold at whichCloud Database automatically scales up cluster resources. To access the Details panel,navigate to the Clusters tab, and highlight the name of a listed cluster. Click theDetails navigation bar on the Clusters tab to open the Details panel (shown inFigure 10.1). Figure 10.1 - The Details panel on the Clusters tab.Auto-scaling is not enabled by default; to enable auto-scaling, check the Auto-Scalingcheckbox. When auto-scaling is enabled, Cloud Database will automatically increaseyour data space by 50% when the disk usage exceeds the value specified by the DataSpace Threshold slider.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 49
  50. 50. Postgres Plus Cloud Database Getting Started Guide11 Customizing Your ClusterPostgres Plus Cloud Database creates fully-functioning, cloud-based, high-availabilitydatabase clusters of various sizes complete with replication, load balancing, connectionpooling, backup and failover capabilities. Cloud Database configurations can be definedin minutes without any special database knowledge or skills. This characteristic isgreatly appreciated by application developers who want to create robust, data-intensiveapplications quickly, and who may not have the time, inclination, or skills to otherwiseachieve the same results. This type of black box setup was designed to dramaticallyincrease the productivity of developers, DBAs, and system administrators alike.However, there are many users who, while enjoying the black box benefits describedabove, prefer to take a more hands-on approach to managing their databases. PostgresPlus Cloud Database was also designed with these users in mind.You can modify the behavior of a Cloud Database cluster by creating and applyingcustom configurations to the master or replica servers. For more information aboutmodifying and using custom configurations, see Chapter 4.2.2, The Configuration Panel.You can also use supporting components to extend the functionality of your CloudDatabase cluster; the following sections provide an overview of how to add an extensionto a new or existing cluster.For detailed information about adding PostGIS functionality to a Cloud Database cluster,please see the tutorial, How to Install PostGIS in a Cloud Database Cluster, availablefrom the management console bookshelf, located on the Dashboard tab.11.1 Adding an Extension to a New ClusterYou can expand the functionality of your cluster by adding supportin g components toPostgres, such as PostGIS (support for spatial data types and functions). To add Postgresextensions to a Cloud Database cluster, you must manually install the software usingssh , utilizing the command line for any installers.If you know prior to creating a cluster that you will be adding a server extension, you cansimplify the process by following the procedure outlined below. 1) Create a single instance cluster (a cluster with only a master node). 2) Install the extension (such as PostGIS). 3) Add replicas to scale up to the desired initial cluster size.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 50
  51. 51. Postgres Plus Cloud Database Getting Started GuideThe above sequence allows you to install the extension only once; Cloud Database willpropagate the extension to replica servers during the scale up process. In addition, theadded extension will persist during scale up, restore and failover operations.Cloud Database monitors and propagates changes to the following version -specificdirectories:  /opt/PostgreSQL/9.1/  /opt/PostgresPlus/9.0AS/  /opt/PostgresPlus/9.1AS/Please note: Modifications to other directories will not automatically propagate toreplicas; to prevent unpredictable results, you should restrict modifications to thesedirectories and their sub-directories only.11.2 Adding an Extension to an Existing ClusterIf you are adding an extension to an existing cluster, you must install the extensionsbinaries or invoke any component installer on each node in the replication cluster; youshould begin by installing the extension on the master server node. If the installationprocess includes invoking SQL scripts (that create schema objects or functions), thescripts do not need to be invoked on each replica; schema objects that have been createdon the master node will propagate to each replica node.Please note that any extensions that create or depend on the propagation of environmentvariables are not supported at this time.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 51
  52. 52. Postgres Plus Cloud Database Getting Started Guide12 Cloud Database System AdministrationWhile a Cloud Database cluster requires far less maintenance than a traditional network,you may occasionally need to perform administrative tasks. The sections that followdetail some of the tasks that are performed outside of the Cloud Database managementconsoles graphical interface:  Moving an existing database into a Cloud Database cluster  Connecting an administrative client to a Postgres Server  Securing a Cloud Database cluster  Manually modifying configuration parameters  Stopping and starting the server12.1 Moving an Existing Database into a New ClusterYou can use the Postgres pg_dump utility to migrate an existing Postgres database(schema, data, and associated database objects) into a Cloud Database cluster.pg_dump creates an archive that contains the commands needed to re-create and populateyour existing database. After moving the archive to the Cloud Database, usepg_restore to uncompress and play the SQL commands contained in the archive. Thefollowing section will walk you through the process of moving a database to CloudDatabase using pg_dump .You can also use the pg_dumpall utility to move an entire Postgres cluster (data,schema information, and roles) to Cloud Database; for detailed information about usingpg_dumpall , please see the Postgres documentation at: http://www.enterprisedb.com/docs/en/9.1/pg/app-pg-dumpall.htmlStep One - Set the Search Path on the Source SystemOpen a terminal window on the system that contains your Postgres source database, andnavigate to the Postgres installation directory. By default, the Advanced Serverinstallation directory is: /opt/PostgresPlus/version_numberFor PostgreSQL, the directory is:Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 52
  53. 53. Postgres Plus Cloud Database Getting Started Guide /opt/PostgreSQL/version_numberAdd the pg_dump utility to the search path for the current session. For Advanced Server,invoke the pgplus_env.sh script: source pgplus_env.shFor PostgreSQL, invoke the pg_env.sh script: source pg_env.shStep Two - Create the pg_dump ArchiveUse the pg_dump utility to create an archive that contains the commands required torecreate a database. When invoking pg_dump , include the -Ft flag to instruct pg_dumpto format the output as a tar file, and the -U flag to specify the name of the databasesuperuser (see Figure 12.1): pg_dump -Ft -U db_superuser db_name > archive_name.tar Figure 12.1 - Creating the pg_dump archive.Where: db_superuser is the name of a Postgres database superuser. db_name is the name of the database that you wish to move to Cloud Database. archive_name.tar is the complete path and name of the archive. Please note that you must have permission to write a file to the location specified.If prompted, enter the password associated with the database superuser.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 53
  54. 54. Postgres Plus Cloud Database Getting Started GuideStep Three - Move the Archive to Cloud DatabasePlease note: by default, port 22 (used for ssh and scp connections) is closed; beforeinvoking an ssh or scp command, you must modify the security group for the cluster,opening the port. For detailed information about opening a port, see Section 12.3,Securing a Cloud Database Cluster.Use the scp command to copy the archive to the master server in the Cloud Databasecluster; include the -i option to specify the location of your ssh key (see Figure 12.2): scp -i ssh_key_file file_name root@host_name: Figure 12.2 - Moving the archive to Cloud Database.Where: ssh_key_file specifies the pathname of the Cloud Database ssh private key file. file_name specifies the archive name. host_name specifies the host name of the master node of the Cloud Database cluster; the host name is located on the Details panel of the Clusters tab in the Cloud Database console (see Figure 12.3). The colon (:) at the end of this command specifies that the file will be copied to the root directory on the clusters primary node; please note that you can specify a file destination by adding a destination path after the colon.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 54
  55. 55. Postgres Plus Cloud Database Getting Started Guide Figure 12.3 - The Details panel of the Clusters tab.For information about obtaining and using your ssh key, please see the tutorial,Connecting to Cloud Database, available through the Cloud Database Dashboard.Step Four - Connect to Cloud Database with sshUse ssh to connect to your Cloud Database cluster master node. You should alwaysconnect as root , specifying the location of the ssh key (on your local host) in thecommand (see Figure 12.4):ssh -i/path/ssh_key.pem root@host_nameWhere: path specifies the location of your Cloud Database ssh certificate on the system from which you are connecting. ssh_key.pem specifies the name of the Cloud Database ssh private key file. host_name specifies the host name of the master node of the Cloud Database cluster; the host name is located on the Details panel of the Clusters tab in the Cloud Database console. Figure 12.4 - Connecting to Cloud Database with ssh.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 55
  56. 56. Postgres Plus Cloud Database Getting Started GuideStep Five - Set the Search Path on Cloud DatabaseAfter connecting, you should add the pg_restore command to the search path of thesession. Navigate to /opt/PostgresPlus/CloudDB , and invoke (for AdvancedServer), the pgplus_env.sh script: source pgplus_env.shFor PostgreSQL, invoke the pg_env.sh script: source pg_env.shStep Six - Invoke pg_restore on the master server in the Cloud Database clusterBefore invoking the pg_restore utility, you must create the target database in themaster server; you can use the createdb client utility at the command line to create thetarget: createdb database_nameWhere: database_name specifies the name of the database on Cloud Database.Then, invoke the pg_restore utility: pg_restore -Ft /path/archive_name.tar -d target_db_nameWhere: path is the pathname to the archive on the Cloud. archive_name.tar is the name of the archived database. target_db_name is the name of the target database on the Cloud.Include the -Ft flag to specify that the file is an archive; use the -d target_db_nameflag to specify the name of the database on the Cloud (see Figure 12.5).Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 56
  57. 57. Postgres Plus Cloud Database Getting Started Guide Figure 12.5 - Restoring the database on the Cloud.Step Seven - Confirm that the Move was SuccessfulAfter performing the restore, you can use the psql client (or Advanced Servers edb-psql ) to connect to the Cloud Database and confirm that the database has beentransferred (see Figure 12.6): psql target_db_nameUse the d command to view a list of database objects in the current database: Figure 12.6 - Confirming that the move was successful.To exit the psql client, enter q ; to exit the ssh session, type exit and Return .For more information about using the psql client, please see the tutorial, Connecting to aCloud Database. You can access the tutorial through the Dashboard tab of the CloudDatabase console.For more information about using PostgreSQL utilities to move an existing database intoCloud Database, please see the documentation at:http://www.enterprisedb.com/docs/en/9.1/pg/backup-dump.htmlCopy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 57
  58. 58. Postgres Plus Cloud Database Getting Started Guide12.2 Connecting to the ClusterThe following sections will walk you through the process of connecting to a node of aCloud Database cluster using some of the utilities that are distributed with Postgres PlusAdvanced Server and PostgreSQL.12.2.1 Using ssh to Access a ServerPlease note: Before using ssh to connect to the server, you must modify your AWSsecurity group to permit client connections on port 22 ; for more information aboutmodifying a security group, please see Chapter 12.3, Securing a Cloud Database Cluster.Cloud Database creates an ssh key when you register your user information. Beforeconnecting to a Postgres instance that resides on the cloud via an ssh encryptedconnection, you must download the ssh key, and adjust the privileges on the key file. Todownload your private key, navigate to the User tab, and click the Download SSH Keybutton.After downloading the key, assume superuser privileges, and adjust the key permissionswith the command: $ chmod 0600 ssh_key_file.pemYou can use ssh to connect to the operating system of any node hosted by CloudDatabase (see Figure 12.7). Unless you have created other operating system useraccounts, you should ssh to the server node as root , specifying the location of the sshkey (on your local host) in the command: ssh -i/path/ssh_key_file.pem root@host_name Figure 12.7 - Connecting to a node on Cloud Database.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 58
  59. 59. Postgres Plus Cloud Database Getting Started GuideWhere: ssh_key_file.pem specifies the complete path of the Cloud Database ssh private key file. host_name specifies the host name of the node to which you wish to connect. You can find the host name in the DNSNAME column, on the Details panel of the Clusters tab in the Cloud Database console (see Figure 1.2). Figure 1.2 - The Details panel of the Clusters tab.After connecting via ssh , you can:  Shutdown, start, or restart the Postgres server.  Download and install Postgres extensions.  Use PostgreSQL Client Applications.  Invoke PostgreSQL Server Applications. Please note: Postgres Server applications must be invoked by the Postgres cluster owner (identified when creating a Cloud Database cluster as the Master User ). If you are using a PostgreSQL server, the default user name is postgres ; if you are using Advanced Server, the default user name is enterprisedb . To change your identity after connecting via ssh , use the su command: # su enterprisedbPlease note: to enable a user (other than root ) to connect to a Cloud Database server,you must configure ssh login on the server node for that users account.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 59
  60. 60. Postgres Plus Cloud Database Getting Started Guide12.2.2 Connecting with the Postgres Enterprise Manager ClientThe Postgres Enterprise Manager (PEM) client provides a powerful graphical interfacethat you can use to create and manage database objects (and privileges) on a localPostgres installation, or on a Cloud Database cluster node. The PEM client should beinstalled and invoked from a local workstation; you must define a separate serverconnection for each node of a Cloud Database cluster that you wish to manage with thePEM client.By default, the PEM client is installed with an Advanced Server installation (version 9.1or greater); the PEM client is also available for PostgreSQL users as part of Postgres PlusSolution Pack, distributed via StackBuilder Plus. For detailed information aboutinstalling the PEM client, visit:http://www.enterprisedb.com/products-services-training/products/postgres-enterprise-managerTo open the PEM client, navigate through the Applications menu:  If you are using Advanced Server (version 9.1 or greater), the Postgres Enterprise Manager menu selection will be located under the installation menu.  If you are a PostgreSQL user, use the Postgres Enterprise Manager menu to invoke the PEM client.When the PEM client opens, select Add Server from the File menu to open the NewServer Registration dialog, and define a connection to a Cloud Database cluster(see Figure 12.8).Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 60
  61. 61. Postgres Plus Cloud Database Getting Started Guide Figure 12.8 - A Postgres Studio session, on the Cloud Database host.Provide information about the connection in the New Server Registration dialog:  Specify the name of the Cloud Database cluster in the Name field.  Provide the IP address or host name of the master node of the cluster in the Host field. You can find the IP address in the DNSNAME column on the Details panel for the cluster on the Cloud Database console.  Specify the Port through which you wish to connect to the server. By default, the only port open for connections from clients (residing outside of the cluster) is port 9999 , on the master node. Port 9999 is the load balancing port, and is best used when performing queries. If you are modifying a database or invoking administrative functions, you should connect to the master nodes listener port, identified in the DBPORT column, on the Details panel of the Clusters tab. Before connecting to the servers listenerCopy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 61
  62. 62. Postgres Plus Cloud Database Getting Started Guide port, you must modify the security group to allow connections; see Section 12.3, Securing a Cloud Database Cluster for more information about modifying a security group.  Select a maintenance database using the drop-down listbox in the Maintenance DB field. Select edb if you are connecting to an Advanced Server database, and postgres if you are connecting to a PostgreSQL database.  Specify the role name that the PEM client should use when connecting, in the Username field.  Provide the password associated with that role, in the Password field.Click OK to connect to Cloud Database; once connected, the server will appear in the treecontrol in the PEM Object browser (shown in Figure 12.9).Figure 12.9 - The PEM client window, showing local and Cloud Database servers.Now, you are ready to use the point-and-click functionality of the PEM client to createand manage database objects that reside on the node of your Cloud Database cluster towhich you have connected.The PEM client offers context-driven help; click the Help button provided on eachdialog to access online documentation with information about the current dialog.Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 62
  63. 63. Postgres Plus Cloud Database Getting Started Guide12.2.3 Connecting to Cloud Database with psql or edb-psqlpsql is the PostgreSQL command-line client; edb-psql is the Advanced Servercommand-line client. After connecting to a Postgres server hosted on Cloud Database viapsql or edb -psql , you can invoke SQL commands or use meta-commands to:  Execute queries  Insert, update, and delete data  Create and manage database objects (tables, indexes, views, etc.)  Create user roles and manage privileges  Review object and role attributes  Invoke scripts containing complex (or simple) commandsedb -psql offers complete compatibility with psql , while adding the ability to processOracle-compatible syntax for anonymous blocks, CREATE FUNCTION statements,CREATE PROCEDURE statements and CREATE PACKAGE statements on an AdvancedServer database. You can also use edb -psql to manage Advanced Server extensions(such as SQL Protect), or use Oracle-compatible features not found in PostgreSQL.By default, a Cloud Database cluster is only open to connections via port 9999 on themaster node. Port 9999 is a good choice if you are connecting for the purpose ofquerying the database, but if you are modifying database objects, or performingadministrative functions, you should connect directly to the servers listener port. Some administrative functions, if executed over port 9999, may be directed to theincorrect node of a multi-node cluster where they may not have the intended effect, or may return an invalid value.The listener port number is displayed in the DBPORT column of the Details panel of theClusters tab.Before connecting to the servers listener port, you must modify the security group toallow connections; see Section 12.3, Securing a Cloud Database Cluster for moreinformation.Connecting with edb-psql (or psql) From a Local WorkstationAfter installing Advanced Server or PostgreSQL on a local workstation, you can useedb-psql or psql to perform administrative tasks on a Cloud Database cluster.To open an edb-psql console on an Advanced Server workstation, navigate through theApplications (or Start ) menu to the Postgres Plus Advanced Server menu;then, open the Run SQL Command Line menu, and select EDB-PSQL .Copy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 63
  64. 64. Postgres Plus Cloud Database Getting Started GuideTo open a psql console on a PostgreSQL workstation, navigate through theApplications (or Start ) menu to the PostgreSQL menu, and select SQL Shell(psql) . Figure 12.10 - The EDB-PSQL command line utility.Provide connection information for the Cloud Database server to which you areconnecting:  When prompted for a Server , enter the IP address or DNS name of the Cloud Database server. The IP address is displayed in the DNSNAME column on the Details panel of the Clusters tab of the Cloud Database management console.  When prompted for a Database , enter the name of the database to which you wish to connect. By default, an Advanced Server cluster is created with a database named edb . A PostgreSQL cluster is created with a database named postgres .  When prompted for a Port , enter the port on which the server is listening. For database queries, you can use port 9999 ; if you are modifying database objects or performing administrative functions, you should use the servers listener port (5444 for an Advanced Server cluster, 5432 for a PostgreSQL cluster).  When prompted for a Username , enter the role you wish to use when connecting to the server. The name of the database superuser is specified in the Master User field when defining a Cloud Database server cluster. By default, theCopy right © 2012 EnterpriseDB Corporation. All rights reserv ed. 64

×