Help Center/ ServiceStage/ User Guide/ Component Management/ Managing Cloud Service Settings of a Container-Deployed Component/ Binding a Container-Deployed Component to a Distributed Cache Instance
Updated on 2024-12-16 GMT+08:00

Binding a Container-Deployed Component to a Distributed Cache Instance

Traditional single-instance applications use local session management. Session contexts generated by user requests are stored in the process memory. After the load balancing module is added, multi-instance sessions need to be shared using distributed storage.

ServiceStage provides the out-of-the-box distributed session function. It uses the Distributed Cache Service as the session persistence layer. Without code modification, ServiceStage supports distributed session management for Tomcat applications, Node.js applications that use express-session, and PHP applications that use session handle.

You can bind a distributed cache instance when configuring Cloud Service Settings. After binding, you can read environment variables upon application running to obtain information about the distributed cache. For details, see Common Environment Variables.

Prerequisites

A distributed cache has been created. For details, see Buying a DCS Redis Instance.

Binding a Distributed Cache

  1. Choose Cloud Service Settings > Distributed Cache Service.
  2. Click Bind Distributed Cache.
  3. Select a distributed cache instance that has been bound in the environment.

    If no distributed cache instance is bound to the environment, click Add one and add a distributed cache instance to the environment. For details, see Managing Basic Resources.

  4. If the DCS instance must be accessed using a password, enter the access password.
  5. Click OK.

    Move the cursor to a bound distributed cache and perform the following operations:

    • Rebind a distributed cache: Click and select the target distributed cache again. If the selected DCS instance access mode is password access, you need to enter the access password. Click OK.
    • Delete a bound distributed cache: Click .