gpt4 book ai didi

postgresql - 使用 AWS Aurora PostgreSQL 数据库集群连接到哪个端点进行读/写操作

转载 作者:行者123 更新时间:2023-12-03 16:34:46 24 4
gpt4 key购买 nike

我有一个使用 Aurora PostgreSQL 集群的应用程序 (AWS API Gateway)。
集群有 1 个读/写(主要)和一个读取器端点。
目前,我的应用程序连接到所有操作的特定编写器实例:
rds-instance-1.xxx.ap-southeast-2.rds.amazonaws.com
但我有以下端点可用:

rds.cluster-xxx.ap-southeast-2.rds.amazonaws.com    
rds.cluster-ro-xxx.ap-southeast-2.rds.amazonaws.com
rds-instance-1.xxx.ap-southeast-2.rds.amazonaws.com
rds-instance-1-ap-southeast-2c.xxx.ap-southeast-2.rds.amazonaws.com
如果我正在执行读写操作,我应该连接到我正在使用的实例端点吗?或者我应该使用 rds.cluster-xxx.ap-southeast-2.rds.amazonaws.com 吗?使用不同端点有什么好处?我知道如果我连接到只读端点,我只能进行读取,但对于读/写,连接到以下内容有什么区别:
rds.cluster-xxx.ap-southeast-2.rds.amazonaws.com
或者
rds-instance-1.xxx.ap-southeast-2.rds.amazonaws.com 
?
用于一般工作负载的正确/最佳端点是什么,为什么?

最佳答案

您应该使用集群读取器/写入器端点。

rds.cluster-xxx.ap-southeast-2.rds.amazonaws.com    
rds.cluster-ro-xxx.ap-southeast-2.rds.amazonaws.com
使用集群端点的主要好处是,如果 failover由于某种原因,您不会担心端点,并且您可以期望服务中断最少。
或者,如果您有 3 个只读副本,那么您将如何设法连接阅读器?所以最好使用集群读取器/写入器端点。
使用读取器端点

You use the reader endpoint for read-only connections for your Auroracluster. This endpoint uses a load-balancing mechanism to help yourcluster handle a query-intensive workload. The reader endpoint is theendpoint that you supply to applications that do reporting or otherread-only operations on the cluster.


使用集群端点

You use the cluster endpoint when you administer your cluster, performextract, transform, load (ETL) operations, or develop and testapplications. The cluster endpoint connects to the primary instance ofthe cluster. The primary instance is the only DB instance where youcan create tables and indexes, run INSERT statements, and performother DDL and DML operations.


实例端点

The instance endpoint provides direct control over connections to theDB cluster, for scenarios where using the cluster endpoint or readerendpoint might not be appropriate. For example, your clientapplication might require more fine-grained load balancing based onworkload type. In this case, you can configure multiple clients toconnect to different Aurora Replicas in a DB cluster to distributeread workloads. For an example that uses instance endpoints to improveconnection speed after a failover for Aurora PostgreSQL


您可以查看更多详情 AWS RDS Endpoints

关于postgresql - 使用 AWS Aurora PostgreSQL 数据库集群连接到哪个端点进行读/写操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62588784/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com