我有一个包含 1 亿个字符串的列表,每行一个。文件大小为 1.66 GB。每个字符串大约有 20 个字符长。
我开始将数据插入小实例中并出现最大内存错误。那时只插入了 100 万条记录。
Micro
Micro Cache Node (cache.t1.micro): 213 MB memory, Up to 2 ECU (for short periodic bursts), 64-bit platform, Low I/O Capacity
Standard
Small Cache Node (cache.m1.small): 1.3 GB memory, 1 ECU (1 virtual core with 1 ECU), 64-bit platform, Moderate I/O Capacity
Medium Cache Node (cache.m1.medium): 3.35 GB memory, 2 ECU (1 virtual core with 2 ECUs), 64-bit platform, Moderate I/O Capacity
Large Cache Node (cache.m1.large): 7.1 GB memory, 4 …Run Code Online (Sandbox Code Playgroud) optimization benchmarking amazon-web-services redis amazon-elasticache
我正在使用 redis-store gem 来配置 Rails cache_store 以使用 amazon elasticache redis。我想将驱逐策略设置为 allkeys-lru。但是我无法找到一种方法在 Rails 内做到这一点。
我尝试在 AWS 中使用 Elastic Beanstalk 在弹性缓存中创建两个 Memcache 集群。在过去的三个小时里,两人都陷入了同一个状态,都在说“创造”。
任何帮助将不胜感激。
我正在尝试使用 Terraform 在 Elasticache 上启动 Redis 实例,但遇到以下错误。
* module.main.module.redis.aws_elasticache_security_group.redis: 1 error(s) occurred:
* aws_elasticache_security_group.redis: Error creating CacheSecurityGroup: InvalidParameterValue: Use of cache security groups is not permitted in this API version for your account.
Run Code Online (Sandbox Code Playgroud)
我在 GH 问题中发现的任何内容都没有帮助。这是我的 Terraform 的样子(我已经确认变量被正确传递):
resource "aws_elasticache_subnet_group" "redis" {
name = "vpc-public-subnet"
description = "subnet where redis will live"
subnet_ids = ["${var.subnet}"]
}
resource "aws_elasticache_security_group" "redis" {
name = "redis-security-group"
security_group_names = ["${var.redis_sec_group}"]
}
resource "aws_elasticache_replication_group" "redis" {
automatic_failover_enabled = true
availability_zones = ["us-east-2a"]
replication_group_id = "${var.environment}-myapp-rep-group-1" …Run Code Online (Sandbox Code Playgroud) 我已使用 Laravel 5.5 和 Predis 包在 Amazon ElastiCache 上设置 redis-cluster 进行缓存,但出现以下错误。
Predis\ClientException: No connections available in the pool in vendor/predis/predis/src/Connection/Aggregate/RedisCluster.php:337
Run Code Online (Sandbox Code Playgroud)
跟踪:Predis\ClientException:vendor/predis/predis/src/Connection/Aggregate/RedisCluster.php:337 中的池中没有可用的连接
堆栈跟踪:
0 供应商/predis/predis/src/Connection/Aggregate/RedisCluster.php(411): Predis\Connection\Aggregate\RedisCluster->guessNode(153)
1供应商/predis/predis/src/Connection/Aggregate/RedisCluster.php(388):Predis\Connection\Aggregate\RedisCluster->getConnectionBySlot(153)
2供应商/predis/predis/src/Connection/Aggregate/RedisCluster.php(550):Predis\Connection\Aggregate\RedisCluster->getConnection(对象(Predis\Command\StringSetExpire))
3 供应商/predis/predis/src/Connection/Aggregate/RedisCluster.php(593): Predis\Connection\Aggregate\RedisCluster->retryCommandOnFailure(Object(Predis\Command\StringSetExpire), 'executeCommand')
4 供应商/predis/predis/src/Client.php(331): Predis\Connection\Aggregate\RedisCluster->executeCommand(对象(Predis\Command\StringSetExpire))
5 供应商/predis/predis/src/Client.php(314): Predis\Client->executeCommand(对象(Predis\Command\StringSetExpire))
6 供应商/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(96): Predis\Client->__call('setex', Array)
7vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(108): Illuminate\Redis\Connections\Connection->command('setex', Array)
8vendor/laravel/framework/src/Illuminate/Cache/RedisStore.php(93): Illuminate\Redis\Connections\Connection->__call('setex', Array)
9vendor/laravel/framework/src/Illuminate/Cache/Repository.php(195): Illuminate\Cache\RedisStore->put('5rr44TBjIPEgJSx...', 'a:1:{s:6:"_flas.. .', 480)
10vendor/laravel/framework/src/Illuminate/Session/CacheBasedSessionHandler.php(66): Illuminate\Cache\Repository->put('5rr44TBjIPEgJSx...', 'a:1:{s:6:"_flas.. .', 480)
11vendor/laravel/framework/src/Illuminate/Session/Store.php(128): Illuminate\Session\CacheBasedSessionHandler->write('5rr44TBjIPEgJSx...', 'a:1:{s:6:"_flas.. .')
12vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(87): Illuminate\Session\Store->save()
13vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(218): Illuminate\Session\Middleware\StartSession->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response) )
14vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(189): Illuminate\Foundation\Http\Kernel->terminateMiddleware(对象(Illuminate\Http\Request), 对象(Illuminate\Http\Response) )
15 public/index.php(58): Illuminate\Foundation\Http\Kernel->terminate(Object(Illuminate\Http\Request), Object(Illuminate\Http\Response))
16 {主要}
我使用的技术栈:
我有一个我认为是带有 Redis 的 AWS ElastiCache 的简单 Terraform 配置:
resource "aws_elasticache_replication_group" "my_replication_group" {
replication_group_id = "my-rep-group",
replication_group_description = "eln00b"
node_type = "cache.m4.large"
port = 6379
parameter_group_name = "default.redis5.0.cluster.on"
snapshot_retention_limit = 1
snapshot_window = "00:00-05:00"
subnet_group_name = "${aws_elasticache_subnet_group.my_subnet_group.name}"
automatic_failover_enabled = true
cluster_mode {
num_node_groups = 1
replicas_per_node_group = 1
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下方法定义端点输出:
output "my_cache" {
value = "${aws_elasticache_replication_group.my_replication_group.primary_endpoint_address}"
}
Run Code Online (Sandbox Code Playgroud)
当我通过 terragrunt 运行 apply 时,我得到:
错误:运行计划出错:发生 1 个错误:
module.mod.output.my_cache:资源“aws_elasticache_replication_group.my_replication_group”没有变量“aws_elasticache_replication_group.my_replication_group.primary_endpoint_address”的属性“primary_endpoint_address”
我在这里做错了什么?
amazon-web-services amazon-elasticache terraform redis-cluster
io.lettuce.core.RedisCommandTimeoutException: Command timed out after 10 second(s)
at io.lettuce.core.ExceptionFactory.createTimeoutException(ExceptionFactory.java:51) ~[lettuce-core-5.1.6.RELEASE.jar:?]
at io.lettuce.core.LettuceFutures.awaitOrCancel(LettuceFutures.java:114) ~[lettuce-core-5.1.6.RELEASE.jar:?]
at io.lettuce.core.cluster.ClusterFutureSyncInvocationHandler.handleInvocation(ClusterFutureSyncInvocationHandler.java:123) ~[lettuce-core-5.1.6.RELEASE.jar:?]
at io.lettuce.core.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80) ~[lettuce-core-5.1.6.RELEASE.jar:?]
at com.sun.proxy.$Proxy72.get(Unknown Source) ~[?:?]
at sun.reflect.GeneratedMethodAccessor138.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
at io.lettuce.core.support.ConnectionWrapping$DelegateCloseToConnectionInvocationHandler.handleInvocation(ConnectionWrapping.java:191) ~[lettuce-core-5.1.6.RELEASE.jar:?]
at io.lettuce.core.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80) ~[lettuce-core-5.1.6.RELEASE.jar:?]
at com.sun.proxy.$Proxy72.get(Unknown Source) ~[?:?]
Run Code Online (Sandbox Code Playgroud)
我正在使用以下示例代码通过连接池获取连接,请检查并建议我做错了什么
public StatefulRedisClusterConnection<String, String> getRedisClient() {
log.debug("getRedisClient()");
if (pool == null) {
synchronized (this) {
pool = initializeConnectionPool();
}
}
try {
return pool.borrowObject();
} catch (Exception e) {
log.error("getting pool connection failed",e);
}
return null;
} …Run Code Online (Sandbox Code Playgroud) 我的 ElastiCache Redis 版本是 6.0.5。但我想用6.2。根据AWS,您无法指定确切的 v6.x 版本。
我想知道是否可以手动升级它或其他什么。
我刚刚创建了一个支持 SSL 的 EC Redis 复制组。
这是主要终点:master.dev-my-site.wmrsll.use1.cache.amazonaws.com:6379
dev-my-site.mydomain.com我还创建了一个 CNAME:master.dev-my-site.wmrsll.use1.cache.amazonaws.com
在我的机器上,我可以通过 cli 连接到 redis:
redis-cli -h dev-my-site.mydomain.com -p 6379 --tls
Run Code Online (Sandbox Code Playgroud)
但是当我使用Lambda时,我可以连接master.dev-my-site.wmrsll.use1.cache.amazonaws.com 但不能连接 CNAME:dev-my-site.mydomain.com
当我尝试使用 CNAME 时,收到以下错误:
2021-08-26T19:15:27.442Z 5801f8d4-08ae-4bd0-8091-e856d95d008c ERROR Uncaught Exception {"errorType":"Error","errorMessage":"Redis connection to dev-my-site.mydomain.com:6379 failed - Hostname/IP does not match certificate's altnames: Host: dev-my-site.mydomain.com. is not in the cert's altnames: DNS:*.dev-ec-my-site.wmrsll.use1.cache.amazonaws.com","trace":["Error [ERR_TLS_CERT_ALTNAME_INVALID]: Hostname/IP does not match certificate's altnames: Host: dev-my-site. is not in the cert's altnames: DNS:*.dev-ec-my-site.wmrsll.use1.cache.amazonaws.com"," at Object.checkServerIdentity (tls.js:297:12)"," at TLSSocket.onConnectSecure …Run Code Online (Sandbox Code Playgroud) 我已逐步按照这些说明进行操作:https ://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/backups-exporting.html
但是我有以下错误:
An error occurred (InvalidParameterValue) when calling the CopySnapshot operation: Elasticache was unable to validate the authenticated user has access on the S3 bucket ...
Run Code Online (Sandbox Code Playgroud)
该存储桶与备份位于同一区域
这是我的存储桶配置:
{
"LocationConstraint": "eu-central-1"
}
Run Code Online (Sandbox Code Playgroud)
{
"Version": "2012-10-17",
"Id": "xxxxxxxx",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "eu-central-1.elasticache-snapshot.amazonaws.com"
},
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:GetBucketAcl",
"s3:ListMultipartUploadParts",
"s3:ListBucketMultipartUploads"
],
"Resource": [
"arn:aws:s3:::my-bucket-name/*",
"arn:aws:s3:::my-bucket-name"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是快照
{
"Snapshots": [
{
"SnapshotName": "my-snapshot-name",
"CacheClusterId": "xxxxxxxx-xxx",
"SnapshotStatus": "available",
"SnapshotSource": "manual",
"CacheNodeType": …Run Code Online (Sandbox Code Playgroud) redis ×5
terraform ×2
amazon-s3 ×1
aws-lambda ×1
benchmarking ×1
laravel ×1
laravel-5 ×1
lettuce ×1
optimization ×1
php ×1