跳至主要內容

GCP Memorystore IAM Authentication

使用 IAM 驗證將 LiteLLM 的 Redis 快取連線到 GCP Memorystore,讓 proxy 以服務帳戶進行驗證, 且您的設定中不會有 Redis 密碼。

資訊

目前僅支援 Redis 叢集的 Redis IAM 驗證。關於 AWS ElastiCache 和 Valkey,請參閱 AWS ElastiCache IAM Authentication。關於 Azure Cache for Redis 和 Azure Managed Redis,請參閱 Azure Redis Entra ID Authentication。

uv add google-cloud-iam

適用於具備 GCP IAM 的 Redis 叢集:

litellm_settings:
cache: True
cache_params:
type: redis
redis_startup_nodes:
[{ "host": "10.128.0.2", "port": 6379 }, { "host": "10.128.0.2", "port": 11008 }]
gcp_service_account: "projects/-/serviceAccounts/your-sa@project.iam.gserviceaccount.com"
ssl: true
ssl_cert_reqs: null
ssl_check_hostname: false

在 proxy 執行後,請使用 /cache/ping 確認連線。關於 Redis 快取的其他所有內容,包括叢集拓撲與 TLS,請參閱 Redis and Valkey。