title: .NET Core StackExchange.Redis ConnectionMultiplexer setup for multiple redis servers
body: <p>I am developing some web apis in .NET Core 2.2</p>
  
  <p>The requirements brought us to the point where data is stored/cached/centralized within multiple redis storages (for the sake of easiness lets assume 2 redis servers).</p>
  
  <p>That would be (as example)</p>
  
  <ol>
  <li>server 1 for the data protection</li>
  <li>server 2 for some other data</li>
  </ol>
  
  <p>So far the data protection seems to work and it was configured using the connection multiplexer (which was added as singleton for reuse before hand) as suggested in the <a href="https://stackexchange.github.io/StackExchange.Redis/Basics.html" rel="nofollow noreferrer">basic usage guide</a>.</p>
  
  <p>The relevant parts of StartUp.ConfigureServices</p>
  
  <pre><code>  ConnectionMultiplexer cm = ConnectionMultiplexer.Connect("server1:6729");
    services.AddSingleton&lt;IConnectionMultiplexer&gt;(cm);
  
    services.AddDataProtection()
      .SetApplicationName("myapp")
      .PersitKeysToStackExchangeRedis(cm, "DataProtection-Keys");
  </code></pre>
  
  <p>The keys are stored as expected in the redis storage on server 1.</p>
  
  <hr>
  
  <p>Now I need to integrate the second storage. </p>
  
  <p>Can a ConnectionMultiplexer used to connect to two servers?</p>
  
  <pre><code>ConnectionMultiplexer cm = ConnectionMultiplexer.Connect("server1:6729;server2:6729"); //?
  </code></pre>
  
  <p>How to get the correct database pointing to the correct (either 1st or 2nd) server?</p>