Reverbrain wiki

Site Tools


greylock:tutorial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

greylock:tutorial [2015/09/19 02:27]
zbr created
greylock:tutorial [2015/09/19 02:52] (current)
zbr
Line 144: Line 144:
 <​code>​ <​code>​
 # cd greylock # cd greylock
-# consul agent -server -bootstrap-expect 1 -data-dir conf/​consul.d/​+# mkdir /​tmp/​consul¬†
 +# consul agent -server -bootstrap-expect 1 -config-dir conf/​consul.d/ -data-dir /tmp/consul/
 </​code>​ </​code>​
  
 ==== Running queries ==== ==== Running queries ====
 +
 +These examples do not require Consul, it is a simple single-server setup.
  
 <​code>​ <​code>​
Line 180: Line 183:
  
 All queries are case sensitive, thus ''​Search''​ and ''​search''​ are different terms. All queries are case sensitive, thus ''​Search''​ and ''​search''​ are different terms.
 +
 +==== Running client code with Consul ====
 +
 +<​code>​
 +$ cd greylock
 +$ python src/​consul_client.py --consul-url http://​localhost:​8500 --mailbox some-mailbox-name --id some-document-id --file conf/​insert.json
 +All indexes for document '​some-document-id'​ have been successfully updated
 +$ python src/​consul_client.py --consul-url http://​localhost:​8500 --mailbox some-mailbox-name --search "​searching"​
 +completed: True
 +paging: num: 1, start: ''​
 +bucket: '',​ key: '',​ id: '​some-document-id',​ relevance: 1.000000, ts: 2015-09-19 02:​41:​49.082503127
 +</​code>​
 +
 +This client ''​src/​consul_client.py''​ locks/​unlocks whole mailbox while waiting for all indexes to be updated. There is an API in ''​src/​consul.py''​ to wait on lock, continue it (all locks are actual leases, they are taken for some time) or break the lock.
greylock/tutorial.txt · Last modified: 2015/09/19 02:52 by zbr