doozerd
[options]
doozerd
[-c ] [-l ] [-a | -b ]
Doozerd stores data in a cluster of doozerds consistently. A cluster has one
or more members and zero or more slaves. When there is more than one doozerd in
a cluster, it takes on the property of fault-tolerance. Each doozerd
participating in consensus is called a member. One or more members make up a
cluster. A doozerd attached to a cluster, and that is not participating in
consensus, is a slave. Slaves watch the /ctl/cal
directory for an empty
file to appear. If this happens, slaves will attempt to set the contents of
that file to their identity. If the file is written successfully, the slave
will become a member of the cluster. Each doozerd process keeps a complete,
consistent copy of the entire data store by changing their own stores in the
same order as the others. (See Data
Model for more
information.)
Consensus
For members and slaves to change their stores in the same order, each write operation given to a member goes through consensus. This guarantees the order of the writes to all stores. Doozerd employs the Paxos algorithm for consensus.
-
-a
=: Attach to a member in a cluster at address . -
-b
=: A uri containing the address of a DzNS cluster. If members are found under/ctl/ns/<name>
, doozerd will attempt to connect to each until it succeeds. See doozer-uri(7)). -
-c
=: The name of a cluster. This is used for ensuring slaves connect to the correct cluster and for looking up addresses in DzNS. -
-fill
=: The number of seconds to wait before filling in unknown sequence numbers. -
-hist
=: The length of history/revisions to keep in the store. -
-l
=: The address to bind to. An is formatted as "host:port". It is important to note that doozerd uses the address given to-l
as an identifier. It is not sufficient to use0.0.0.0
. The must be the address others will connect to it with. -
-pulse
=: How often (in seconds) to set applied key. The key is listed in the store under/ctl/node/<id>/applied
. The contents of the file represents the current revision of this process's copy of the store at the time of writing. -
-timeout
=: The timeout (in seconds) to kick inactive members. -
-tlscert
=: TLS public certificate. If both a-tlscert
and-tlskey
are given, all client traffic is encrypted with TLS. -
-tlskey
=: TLS private key. If both a-tlscert
and-tlskey
are given, all client traffic is encrypted with TLS. -
-v
: Print doozerd's version string and exit. -
-w
=<addr|false>: The listen address for the web view. The default is to use the addr from-l
, and change the port to 8000. If you give-w false
, doozerd will not listen for for web connections.
DOOZER_BOOT_URI
=: See CLUSTERING > With DzNS.
To start a cluster, you will need to start the initial member for others to attach to, or use a Doozer Name Service (DzNS).
Without DzNS
Start the initial member:
$ doozerd -l 127.0.0.1:8046
We can now slave our initial instance.
$ doozerd -l 127.0.0.2:8064 -a 127.0.0.1:8046
Open http://127.0.0.2:8000 to view its web view. Note it sees itself and the initial member.
Add the third slave:
$ doozerd -l 127.0.0.3:8064 -a 127.0.0.1:8046
NOTE: Once the initial member is booted. Slaves can connect at anytime, meaning you can launch them in parallel.
Adding member slots
We need to use a Doozer client to add member slots. Here we will use the
doozer
command:
$ export DOOZER_URI="doozer?:ca=127.0.0.1:8046"
$ printf '' | doozer set /ctl/cal/1 0
$ printf '' | doozer set /ctl/cal/2 0
Open any of the web views and see that each id is the body of one of the three
files under /ctl/cal
.
With DzNS
A DzNS cluster is a doozer cluster used by other doozerd processes to discover members of the cluster they want to join and decide who the initial member will be when creating new clusters.
A DzNS is created the same way you create any other doozer cluster.
To boot a cluster using a DzNS, start a doozerd with the -b
flag or the
DOOZER_BOOT_URI
environment variable set. If your cluster name is not the
default name for -c
, you will also need to set it.
The newly started doozerd will first connect to a member of the DzNS. Once
connected, it will lookup the address of the doozerd listed under
/ctl/boot/<name>
in DzNS. If /ctl/boot/<name>
does not exist, the doozerd
will attempt to create it with its identity as the contents. If succesfull, it
will become the initial member of the cluster and the others will slave it.
$ export DOOZER_BOOT_URI="
doozer:?
ca=127.0.0.1:8046&
ca=127.0.0.2:8046&
ca=127.0.0.3:8046
"
NOTE: All doozerds can be started in parellel when using a DzNS.
$ doozerd -c example -l 127.0.0.10:8046
$ doozerd -c example -l 127.0.0.20:8046
$ doozerd -c example -l 127.0.0.30:8046
$ doozerd -c example -l 127.0.0.40:8046
Now we can create the member slots under /ctl/cal
in the new doozerd
processes. We will, again, use our DzNS to determine which is the member we
need to write to.
First, we need to set the cluster name we want to use in the DOOZER_URI
environment variable, then we create the empty files. The DOOZER_BOOT_URI
will remain unchanged.
$ export DOOZER_URI="doozer:?cn=example"
$ printf '' | doozer set /ctl/cal/1 0
$ printf '' | doozer set /ctl/cal/2 0
doozerd exits 0 on success, and >0 if an error occurs.
Keith Rarick [email protected], Blake Mizerany [email protected]