Changing the UUID algorithm in CouchDB -



Changing the UUID algorithm in CouchDB -

this question referencing couchdb version 1.5.0

for purposes of environment, want able order documents in database later retrieval based on sort of time index. read online there 4 algorithms uuid creation in couchdb.

documentation shows algorithms can used in uuid generation listed in here: http://couchdb.readthedocs.org/en/latest/config/misc.html#uuids-configuration

i suspect default uuid algorithm setting "sequential", when issuing http://couchdb:5984/_uuids?count=50 , see big chunk of them (if not all) first 26 digits identical , lastly 6 unique.

i tried changing algorithm 1 of utc options (either "utc_random" or "utc_id" work) first 16 bits time in microseconds unix epoch in hex.

the method used alter uuid algorithm go local.ini file , append next stanza (it wasn't in there previously):

[uuids] algorithm = utc_random

i restart couchdb service

service couchdb restart

when query 1 time again batch of uuids still appears result indicating uuids beingness generated still in sequential algorithm. (when query 50 uuids sec time after this, "sequential" algorithm behavior noticed)

am doing wrong? help can offered appreciated!

update

after trying curl command suggested akshat jiwan sharma went delving configuration files , found default.ini file. file uuids parameter appears set , replaced 'sequential' 'utc_random', restarted couchdb service , works expected. find configuration files couchdb, used simple command line couchdb -c give thanks 1 time again help, guys awesome!

there couple of things can check.

have added configuration file? can chain config files in couchdb , if changes lastly file in chain used.

make phone call http://localhost:5984/_config/uuids info uuid algorithm used couchdb. should result like

{"algorithm":"utc_random","max_count":"1000"}

and can verify whether couchdb has picked configuration or not.

also can alter configuration files via rest api. help in debugging don't need restart couchdb again. benefit of method relevant configuration file changed.

here how can it

curl -x set http://localhost:5984/_config/uuids/algorithm -d '"utc_random"'

be aware though if have typo in parameter want alter illustration ramdom instead of random (i typed !) couch db throw runtime exception , have have resort manually changing config files.

algorithm couchdb uuid

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -