postgresql - Amazon Dynamodb 在 grails 中找到所有内容

标签 postgresql grails amazon-dynamodb guava throughput

我有一个 Grails 应用程序。我正在使用 amazon dynamodb 来满足访问的特定要求,并且条目是由不同的应用程序添加的。现在我需要将所有信息从 dynamodb 表获取到 postgreSQL 表。 dynamodb 中有超过 10000 条记录,但吞吐量是

Read capacity units : 100
Write capacity units : 100

我在 BuildConfig.groovy 中定义了插件

compile ":dynamodb:0.1.1"

在 config.groovy 中我有以下配置

grails {
  dynamodb {
    accessKey = '***'
    secretKey = '***'
    disableDrop = true
    dbCreate = 'create'
  }
}

我的代码看起来有点像这个

class book {

  Long id
  String author
  String name
  date publishedDate

  static constraints = {
  }

  static mapWith = "dynamodb"
  static mapping = {
    table 'book'
    throughput read:100
  }
}

当我尝试类似 book.findAll() 的操作时,出现以下错误

AmazonClientException: Unable to unmarshall response (Connection reset)

当我尝试通过尝试 book.findAllByAuthor() 之类的方法(也有超过 1000 条记录)来减少记录数量时,我收到以下错误

Caused by ProvisionedThroughputExceededException: Status Code: 400, AWS Service: AmazonDynamoDB, AWS Request ID: ***, AWS Error Code: ProvisionedThroughputExceededException, AWS Error Message: The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API.

尽管有吞吐量限制,我仍需要获取 dynamodb 中的所有记录并将其保存在 postgres 表中。有办法吗?

我是这个领域的新手,在此先感谢您的帮助。

经过一些研究,我发现了 Google Guava。但即使使用 Guava RateLimiter,我也不会固定次数地发送需要多长时间的请求。所以我正在寻找适合我的要求的解决方案

最佳答案

可能您的问题与 grails 根本无关。返回的错误消息声称:已超出为表配置的预配吞吐量级别。考虑使用 UpdateTable API 提高您的配置级别

因此您应该考虑提高吞吐量级别(为此您必须支付更多费用)或调整您的查询以遵守实际限制。

另请查看此答案:https://stackoverflow.com/a/31484168/2166188

关于postgresql - Amazon Dynamodb 在 grails 中找到所有内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41182367/

相关文章:

javascript - 使用 d3.js、node.js、postgresql 显示动态直方图

grails - 如何让 Grails 导出插件与条件查询一起正常工作?

node.js - Grails 作为单个应用程序或不同的后端和前端应用程序

ios - 从 grails Controller 流式传输 mp4 在 iPhone 上不起作用

amazon-web-services - DynamoDb - 吞吐量限制到底如何运作?

java - 获取特定分区的最新/最新条目

node.js - dynamodb 通过 ids 数组获取所有项目

sql - 在postgres中按日期合并多个值组

postgresql - pgadmin4 命令继续运行并且进程观察器不会消失

java - SpringBoot Postgresql 驱动问题