Manually Setting up A Cluster
Setting up a cluster with KeyDB#
Keep in mind due to the revision we do not need to use keydb-trib.rb as there is now the --cluster create option for keydb-cli.
We will start with an example similar to that with the create-cluster util. Lets create a 6 node setup with 3 masters and 3 replicas.
perform the following actions 6 times, one for each node. You can either create separate keydb.conf files for each, or append config files as you launch.
Make config files and locations#
Either do manually or via script below. Manually perform the following for ports 30000-30005 (substitute [port] with the port#):
script if you do not want to do manually:
note that if you are connecting to different machines you will need to specify bind address in keydb.conf *this is a minimal configuration, and authentication, etc may also need to be set up.
running instances & creating cluster:#
now launch a keydb-server instance with the config file loaded for each of the port instances keydb-server /path-to-dir-above/keydb.conf
next create the cluster with the following command:
x
once connected with keydb-cli, you can run CLUSTER INFO and CLUSTER NODES for corresponding info on the cluster.
Testing the cluster setup#
connect with keydb-cli to port 30000 in cluster mode (-c) and try the following:
A few other commands:#
add the node to the existing cluster.
note we used the add-node command specifying the address of the new node as first argument, and the address of a random existing node in the cluster as second argument to associate
add replica to master with less replicas than others, or random:
add replica to specific master:
or replicate a specific master by connecting to new node and:
reshard: