Tested on 2.2.0. $RIAK=http://localhost:8098
- Create a 5 node cluster in Docker using
createdrc.sh
- 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
- Turned search on.
- Create a search index with the default schema:
curl -XPUT $RIAK/search/index/solrindex
- 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" }}'
- 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) .
- Fill with custom data using
riak-solr-count-fill.sh
- 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)
- Checked cluster metadata and see both buckets.
- Reset properties on
stest1
:
curl -XDELETE $RIAK/types/solr/buckets/stest1/props
- Checked cluster metadata, and see only stest2.