我有一个 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 提高您的配置级别
因此您应该考虑提高吞吐量级别(为此您必须支付更多费用)或调整您的查询以遵守实际限制。
关于postgresql - Amazon Dynamodb 在 grails 中找到所有内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41182367/