Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-17577

Add cqlsh SHOW REPLICAS by token command

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 5.0-alpha1, 5.0
    • CQL/Interpreter
    • None

    Description

      It is often useful to know when a query fails or a query is slow which nodes the query was routed  too. For clusters with vnodes, determining this is not simple and requires an admin tool like 'nodetool getendpoints;. 

      But, the Cassandra driver has cluster metadata which identifies which nodes are the replicas for a given token range.  It should be straightforward to support this in CQLSH.

      Example with python driver:

      from cassandra.cluster import Cluster

      from cassandra.auth import PlainTextAuthProvider

      import cassandra.metadata

      from cassandra.metadata import Murmur3Token

       

      auth_provider = PlainTextAuthProvider(username='cassandra', password='cassandra')

      cluster = Cluster(['127.0.0.1'], auth_provider=auth_provider)

      session = cluster.connect('tests')

      cluster.metadata.token_map.get_replicas('tests',Murmur3Token(100))

      >>> cluster.metadata.token_map.get_replicas('tests',Murmur3Token(100))

      [<Host: 127.0.0.1:9042 datacenter1>]

       

      Users shouldn't require access to an admin tool like nodetool to access the cluster metadata.  This is especially true for Cassandra-as-a-service offerings like AWS keyspaces or Instaclustr's managed service.

      Attachments

        Issue Links

          Activity

            People

              bschoeni Brad Schoening
              bschoeni Brad Schoening
              Brad Schoening
              Brandon Williams, Stefan Miklosovic
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 50m
                  1h 50m