Skip to content

BUCKET.LOCATE

Returns the routing information for a bucket. It lists which shards hold the bucket’s data, the member that owns each shard, and the addresses of those members.

BUCKET.LOCATE <bucket>
ParameterTypeRequiredDescription
bucketstringYesName of the bucket to locate.

Returns an array with two elements: the route table and the member table.

The route table is a flat array with 3 elements per shard:

PositionTypeDescription
0integerShard ID.
1stringMember ID of the primary owner.
2arrayMember IDs of the standby replicas. Empty array if no standbys exist.

This pattern repeats for each shard the bucket spans. For a bucket on 2 shards, the route table contains 6 elements.

Shards without a known route are silently omitted from the result.

The member table is a flat array with 2 elements per member:

PositionTypeDescription
0stringMember ID.
1arrayAddresses clients connect to, host:port, preferred entry first.

The member table lists each member once, even when that member owns several shards. Members that do not appear in the route table are left out. Clients can use the member ID as a cache key for connections.

Bucket errors:

Error CodeError messageCause
NOSUCHBUCKETNo such bucket: '<bucket>'-

Locate a single-shard bucket:

> BUCKET.LOCATE users
1) 1) (integer) 0
2) "6ce1a1f0"
3) (empty array)
2) 1) "6ce1a1f0"
2) 1) "127.0.0.1:5484"

Locate a multi-shard bucket with a standby:

> BUCKET.LOCATE events
1) 1) (integer) 0
2) "6ce1a1f0"
3) 1) "b47d9c25"
4) (integer) 1
5) "6ce1a1f0"
6) (empty array)
2) 1) "6ce1a1f0"
2) 1) "10.0.0.1:5484"
2) "[fd00::1]:5484"
3) "b47d9c25"
4) 1) "10.0.0.2:5484"

Member 6ce1a1f0 owns both shards, so it appears once in the member table.

Non-existent bucket:

> BUCKET.LOCATE nonexistent
(error) NOSUCHBUCKET No such bucket: 'nonexistent'