【问题标题】:Set Redis ElastiCache eviction policy via Terraform通过 Terraform 设置 Redis ElastiCache 驱逐策略
【发布时间】:2021-04-17 01:41:06
【问题描述】:

我想将我在 AWS ElastiCache 上的 Redis 集群设置为 LRU eviction mode。我的 Redis 集群的版本是 5.0.6。

我查看了 Terraform aws_elasticache_replication_group resource 的文档,但找不到任何属性来设置驱逐策略。据我所知,默认政策是不驱逐。

如何更改 Terraform 中的驱逐政策?

【问题讨论】:

    标签: amazon-web-services redis terraform terraform-provider-aws amazon-elasticache


    【解决方案1】:

    ElastiCache 配置是通过 aws_elasticache_parameter_group 资源完成的。然后您可以指定任何parameters that are allowed by ElastiCache

    查看您想要设置的可用参数 maxmemory-policy 但值得注意的是,默认值不是不驱逐 (noeviction),而是在所有当前版本的 Redis ElastiCache 中默认为 volatile-lru无论如何可能是你需要的。如果您想使用allkeys-lru,那么您可以执行以下操作:

    resource "aws_elasticache_parameter_group" "this" {
      name   = "cache-params"
      family = "redis5.0"
    
      parameter {
        name  = "maxmemory-policy"
        value = "allkeys-lru"
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2020-07-10
      • 2016-06-20
      • 1970-01-01
      • 2013-12-14
      • 1970-01-01
      • 2020-10-13
      • 2021-02-05
      • 1970-01-01
      • 2023-04-04
      相关资源
      最近更新 更多