Skip to content

[Docs] Include a code example for rack-awareness #427

Open
@GeoffMontee

Description

@GeoffMontee

Starting with 3.28.0, our release of the ScyllaDB Python driver supports rack-awareness.

We have some limited documentation about this feature here:

https://python-driver.docs.scylladb.com/stable/api/cassandra/policies.html#cassandra.policies.RackAwareRoundRobinPolicy

https://github.com/scylladb/python-driver/blob/master/docs/api/cassandra/policies.rst

Perhaps we could include a more complete example in the documentation. For example:

from cassandra.cluster import Cluster, ExecutionProfile, EXEC_PROFILE_DEFAULT
from cassandra.policies import RackAwareRoundRobinPolicy, DowngradingConsistencyRetryPolicy
from cassandra.query import tuple_factory

profile = ExecutionProfile(
    load_balancing_policy=RackAwareRoundRobinPolicy('AWS_US_EAST_1', 'us-east-1a'),
    retry_policy=DowngradingConsistencyRetryPolicy(),
    consistency_level=ConsistencyLevel.LOCAL_QUORUM,
    serial_consistency_level=ConsistencyLevel.LOCAL_SERIAL,
    request_timeout=15,
    row_factory=tuple_factory
)
cluster = Cluster(['192.168.1.1', '192.168.1.2','192.168.1.3'], execution_profiles={EXEC_PROFILE_DEFAULT: profile})
session = cluster.connect()

We might also want to include a disclaimer about AWS specifically, where AZs do not have consistent names between different AWS accounts. Maybe the documentation can provide more detailed guidance about this or refer to the AWS documentation that mentions how to obtain the internal AZ IDs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions