I don’t see an API for renaming a CouchDB database, or an option in Futon to do the same.
Short of replicating to another database and then deleting the original, is there a one-step way to rename a database?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Adding to what Dominic and PPPaul said…
Renaming the file is absolutely the way to go (make sure you rename it as the same user, not accidentally change the ownership to
rootor something).This is perfectly safe to do in a full running production environment, yes. One of the many advantages of an HTTP/REST API is that there are no adapters with stateful connections to the DB. Each request is a new request. So basically the first request to CouchDB after the rename is complete will be able to use the new name.
But wait, there’s more!
One really cool thing is that even after the rename, the CouchDB server still has an open file-handle to the file itself (which isn’t affected by renaming the inode), so until the CouchDB server is actually restarted you’ll still be able to access the DB using the old name too.
Update
Great observation by ATfPT in the comments, apparently the DB name needs to start with a lower case letter, otherwise it doesn’t show up in Futon.
Update
Another thing I remembered: to find out where the DB files are, run this:
couch-config --db-dir