Amazonrds 简明教程
Amazon RDS - PostgreSQL Features
PostgreSQL 是一个功能强大、开源的对象关系数据库系统,因其可靠性、功能强大性和性能而享有盛誉。AWS RDS 运行着 PostgreSQL 的各个版本。它支持即时还原和备份、创建 DB 快照,并在多可用区环境中运行。
PostgreSQL is a powerful, open source object-relational database system which has earned a strong reputation for reliability, feature robustness, and performance. AWS RDS runs various versions of PostgreSQL. It supports point-in-time restore and backups, creation of DB snapshots and running it on a multi-AZ environment.
Supported Versions
9.3 至 10.4 版本是 RDS 平台支持的主要版本。如果在创建 DB 期间未指定版本,则它将默认为该时间的最新版本。以下是使用 Python SDK 程序中的 AWS API 获取所有受支持的 DB 引擎版本的一个示例。
The versions 9.3 through 10.4 are the major versions supported in the RDS platform. If no version is mentioned during the DB creation, it defaults to the most recent version at that point in time. Below is an example of how to get all supported DB Engine versions using AWS API in a python SDK program.
import boto3
client = boto3.client('rds')
response = client.describe_db_engine_versions(
DBParameterGroupFamily='',
DefaultOnly=True,
Engine='postgres',
EngineVersion='',
ListSupportedCharacterSets=False, #True,
)
print(response)
当我们运行以上程序时,我们得到以下输出:
When we run the above program, we get the following output −
{
"ResponseMetadata": {
"RetryAttempts": 0,
"HTTPStatusCode": 200,
"RequestId": "c85cd49f-2c16-44b4-9890-cb233651f962",
"HTTPHeaders": {
"x-amzn-requestid": "c85cd49f-2c16-44b4-9890-cb233651f962",
"date": "Fri, 14 Sep 2018 07:31:34 GMT",
"content-length": "995",
"content-type": "text/xml"
}
},
"u'DBEngineVersions'": [
{
"u'Engine'": "postgres",
"u'DBParameterGroupFamily'": "postgres10",
"u'SupportsLogExportsToCloudwatchLogs'": false,
"u'SupportsReadReplica'": true,
"u'DBEngineDescription'": "PostgreSQL",
"u'EngineVersion'": "10.4",
"u'DBEngineVersionDescription'": "PostgreSQL 10.4-R1",
"u'ValidUpgradeTarget'": []
}
]
}
Database Preview Environment
PostgreSQL 社区持续发布新版本和新扩展。您可以在 Aws RDS 完全支持它们之前尝试使用新版本和扩展。为此,您可以在数据库预览环境中创建一个新的 DB 实例。
The PostgreSQL community releases new versions and new extensions continuously. You can try out new PostgreSQL versions and extensions before they are fully supported by Aws RDS. To do that, you can create a new DB instance in the Database Preview Environment.
数据库预览环境中的 DB 实例与生产环境中的 DB 实例类似。但是,请记住几个重要因素:
DB instances in the Database Preview Environment are similar to DB instances in a production environment. However, keep in mind several important factors:
-
All DB instances are deleted 60 days after you create them, along with any backups and snapshots.
-
You can only create a DB instance in a virtual private cloud (VPC) based on the Amazon VPC service.
-
You can only create M4, T2, and R4 instance types. For more information about RDS instance classes,
-
You can’t get help from AWS Support with DB instances. You can post your questions in the RDS Database Preview Environment Forum.
-
You can only use General Purpose SSD and Provisioned IOPS SSD storage.
-
You can’t copy a snapshot of a DB instance to a production environment.
-
Some Amazon RDS features aren’t available in the preview environment, as described following.
Logical Replication
逻辑复制是一种复制数据对象及其更改的方法,基于它们的复制标识(通常是主键)。逻辑复制使用发布和订阅模型,其中一个或多个订阅者订阅发布者节点上的一个或多个出版物。订阅者从他们订阅的出版物中提取数据,随后可以重新发布数据以允许级联复制或更复杂配置。它用于以下操作。
Logical replication is a method of replicating data objects and their changes, based upon their replication identity (usually a primary key). Logical replication uses a publish and subscribe model with one or more subscribers subscribing to one or more publications on a publisher node. Subscribers pull data from the publications they subscribe to and may subsequently re-publish data to allow cascading replication or more complex configurations. It is used for the below actions.
-
Sending incremental changes in a single database or a subset of a database to subscribers as they occur.
-
Consolidating multiple databases into a single one (for example for analytical purposes).
-
Replicating between different major versions of PostgreSQL.
-
Replicating between PostgreSQL instances on different platforms (for example Linux to Windows)
-
Giving access to replicated data to different groups of users.
-
Sharing a subset of the database between multiple databases.
为 Amazon RDS for PostgreSQL DB 实例启用逻辑复制
To enable logical replication for an Amazon RDS for PostgreSQL DB instance
-
The AWS user account requires the rds_superuser role to perform logical replication for the PostgreSQL database on Amazon RDS.
-
Set the rds.logical_replication parameter to 1.
-
Modify the inbound rules of the security group for the publisher instance (production) to allow the subscriber instance (replica) to connect. This is usually done by including the IP address of the subscriber in the security group.