【问题标题】:How to install/use AWS:ElastiCache Redis session for Yii2如何为 Yii2 安装/使用 AWS:ElastiCache Redis 会话
【发布时间】:2021-06-15 21:49:51
【问题描述】:

问题很简单,

如何为 Yii2 安装/使用 AWS:ElastiCache Redis 会话?

自我回答。请阅读下文

【问题讨论】:

    标签: amazon-web-services amazon-elasticache aws-elasticache


    【解决方案1】:

    安装和启用 Redis 的步骤

    • [自我管理] 在您的网络服务器中安装 Redis-Server,使用 digitalocean 链接或 AWS EC2
    • [AWS ElastiCache] 适用于 Redis 的 AWS ElastiCache:如何使用 AWS Redis Service
    • 安装 PHP Redis 扩展。 AWS Guide
    • 在 php.ini 中应用 session.save_path = Endpoint ElastiCache & session.save_handler = redis
    • 重启服务
    • 通过phpinfo();确认php.ini中的变化
    • 在 Yii2 组件中应用 Redis 会话为 said here

    请务必遵守此规定。

    • 为 EC2 和 ElastiCache 使用相同的安全组
    • 在 AWS 安全组中添加 Redis 端口 6379 为 0.0.0.0
    • 在 Yii2 中配置时,main.php 添加 ElastiCache 端点作为主机
    • 这些步骤仅适用于会话,因此如果您想将 Redis 用作活动数据或缓存,请修改 Yii2 主组件

    【讨论】:

      猜你喜欢
      • 2021-12-04
      • 2018-02-19
      • 2012-05-03
      • 2017-01-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-17
      • 1970-01-01
      相关资源
      最近更新 更多