假设我在一些负载均衡的EC2服务器上运行webapp,从SimpleDB存储和检索元数据,并在S3上存储更大的数据块(由于SimpleDB的整个1 KB限制).由于S3是非常高的延迟,我不想在那里做大量的请求,我想要一个信息的缓存层...输入ElastiCache.
好的,所以我配置了一个带有端点X的ElastiCache服务器,所以我将X硬编码到EC2上的应用程序中,并且它运行得很快,直到我得到几十万新用户,突然之间我的缓存服务器因需求而功能不足.幸运的是,我可以启动一些新的更大的缓存服务器...但后来我意识到我有端点X,Y和Z而我的应用程序只知道尝试X,所以我仍然有问题.
所以现在我只是试图让我的脑袋缠绕在这个拼图的各个部分上,而我还没有进入编码部分,但这不是一个问题吗?我已经阅读了ElastiCache的文档,它提到它是一个缓存集群,但是集群中的每个服务器似乎都有自己的端点.有没有办法让在EC2上运行的应用程序知道正在运行的所有缓存服务器,以及更多关于哪一个包含特定密钥的数据?是否可以要求整个群集存储或检索一条信息?
cloud memcached amazon-ec2 amazon-web-services amazon-elasticache
我无法在Amazon Cloud上找到关于Memcached的好教程,而且我对这整个缓存事件都很陌生.我试图通过亚马逊的ElastiCache服务和spymemcached客户端使用memcached来实际进行memcached调用.
这就是我现在用Java做的事情:
try {
ConnectionFactoryBuilder connectionFactoryBuilder = new ConnectionFactoryBuilder();
MemcachedClient memcachedClient = new MemcachedClient(
connectionFactoryBuilder.build(),
AddrUtil.getAddresses("<beginning of cache node end point grabbed from AWS Console>.cache.amazonaws.com:11211"));
memcachedClient.set("test", 12, new Integer(12));
System.out.println(memcachedClient.get("test"));
} catch (IOException ioException) {
ioException.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
我尝试这个时得到的错误是:
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:567)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:414)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:278)
at net.spy.memcached.MemcachedClient.run(MemcachedClient.java:1981)
2012-02-01 19:25:35.415 WARN net.spy.memcached.MemcachedConnection: Closing, and reopening {QA sa=<node endpoint>.cache.amazonaws.com/184.73.64.56:11211, #Rops=0, #Wops=2, #iq=0, topRop=null, topWop=net.spy.memcached.protocol.ascii.StoreOperationImpl@be8c3e, toWrite=0, interested=0}, attempt 1.
net.spy.memcached.OperationTimeoutException: Timeout waiting for value
at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1142)
at …Run Code Online (Sandbox Code Playgroud) memcached amazon-web-services spymemcached amazon-elasticache
我正在AWS Elasticache Redis中测试新的Redis集群(AWS Large主/从节点).
如何从Redis群集备份或导出数据?
其他托管的redis服务会自动创建Redis RDB转储文件并将其存储在S3上.我想和ElastiCache做类似的事情.
我们计划使用ElastiCache(Redis)而不是我们自己的redis集群.但是,"维护窗口"设置会产生一些问题,
如果我使用multi-az复制群集,弹性缓存会在维护窗口期间故障转移到可用副本,还是整个群集在维护期间会停止运行?
一般需要多长时间?
我们也可以使用MemCached而不是Redis,它在维护窗口期间是否有更好的可用性情况?
其他人如何处理ElastiCache维护窗口?只是去停机时间?
谢谢!
在CloudFormation中,我正在创建一个VPC,两个EC2实例和一个Elasticache.在模板中,我正在尝试将弹性缓存添加到vpc中.在创建AWS :: Elasticache :: SubnetGroup时发生了问题
"CacheSubnetGroup" : {
"Type" : "AWS::ElastiCache::SubnetGroup",
"Properties" : {
"Description" : "Subnets available for the ElastiCache Cluster",
"SubnetIds" : [ ... ]
}
},
Run Code Online (Sandbox Code Playgroud)
我不希望要求用户输入所建议的子网列表在这里,因为我假设用户不知道子网是什么.有没有类似于{"Fn :: GetAtt"的函数:["myVpc","SubnetList"]}?
编辑 在jarmod的响应之后,我正在创建子网,vpc和其他所有内容.但仍有一个问题.我可以在创建的VPC中启动EC2,但是实例会被创建,并且在初始化实例时会关闭实例,并且新实例会被启动.这个循环继续,直到我删除cf堆栈.这是我认为问题的起源部分:
"WebServerGroup" : {
"Type" : "AWS::AutoScaling::AutoScalingGroup",
"Properties" : {
"VPCZoneIdentifier" : [{ "Ref" : "InstanceSubnet1" }, { "Ref" : "InstanceSubnet2" }, { "Ref" : "InstanceSubnet3" }, { "Ref" : "InstanceSubnet4" }],
"LaunchConfigurationName" : { "Ref" : "LaunchConfig" },
"MinSize" : "1",
"MaxSize" …Run Code Online (Sandbox Code Playgroud) amazon-ec2 subnet amazon-web-services amazon-elasticache aws-cloudformation
我正在尝试将ElastiCache设置为与Java应用程序一起使用.我基于此文档设置了我的设置:https: //docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/BestPractices.html
运行Java(8)App的EC2实例位于VPC中.我在VPC和VPC中都尝试过ElastiCache实例.但是,我总是得到,
redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused
Run Code Online (Sandbox Code Playgroud)
如果我自己在EC2实例上安装Redis并连接到它,该应用程序可以连接到Redis缓存!
我已经使用Security-group从EC2到Cache-Security设置了适当的授权,但没有运气.我只是不能做'连接'.任何示例连接代码段都非常有用.
Redis在APP Config中以这种方式设置:
@Bean
public JedisConnectionFactory redisConnectionFactory() {
JedisConnectionFactory redisConnectionFactory = new JedisConnectionFactory();
redisConnectionFactory.setHostName(<cache-node>);
redisConnectionFactory.setPort(6397);
redisConnectionFactory.setUsePool(true);
redisConnectionFactory.setTimeout(3600);
return redisConnectionFactory;
}
Run Code Online (Sandbox Code Playgroud)
各种版本:
Jedis- 2.6.2, Spring- 4.1.6, Spring-data-> 1.5.0
Run Code Online (Sandbox Code Playgroud) AWS Elastic Beanstalk rails应用程序需要与Puma/Passenger一起运行的sidekiq工作进程.让sidekiq进程运行导致数小时尝试失败.此外,让rails app和sidekiq与我的AWS ElastiCache集群交谈显然需要一些安全规则更改.
我们从一个非常简单的Rails应用程序开始,该应用程序可以轻松部署到AWS Elastic Beanstalk.从早期开始,我们已经将应用程序演变为现在使用工作框架Sidekiq.Sidekiq反过来喜欢使用Redis来完成工作.无论如何,在AWS世界中组装所有这些拼图都有点挑战性.
ruby-on-rails redis amazon-elasticache sidekiq amazon-elastic-beanstalk
使用CloudFormation模板时如何设置Redis ReplicationGroup ID?文档中的所有选项都显示无法执行此操作,CLI可以轻松完成此操作.我的最终目标是拥有一个包含3个集群成员的Redis复制组,但我想选择名称而不是AWS为我设置一个唯一的名称.
这是我的模板的片段:
"Resources": {
"mqpReplicationGroup": {
"Type": "AWS::ElastiCache::ReplicationGroup",
"Properties": {
"CacheNodeType": {
"Ref": "CacheNodeType"
},
"CacheSubnetGroupName": {
"Ref": "CacheSubnets"
},
"ReplicationGroupDescription": "Redis Replication Group",
"Engine": "redis",
"EngineVersion": {
"Ref": "RedisVersion"
},
"NumCacheClusters": {
"Ref": "NumberOfCacheNodes"
},
"AutoMinorVersionUpgrade": "true",
"AutomaticFailoverEnabled": "true",
"PreferredMaintenanceWindow": "sat:09:25-sat:22:30",
"SnapshotRetentionLimit": "4",
"SnapshotWindow": "00:05-05:30",
"NotificationTopicArn": {
"Fn::Join" :[":",["arn:aws:sns",{ "Ref" : "AWS::Region" },{ "Ref" : "AWS::AccountId" },"service-aws"]]
},
"SecurityGroupIds": [
{
"Fn::Join": [
",",
{
"Ref": "VpcSecurityGroupIds"
}
]
}
]
}
}, …Run Code Online (Sandbox Code Playgroud) 带加密的ElastiCache使用TLS与redis客户端通信,但正如我所见,所有语言的redis客户端(ioredis,predis,go-redis)在将客户端配置为TLS时需要pem文件.
如果没有TLS的证书,我如何使用传输中加密连接到Elasticache?
在 terraform/cloudformation 文档中,有两种不同的资源可用于创建 ElastiCache Redis 实例:
aws_elasticache_cluster( https://www.terraform.io/docs/providers/aws/r/elasticache_cluster.html )aws_elasticache_replication_group( https://www.terraform.io/docs/providers/aws/r/elasticache_replication_group.html )这两者有什么区别?我应该选择哪一个?
amazon-web-services amazon-elasticache aws-cloudformation terraform
redis ×5
amazon-ec2 ×2
memcached ×2
caching ×1
cloud ×1
encryption ×1
jedis ×1
sidekiq ×1
spymemcached ×1
subnet ×1
terraform ×1