How to add data to a Riak key in a highly distributed environment?

Using Riak, I want to sequentially add data so that I can get all the data that I added from time to time. Think of logs if I select increasing log lines and pass them to riak, at some point I want to restore everything I added.

I thought about this, creating a new bucket for this, then add the keys defined by a serial number or date and time stamp, and add content to it, then use the “List Key API” and recreate the data I need. The problem is that the list API is inefficient and production is recommended. What I like about this approach is that the data has no problems with writing concurrency (without / etc locks), since all keys are independent.

Another approach is to use one key, open it and add to it, but I am very concerned about concurrency / blocking issues. This action will be performed in a distributed environment and will certainly be a poor choice.

Question : any other ways to do this in Riak? Any mode of adding to the key?

+5
source share
1 answer

When writing a large number of small entries into a bucket is easy and efficient when writing, the penalty you pay is that instead it becomes expensive when you try to read the values, since you most likely will not know these keys. If you need to look at these keys up the secondary index, key filter, or, even worse, go through all the keys in the bucket (which is a very difficult operation and is never recommended for a production environment), it will be significantly less efficient than extracting data by key, and also not scaling.

Riak , , , , . , , , .

, , , . , , , , - -. , . , , , ( ), , . . , , . 3, 14:15 14:20 2013/03/07, "server3_20130307_1415". , 5- "server3_20130307_1420". , .

, , , , . , , , , , Riak 1-2 . , , .

, . , , "server3_20130307_14", 14: 00-15: 00. , .

, , . , , ( "allow_mult" true "last_write_wins" false [1]). , Riak , , , . , , .

, , , ( ), .

[1] http://docs.basho.com/riak/latest/references/apis/http/HTTP-Set-Bucket-Properties/

+10

All Articles