> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# switch_url

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/gpudb.rs#L3530-L3647)
pub async fn [switch\_url](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/switch-url.md#method.switch_url)( \&self, old\_url: &[Url](https://docs.rs/url/2.5.7/url/struct.Url.html), old\_num\_cluster\_switches: [usize](https://doc.rust-lang.org/1.98.1/std/primitive.usize.html), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[Url](https://docs.rs/url/2.5.7/url/struct.Url.html), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Switches to the next available cluster URL for HA failover.This method:

<ul>
  <li>Checks if failover is disabled</li>
  <li>Checks if only one cluster exists (no failover possible)</li>
  <li>Checks if another thread has already switched</li>
  <li>Selects the next available cluster</li>
  <li>Skips clusters that aren’t running</li>
</ul>

##### Arguments

<ul>
  <li>`old_url` - The URL that was in use when the failure occurred</li>
  <li>`old_num_cluster_switches` - The switch count before this switch was initiated</li>
</ul>

##### Returns

The new URL to use, or an error if failover is not possible.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.