Más contenido relacionado La actualidad más candente (20) Similar a PostgreSQL (20) Más de Amazon Web Services (20) PostgreSQL13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS: At-Rest Encryption
• Two-tiered key hierarchy using envelope
encryption
• Unique data key encrypts customer data
• AWS KMS master keys encrypt data keys
• Available for all RDS engines
• Benefits:
• Limits risk of compromised data key
• Better performance for encrypting large
data
• Easier to manage small number of master
keys than millions of data keys
• Centralized access and audit of key activity
Leveraging AWS Key Management Service (AWS KMS)
Data key 1 Data key 2 Data key 3 Data key 4
Customer master
key(s)
Amazon RDS
instance 3
Amazon RDS
instance 2
Amazon RDS
instance 1
16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS: Backup and Disaster Recovery
• DB Snapshots
– User-driven snapshots of database
– Kept until explicitly deleted
• Automated Backups
– Nightly system snapshots + transaction backup
– Enables point-in-time restore to any point in retention period, up to the last
5 minutes
– Max retention period = 35 days
• Cross region copy
– Change regions
– Disaster recovery
18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS: Logical Replication Support
• Supported with 9.6.1+, 9.5.4+ and 9.4.9+
• Set rds.logical_replication parameter to 1
• As user who has rds_replication and rds_superuser role
SELECT * FROM pg_create_logical_replication_slot('test_slot',
'test_decoding');
pg_recvlogical -d postgres --slot test_slot -U master --host $rds_hostname -f -
--start
• Support for event triggers
RDS
Postgres
RDS
Postgres
Logical
Replica
Redshift
EC2
Postgres
On
Premise
Postgres
DMS
RDS/Aurora
PostgreSQL
Custom
Logical
Handler
NoSQL
DB
21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
New PostgreSQL Extensions Supported
Extensions Description
pgrouting Provides geospatial routing functionality for PostGIS
postgresql-hll HyperLogLog data type support
decoder_raw Output plugin to generates raw queries for logical replication changes
pg_repack Remove bloat from tables and indexes in version 9.6.3
pgaudit Provide detailed session and object audit logging in versions 9.6.3 and 9.5.7
wal2json Output plugin for logical decoding in versions 9.6.3 and 9.5.7
auto_explain Log execution plans of slow statements automatically in versions 9.6.3 and 9.5.7
pg_hint_plan Provides control of execution plans by using hint phrases
log_fdw Extension to query your database engine logs within the database
pg_freespacemap Examine free space map
22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Extension—pgaudit (9.6.3+)
• CREATE ROLE rds_pgaudit
• Add pgaudit to shared_preload_libraries and pgaudit.role = rds_pgaudit in a
custom parameter group in PostgreSQL 9.6 family
• Apply the modified parameter group to 9.6.3+ database instance and apply immediately
• CREATE EXTENSION pgaudit
• Grant SELECT on all tables to rds_pgaudit to enable auditing
• GRANT SELECT ON t1 TO rds_pgaudit;
• Database logs will show entry as follows
• ... 2017-06-12 19:09:49 UTC:…:pgadmin@postgres:[11701]:LOG: AUDIT:
OBJECT,1,1,READ,SELECT,TABLE,public.t1,select * from t1; ...
23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Extension—pg_stat_statements
• CREATE EXTENSION pg_stat_statements
• SELECT * from pg_stat_statements order by total_time DESC;
-[ RECORD 2 ]-------+--------
userid | 16388
dbid | 16464
queryid | 4286627671
query | UPDATE pgbench_accounts SET abalance = abalance + ? WHERE aid = ?;
calls | 165125
total_time | 5251.54200000001
min_time | 0.015
max_time | 5.558
mean_time | 0.0318034337623008
stddev_time | 0.0369181019548524
rows | 165125
• SELECT substring(query, 1, 50) AS short_query,
round(total_time::numeric, 2) AS total_time, calls,
round(mean_time::numeric, 2) AS mean, round((100 * total_time
/sum(total_time::numeric) OVER ())::numeric, 2) AS percentage_cpu FROM
pg_stat_statements ORDER BY total_time DESC LIMIT 10;
25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Amazon Aurora Storage Engine Overview
• Data is replicated six times across three
Availability Zones
• Continuous backup to Amazon S3 (built for 11
9s durability)
• Continuous monitoring of nodes and disks for
repair
• 10 GB segments as unit of repair or hotspot
rebalance
• Quorum system for read/write; latency tolerant
• Quorum membership changes do not stall writes
• Storage volume automatically grows up to 64
TB
AZ 1 AZ 2 AZ 3
Amazon S3
Database
Node
Storage
Node
Storage
Node
Storage
Node
Storage
Node
Storage
Node
Storage
Node
Storage
Monitoring
26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
RDS/Aurora PostgreSQL Monitoring
• Amazon CloudWatch metrics
– CPU utilization
– Storage
– Memory
– Swap usage
– DB connections
– I/O (read and write)
– Latency (read and write)
– Throughput (read and write)
– Replica lag
• Amazon CloudWatch alarms
– Similar to on-premises monitoring tools
• Enhanced Monitoring for Amazon RDS
– Access to over 50 CPU, memory, file
system, and disk I/O metrics
– Low as 1 second intervals
• Integration with third-party monitoring tools