The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Couch::DB::Cluster - interface for cluster management

SYNOPSIS

my $cluster = $couchdb->cluster;

DESCRIPTION

This modules groups all CouchDB API calls which relate to clustering, replication, sharind, and related jobs. There are too many related methods, so they got their own module.

METHODS

Constructors

Couch::DB::Cluster->new(%options)
-Option--Default
 couch   <required>
couch => Couch::DB-object

Accessors

$obj->couch()

Managing a Cluster

All CouchDB API calls documented below, support %options like _delay and on_error. See "Using the CouchDB API" in Couch::DB.

$obj->clusterSetup(%options)
[CouchDB API "POST /_cluster_setup", since 2.0, UNTESTED]

Describes the status of this CouchDB instance is in the cluster.

All %options are posted as parameters. See the API docs.

$obj->clusterState(%options)
[CouchDB API "GET /_cluster_setup", since 2.0, UNTESTED]

Describes the status of this CouchDB instance is in the cluster. Option ensure_dbs_exist.

Sharding

$obj->reshardJob($jobid, %options)
[CouchDB API "GET /_reshard/jobs/{jobid}", since 2.4, UNTESTED]

Show the resharding activity.

$obj->reshardJobChange($jobid, %options)
[CouchDB API "PUT /_reshard/jobs/{jobid}/state", since 2.4, UNTESTED]
Change the resharding job status.

-Option--Default
 reason  undef
 state   <required>
reason => STRING
state => STRING

Can be new, running, stopped, completed, or failed.

$obj->reshardJobRemove($jobid, %options)
[CouchDB API "DELETE /_reshard/jobs/{jobid}", since 2.4, UNTESTED]

Show the resharding activity.

$obj->reshardJobState($jobid, %options)
[CouchDB API "GET /_reshard/jobs/{jobid}/state", since 2.4, UNTESTED]

Show the resharding job status.

$obj->reshardJobs(%options)
[CouchDB API "GET /_reshard/jobs", since 2.4, UNTESTED]

Show the resharding activity.

$obj->reshardStart(\%create, %options)
[CouchDB API "POST /_reshard/jobs", since 2.4, UNTESTED]

Create resharding jobs. The many %options are passed as parameters.

$obj->reshardStatus(%options)
[CouchDB API "GET /_reshard", since 2.4, UNTESTED] and
[CouchDB API "GET /_reshard/state", since 2.4, UNTESTED]

Retrieve the state of resharding on the cluster.

-Option--Default
 counts  false
counts => BOOLEAN

Include the job counts in the result.

$obj->resharding(%options)
[CouchDB API "PUT /_reshard/state", since 2.4, UNTESTED]

Start or stop the resharding process.

-Option--Default
 reason  undef
 state   <required>
reason => STRING
state => STRING

Can be stopped or running. Stopped state can be resumed into running.

$obj->shardsForDB($db, %options)
[CouchDB API "GET /{db}/_shards", since 2.0, UNTESTED]

Returns the structure of the shared used to store a database. Pass this a $db as Couch::DB::Database-object.

$obj->shardsForDoc($doc, %options)
[CouchDB API "GET /{db}/_shards/{docid}", since 2.0, UNTESTED]

Returns the structure of the shared used to store a database. Pass this a $db as Couch::DB::Database-object.

$obj->syncShards($db, %options)
[CouchDB API "POST /{db}/_sync_shards", since 2.3.1, UNTESTED]

Force (re-)sharding of documents, usually in response to changes in the setup. Pass this a $db as Couch::DB::Database-object.

SEE ALSO

This module is part of Couch-DB distribution version 0.002, built on May 31, 2024. Website: http://perl.overmeer.net/CPAN/

LICENSE

Copyrights 2024 by [Mark Overmeer]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/