> ## 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.

# admin_rebalance

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/admin_rebalance.rs#L35-L38)
pub async fn [admin\_rebalance](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/admin-rebalance.md#method.admin_rebalance)( \&self, ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[AdminRebalanceResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.AdminRebalanceResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Rebalance data and/or shards across all nodes in a clusterRebalance the data in the cluster so that all nodes contain an equal number of records approximately and/or rebalance the shards to be equally distributed (as much as possible) across all the ranks.The database must be offline for this operation, see `/admin/offline`

<ul>
  <li>If `/admin/rebalance` is invoked after a change is made to the cluster, e.g., a host was added or removed, sharded data will be evenly redistributed across the cluster by number of shards per rank while unsharded data will be redistributed across the cluster by data size per rank</li>
  <li>If `/admin/rebalance` is invoked at some point when unsharded data (a.k.a. randomly-sharded) in the cluster is unevenly distributed over time, sharded data will not move while unsharded data will be redistributed across the cluster by data size per rank</li>
</ul>

NOTE: Replicated data will not move as a result of this callThis endpoint’s processing time depends on the amount of data in the system, thus the API call may time out if run directly. It is recommended to run this endpoint asynchronously via `/create/job`.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/admin_rebalance.rs#L68-L82)
pub async fn [admin\_rebalance\_with\_opts](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/admin-rebalance.md#method.admin_rebalance_with_opts)( \&self, options: [AdminRebalanceRequestOptions](https://docs.kinetica.com/content/api/rust/generated/api/struct.AdminRebalanceRequestOptions.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[AdminRebalanceResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.AdminRebalanceResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Rebalance data and/or shards across all nodes in a clusterRebalance the data in the cluster so that all nodes contain an equal number of records approximately and/or rebalance the shards to be equally distributed (as much as possible) across all the ranks.The database must be offline for this operation, see `/admin/offline`

<ul>
  <li>If `/admin/rebalance` is invoked after a change is made to the cluster, e.g., a host was added or removed, sharded data will be evenly redistributed across the cluster by number of shards per rank while unsharded data will be redistributed across the cluster by data size per rank</li>
  <li>If `/admin/rebalance` is invoked at some point when unsharded data (a.k.a. randomly-sharded) in the cluster is unevenly distributed over time, sharded data will not move while unsharded data will be redistributed across the cluster by data size per rank</li>
</ul>

NOTE: Replicated data will not move as a result of this callThis endpoint’s processing time depends on the amount of data in the system, thus the API call may time out if run directly. It is recommended to run this endpoint asynchronously via `/create/job`.

##### Arguments

<ul>
  <li>`options` - The optional parameters; any left unset take the server’s defaults.</li>
</ul>

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/admin_rebalance.rs#L85-L96)
pub async fn [admin\_rebalance\_raw](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/admin-rebalance.md#method.admin_rebalance_raw)( \&self, request: &[AdminRebalanceRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.AdminRebalanceRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[AdminRebalanceResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.AdminRebalanceResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`AdminRebalanceRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.AdminRebalanceRequest) to the `/admin/rebalance` endpoint.

[Source](https://github.com/kineticadb/kinetica-api-rust/blob/master/crates/gpudb-api/src/generated/admin_rebalance.rs#L100-L112)
pub async fn [admin\_rebalance\_from\_url](https://docs.kinetica.com/content/api/rust/gpudb/struct.Kinetica/admin-rebalance.md#method.admin_rebalance_from_url)( \&self, url: &[str](https://doc.rust-lang.org/1.98.1/std/primitive.str.html), request: &[AdminRebalanceRequest](https://docs.kinetica.com/content/api/rust/generated/api/struct.AdminRebalanceRequest.md), ) -> [Result](https://doc.rust-lang.org/1.98.1/core/result/enum.Result.html)\<[AdminRebalanceResponse](https://docs.kinetica.com/content/api/rust/generated/api/struct.AdminRebalanceResponse.md), [KineticaError](https://docs.kinetica.com/content/api/rust/errors/enum.KineticaError.md)>

Sends a pre-built [`AdminRebalanceRequest`](https://docs.kinetica.com/content/api/rust/generated/api/struct.AdminRebalanceRequest) to a specific worker URL, bypassing HA head-node selection. Used for multi-head access.


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