setting search schema

David Lowell dave at go2ctv.com
Mon Oct 15 20:55:42 EDT 2012


You know, the more I look at this piece, the more I conclude there just is nowhere to put a programmatic installation of the schema into riak. I can't do it from my application, which does not run as user 'riak', nor as user 'root'. So it doesn't have the needed permissions to run search-cmd and change the schema. The documentation strongly warns against directly manipulating the bucket of schemas. I could install the schema from script as a part of the software install process, but there is no guarantee that riak is even running at that time. So the only other option seems to hack the riak startup script or create a cronjob or some other kludgeism. 

So how are people handling this? Is everyone having their sysadmin install the schema by hand? Surely someone has come up with something automated! Sigh…

Dave

--
Dave Lowell
dave at connectv.com

On Oct 13, 2012, at 3:40 PM, Alexander Sicular wrote:

> Hi David, I'm thinking that you should write some bash-fu and use the search-cmd tool. You could do a search-cmd show-schema to check for a schema match. If you have to run search-cmd as root it stands to reason that you are running riak as root which I don't think is a good idea in general.
> 
> -Alexander Sicular
> 
> @siculars
> 
> On Oct 13, 2012, at 3:32 PM, David Lowell wrote:
> 
>> My software needs to be able to set a custom schema in Riak for indexing json objects. To make deploying my software easy, what I think I'd like to be able to do is:
>> 
>> - on app startup, test whether the schema has been added for index already
>> - if not, set the schema for my index
>> 
>> It does appear that I can test whether a schema exists for my index with (from python):
>> 
>> 	client.bucket('_rs_schema').get(INDEX_NAME).exists()
>> 
>> However, the docs warn against writing any schemas into the _rs_schema bucket directly. The only other interface documented for assigning schemas is the "search-cmd" command line tool. I conclude there does not appear to be a supported way to assign schemas to indexes from code.
>> 
>> I could have my code invoke the command line tools to assign this schema, but then my code would have to run as root.
>> 
>> So, am I missing something? How do other people manage to manage the schemas for their indexes?
>> 
>> Thanks for the help,
>> 
>> Dave
>> 
>> --
>> Dave Lowell
>> dave at connectv.com
>> 
>> _______________________________________________
>> riak-users mailing list
>> riak-users at lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20121015/d763f94b/attachment.html>


More information about the riak-users mailing list