Skip to content

Instantly share code, notes, and snippets.

@smarj
Last active May 23, 2017 16:23
Show Gist options
  • Save smarj/ce4ddec0918275c3bdd1d9468e36d315 to your computer and use it in GitHub Desktop.
Save smarj/ce4ddec0918275c3bdd1d9468e36d315 to your computer and use it in GitHub Desktop.

Sendgrid Cluster Metadata testing steps

Tested on 2.2.0. $RIAK=http://localhost:8098

  1. Create a 5 node cluster in Docker using createdrc.sh
  2. Create a bucket type for Solr without an index with:
docker exec riak1 riak-admin bucket-type create solr '{"props”:{ “w”: 1 }}’
docker exec riak1 riak-admin bucket-type activate solr
  1. Turned search on.
  2. Create a search index with the default schema:
curl -XPUT $RIAK/search/index/solrindex
  1. Set bucket properties on 2 buckets:
curl -XPUT $RIAK/types/solr/buckets/stest1/props -H 'Content-Type: application/json'  -d '{"props":{"search_index": "solrindex" }}'
curl -XPUT $RIAK/types/solr/buckets/stest2/props -H 'Content-Type: application/json'  -d '{"props":{"search_index": "solrindex" }}'
  1. Verify the buckets exist in cluster_meta by checking the output from:
docker exec -it riak1 bash 
cd cluster_meta
riak attach
{ok, Output} = file:open("/tmp/cmout.erl", [write]).
DumpDets = fun(File, Out) -> {ok,N} = dets:open_file(schema, [{file,File},{repair,false}]), 
              F = fun(X) -> file:write(Out, io_lib:format("~p~n", [X])), continue end, dets:traverse(N, F), 
              dets:close(N) 
           end.
DumpDets("/var/lib/riak/cluster_meta/A74AD8DFACD4F985EB3977517615CE25-299603833C61DF20153B0BEC0EA2BDC7-11.dets", Output)            .

  1. Fill with custom data using riak-solr-count-fill.sh
  2. Deleted the data in stest1:
import riak

riak_handle = riak.RiakClient(pb_port=8087, protocol='pbc')
riak_bucket = riak_handle.bucket('stest1', bucket_type='solr')

for keys in riak_bucket.stream_keys():
    for key in keys:
        print('Deleting %s' % key)
        riak_bucket.delete(key)
  1. Checked cluster metadata and see both buckets.
  2. Reset properties on stest1:
curl -XDELETE $RIAK/types/solr/buckets/stest1/props
  1. Checked cluster metadata, and see only stest2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment