Skip to content

Commit ee34e14

Browse files
committed
Adding cluster documentation
1 parent effde65 commit ee34e14

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

docs/cluster.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Clusters
2+
--------
3+
4+
The cluster-specific API lets you get information about individual
5+
cluster nodes and the cluster as a whole, as well as monitor and
6+
administrate cluster deployments. For more information on the design
7+
and architecture, refer to `ArangoDB Manual`_.
8+
9+
.. _ArangoDB Manual: https://docs.arangodb.com
10+
11+
.. code-block:: python
12+
13+
from arangoasync import ArangoClient
14+
from arangoasync.auth import Auth
15+
16+
# Initialize the client for ArangoDB.
17+
async with ArangoClient(hosts="http://localhost:8529") as client:
18+
auth = Auth(username="root", password="passwd")
19+
20+
# Connect to "_system" database as root user.
21+
db = await client.db("_system", auth=auth)
22+
cluster = db.cluster
23+
24+
# Cluster health
25+
health = await cluster.health()
26+
27+
# DB-Server statistics
28+
db_server = "PRMR-2716c9d0-4b22-4c66-ba3d-f9cd3143e52b"
29+
stats = await cluster.statistics(db_server)
30+
31+
# Cluster endpoints
32+
endpoints = await cluster.endpoints()
33+
34+
# Cluster server ID and role
35+
server_id = await cluster.server_id()
36+
server_role = await cluster.server_role()
37+
38+
# Maintenance mode
39+
await cluster.toggle_maintenance_mode("on")
40+
await cluster.toggle_maintenance_mode("off")
41+
await cluster.toggle_server_maintenance_mode(
42+
db_server, "maintenance", timeout=30
43+
)
44+
status = await cluster.server_maintenance_mode(db_server)
45+
await cluster.toggle_server_maintenance_mode(db_server, "normal")
46+
47+
# Rebalance
48+
result = await cluster.calculate_imbalance()
49+
result = await cluster.calculate_rebalance_plan()
50+
result = await cluster.execute_rebalance_plan(moves=[])
51+
result = await cluster.rebalance()
52+
53+
See :class:`arangoasync.cluster.Cluster` for API specification.

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Contents
4646
transaction
4747
view
4848
analyzer
49+
cluster
4950

5051
**API Executions**
5152

docs/specs.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ python-arango-async.
3131
.. automodule:: arangoasync.backup
3232
:members:
3333

34+
.. automodule:: arangoasync.cluster
35+
:members:
36+
3437
.. automodule:: arangoasync.compression
3538
:members:
3639

0 commit comments

Comments
 (0)