CouchDB Error : {badmatch,{error,eacces} {couch_file,init,1} …


So today we had the following issue with our CouchDB environment.

First we were requsted to copy an exsiting environment of couchDB to another servers.

Few basic steps

1. Stop CouchDB (Optional)

2. tar -czvf /usr/local/var/lib/couchdb couchdbs

3. copy the tar file to destination server

4. untar  tar -xzvf couchdbs to the same folder /usr/local/var/lib/couchdb

5. make sure that all .couch files are owned by couchdb user.

6. make sure on more critical thing (we will talk about it later)

after copying the data files and setting permissions, we can access the dbs from our web UI .


Now, while trying to access the following view


I ‘ve encountered the error below :


So after looking in couchdb,log (which is located on  /usr/local/var/log/couchdb)

I saw this line – reporting something is wrong with accessing to my view file (which is stored under hidden directory .<view_name> )

[Sun, 28 Apr 2013 16:07:05 GMT] [error] [<0.4679.0>] Failed to open view file ‘/usr/local/var/lib/couchdb/.<view_name>/e2bf9be9033e7101e52655ea1a8088f3.view‘: unknown POSIX

a quick permissions check on /usr/local/var/libcouchdb revealed that the hidden folder  .<view_name> was owned by root and by couchdb user.

I ran

chown -R /usr/local/var/lig/couchdb/

and then the view worked fine !

In order to do it carefully, I deleted the view document’s revision, and recreated the view.

1. Getting the document’s revision

curl -X GET<db_name>/_design/<view_name&gt;

2. curl -X DELETE<db_name>/_design/<view_name&gt;?rev=REV-ID

3. Recreate the view

curl -X PUT<db_name>/_design/<view_name&gt; -d @<view_name>.json

Enjoy !

Tagged with: , , ,
Posted in CouchDB
3 comments on “CouchDB Error : {badmatch,{error,eacces} {couch_file,init,1} …
  1. Brigette says:

    Hi webmaster do you need unlimited content for your blog ?
    What if you could copy article from other blogs, make it
    pass copyscape test and publish on your blog – i know the right tool for you, just search in google:

    Loimqua’s article tool

  2. modprobe says:

    Was having the same problem


  3. Veasna says:

    work like a magic, thank

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: