ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
    • Supported Driver Versions
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Search Ask AI
ScyllaDB Docs ScyllaDB Node.js Driver Replicas
For AI agents: a documentation index is available at https://nodejs-rs-driver.docs.scylladb.com/v0.7.1/llms.txt. A Markdown version of this page is at https://nodejs-rs-driver.docs.scylladb.com/v0.7.1/metadata/replicas.md.

Replicas¶

Replica placement determines which nodes replicate each partition of data in the cluster. client.metadata.getReplicas(keyspaceName, tableName, token) returns the replicas for a given token (partition key), which is useful for token-aware routing and understanding data distribution.

Note: This endpoint behaves incorrectly when passed a keyspace that doesn’t exist – it walks the global ring from token and returns the first node it finds.

Specifying a partition¶

The token parameter accepts two forms:

  • Token: A pre-computed token object, created via metadata.newToken():

    const token = client.metadata.newToken(
      Buffer.from("user-123", "utf8"),
      "my_keyspace",
      "my_table"
    );
    const replicas = client.metadata.getReplicas("my_keyspace", "my_table", token);
    
  • TokenRange: A range object; any token within the range identifies its replicas:

    const range = client.metadata.getTokenRanges()[0];
    const replicas = client.metadata.getReplicas("my_keyspace", "my_table", range);
    

Replica object¶

Each replica is an object with:

{
  host: Host,      // The Host object from client.hosts
  shard: number    // The shard number on that host
}

The host is the exact same Host instance that client.hosts.get() returns, so you can compare by identity:

const replicas = client.metadata.getReplicas("ks", "tbl", token);
for (const replica of replicas) {
  const knownHost = client.hosts.get(replica.host.hostId);
  if (replica.host === knownHost) {
    console.log(`Partition lives on ${knownHost.address}, shard ${replica.shard}`);
  }
}

Vnode vs. tablet routing¶

Vnode-based routing (traditional): The cluster has one token ring, divided into vnodes (ranges). All partitions of a table see the same ranges. getTokenRanges() returns the vnode boundaries.

Tablet-based routing (ScyllaDB only): Each table is independently divided into tablets (fixed-size ranges). getReplicas() respects tablet boundaries and returns replicas as reported by the server. Tablet placement is learned dynamically as queries are routed.

Was this page helpful?

PREVIOUS
Topology
NEXT
Query Tracing
  • Create an issue
  • Edit this page

On this page

  • Replicas
    • Specifying a partition
    • Replica object
    • Vnode vs. tablet routing
ScyllaDB Node.js Driver
Search Ask AI
  • v0.7.1
    • main
    • v0.7.1
    • v0.6.1
  • Getting Started
  • Statements
    • Executing CQL Statements - Best Practices
    • Unprepared Statements
    • Batch Statements
    • Parameterized queries
  • Fetching Large Result Sets
  • Schema Metadata
  • Topology
  • Replicas
  • Query Tracing
  • Logging
  • Policies
    • Load Balancing
    • Retry Policies
  • Authentication
  • Client Routes (Private Networking)
  • Shutdown
  • Migration Guide
  • API Reference
    • Modules
      • auth
        • AuthProvider
        • Authenticator
        • PlainTextAuthProvider
      • datastax
        • graph
        • search
      • errors
        • ArgumentError
        • AuthenticationError
        • BusyConnectionError
        • DriverInternalError
        • NoHostAvailableError
        • NotSupportedError
        • OperationTimedOutError
        • ResponseError
      • geometry
      • mapping
        • DefaultTableMappings
        • Mapper
        • ModelBatchItem
        • ModelMapper
        • Result
        • UnderscoreCqlToCamelCaseMappings
        • TableMappings
      • metrics
        • DefaultMetrics
        • ClientMetrics
      • policies
        • addressResolution
          • AddressTranslator
          • EC2MultiRegionTranslator
          • MappingAddressTranslator
        • loadBalancing
          • AllowListPolicy
          • DCAwareRoundRobinPolicy
          • DefaultLoadBalancingPolicy
          • LegacyDefaultLoadBalancingPolicy
          • LoadBalancingConfig
          • LoadBalancingPolicy
          • RoundRobinPolicy
          • TokenAwarePolicy
        • reconnection
          • ConstantReconnectionPolicy
          • ExponentialReconnectionPolicy
          • ReconnectionPolicy
        • retry
          • FallthroughRetryPolicy
          • RetryPolicy
        • timestampGeneration
          • MonotonicTimestampGenerator
          • TimestampGenerator
      • tracker
        • RequestLogger
        • RequestTracker
      • types
        • BigDecimal
        • Duration
        • InetAddress
        • Integer
        • LocalDate
        • ResultStream
        • Row
        • TimeUuid
        • Tuple
        • Uuid
    • Classes
      • Client
      • ColumnInfo
      • ConstantSpeculativeExecutionPolicy
      • DateRange
      • DateRangeBound
      • DseGssapiAuthProvider
      • DsePlainTextAuthProvider
      • Edge
      • Element
      • Encoder
      • EncoderMembers
      • ExecutionOptions
      • ExecutionProfile
      • FrameReader
      • FrameWriter
      • GraphResultSet
      • HashSet
      • LineString
      • NoSpeculativeExecutionPolicy
      • Path
      • Point
      • Polygon
      • PreparedInfo
      • Property
      • ResultColumnsCache
      • ResultSet
      • RustResult
      • RustSession
      • SpeculativeExecutionPolicy
      • SslOptions
      • Token
      • TokenRange
      • Vertex
      • VertexProperty
      • module-metadata-LocalStrategy
    • Interfaces
    • Events
    • Global Functions and Constants
Docs Tutorials University Contact Us About Us
© 2026 ScyllaDB | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 23 Oct 2026.
Powered by Sphinx 9.1.0 & ScyllaDB Theme 1.9.3