Skip to content

Cluster Management Cookbook

hamadodene edited this page Dec 6, 2019 · 5 revisions

Managing your cluster from the command line

Using herddb-cli.sh you can manage tablespace metadata and modify the configuration even without having any server running. Yes, because in order to execute "ALTER TABLESPACE" commands the client needs a server to be up and running. Since 0.10.0 the CLI will write and read directly to the ZooKeeper ensemble. Metadata are stored inside ZooKeeper in a binary format, do not try to alter such data without the CLI, in case of troubles please open a ticket or reach us on the mailing list.

Reference guide for command line cluster management functions

List tablespaces

bin/herddb-cli.sh -x jdbc:herddb:zookeeper:localhost:2181/herd --list-tablespaces

Show tablespace metadata

(example for tablespace 'herd') bin/herddb-cli.sh -x jdbc:herddb:zookeeper:localhost:2181/herd --show-tablespace --schema herd

Show nodes

bin/herddb-cli.sh -x jdbc:herddb:zookeeper:localhost:2181/herd --list-nodes

Add a node as replica

bin/herddb-cli.sh -x jdbc:herddb:zookeeper:localhost:2181/herd --add-replica --schema herd --node vitello

bin/herddb-cli.sh -x jdbc:herddb:zookeeper:localhost:2181/herd --show-tablespace --schema herd

Remove a replica

bin/herddb-cli.sh -x jdbc:herddb:zookeeper:localhost:2181/herd --remove-replica --schema herd --node vitello

Change leader

bin/herddb-cli.sh -x jdbc:herddb:zookeeper:localhost:2181/herd --set-leader --schema herd --node vitello

Alter other tablespace parameters

bin/herddb-cli.sh -x jdbc:herddb:zookeeper:localhost:2181/herd --alter-tablespace --schema herd --param expectedreplicacount --value 2

bin/herddb-cli.sh -x jdbc:herddb:zookeeper:localhost:2181/herd --alter-tablespace --schema herd --param maxleaderinactivitytime --value 60000

Using SQL

Every of the functions above can be executed with the custom 'ALTER TABLESPACE' SQL syntax.

ALTER TABLESPACE 'herd','leader:foo' ALTER TABLESPACE 'herd','expectedreplicacount:2'

Beware that the client needs to contact the active leader for the default tablespace (named 'herd'). If you are using a HDBC drive you can set a default 'schema' on the java.sql.Connection

Clone this wiki locally