Can I use the same Redis server with multiple magento websites, by using different Redis database numbers on each website in valet plus?

Can I use the same Redis server with multiple magento websites, by using different Redis database numbers on each website in valet plus?

September 13, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Can I use the same Redis server with multiple magento websites, by using different Redis database numbers on each website in valet plus?

Using a Single Redis Server for Multiple Magento Sites on Valet+

As a senior developer using Laravel Company’s Valet+ for my Magento projects, I often get asked about the feasibility of sharing a single Redis server across multiple websites. The short answer is yes—you can indeed use the same Redis server with multiple Magento sites by utilizing different database numbers (DBs) for each project.

Why Redis DB Separation Matters

Using separate Redis databases provides several benefits:

  1. Data Isolation: Each website’s cache data remains independent from others, reducing the risk of conflicts or corruption.
  2. Performance Optimization: Caching is handled independently per site, improving overall system performance.
  3. Security Enhancement: If one site encounters a security issue (e.g., cache poisoning), it doesn’t affect other sites.

Configuring Redis for Multiple Magento Sites

To configure your Redis server to work with multiple Magento websites on Valet+, follow these steps:

  1. Identify Available DBs: A single Redis server can handle up to 16 databases by default (0-15). Ensure you have available slots for all your websites.

  2. Configure Each Website

    For each Magento site in your valet-projects directory, open the .env file and configure the following:

    REDIS_HOST=127.0.0.1
    REDIS_PORT=6379
    REDIS_DATABASE=DB_NUMBER
    

    Replace DB_NUMBER with a unique number between 0-15 that corresponds to an available database on your Redis server.

    For example, for the first site you might put:

    REDIS_DATABASE=0
    

    And for the second site:

    REDIS_DATABASE=2
    
  3. Restart Valet+ Services

    Once configured, restart the Valet+ services to apply the changes:

    valet restart
    

Best Practices and Gotchas

  • Always monitor your Redis server’s memory usage to prevent it from becoming a bottleneck.
  • Regularly clean up cached data using Magento’s built-in cache management tools or third-party extensions like Redis Cleaner Extension.
  • Consider setting different cache lifetimes for each site based on their needs.

Conclusion: Redis DB Separation is a Best Practice

Using separate Redis databases for each Magento website running with Valet+ is not only possible but also highly recommended. It ensures data separation, optimizes performance, and enhances security—three critical aspects of maintaining robust e-commerce platforms.

By following the configuration steps outlined above, you can safely and efficiently manage caching for multiple websites within a single Redis server environment on Laravel Company’s Valet+.

Cache Database Performance Security

Our network