Distributed counters
To play with Discnt please do the following:
make
. Binaries (discnt-cli
and discnt-server
) will end up in the src
directory.discnt.conf
files following the example discnt.conf
in the source distribution.CLUSTER MEET <ip> <port>
for every other node in the cluster.To run a node, just call ./discnt-server
.
For example if you are running three Discnt servers in port 7711, 7712, 7713 in order to join the cluster you should use the discnt-cli
command line tool and run the following commands:
./discnt-cli -p 7711 cluster meet 127.0.0.1 7712
./discnt-cli -p 7711 cluster meet 127.0.0.1 7713
Your cluster should now be ready. You can try to add a job and fetch it back in order to test if everything is working:
./discnt-cli -p 7711
127.0.0.1:7711> INCRBY test 0.1
0.1
127.0.0.1:7711> GET test
0.1
Remember that you can increment counters on different nodes as Discnt is multi master.
First you need to add the key:
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x6f2a6e77ada5694c
And then add the sources:
sudo add-apt-repository ppa:discnt/stable
Or add the following sources manually (change the release to your Ubuntu version):
deb http://ppa.launchpad.net/discnt/stable/ubuntu precise main
deb-src http://ppa.launchpad.net/discnt/stable/ubuntu precise main
After this you can run:
sudo apt-get update
sudo apt-get install discnt