This is a giant cleanup of the etcd code. The earlier version was written when I was less experienced with golang. This is still not perfect, and does contain some races, but at least it's a decent base to start from. The automatic elastic clustering should be considered an experimental feature. If you need a more battle-tested cluster, then you should manage etcd manually and point mgmt at your existing cluster.
18 lines
930 B
Plaintext
18 lines
930 B
Plaintext
# run this example with these commands
|
|
# watch -n 0.1 'tail *' # run this in /tmp/mgmt/
|
|
# time ./mgmt run --hostname h1 --tmp-prefix --no-pgp empty
|
|
# time ./mgmt run --hostname h2 --seeds http://127.0.0.1:2379 --client-urls http://127.0.0.1:2381 --server-urls http://127.0.0.1:2382 --tmp-prefix --no-pgp empty
|
|
# time ./mgmt run --hostname h3 --seeds http://127.0.0.1:2379 --client-urls http://127.0.0.1:2383 --server-urls http://127.0.0.1:2384 --tmp-prefix --no-pgp empty
|
|
# time ./mgmt run --hostname h4 --seeds http://127.0.0.1:2379 --client-urls http://127.0.0.1:2385 --server-urls http://127.0.0.1:2386 --tmp-prefix --no-pgp empty
|
|
# time ./mgmt deploy --no-git --seeds http://127.0.0.1:2379 lang --lang examples/lang/exchange0.mcl
|
|
|
|
import "sys"
|
|
import "world"
|
|
|
|
$rand = random1(8)
|
|
$exchanged = world.exchange("keyns", $rand)
|
|
|
|
file "/tmp/mgmt/exchange-${sys.hostname()}" {
|
|
content => template("Found: {{ . }}\n", $exchanged),
|
|
}
|