CouchDB error: db_file_not_found


#1

My quest with NoSQL databases continues. Earlier I had issues with MOngoDB. I switched to Couchdb and now the same thing happens.

I followed the installation described here. https://docs.c9.io/docs/setting-up-couchdb
Couchdb starts ok and I can connect to it with CURL.

BUT

When I try to insert stuff using node I get errors (below). So db_file is missing? Where should I specify this?

Apache CouchDB 1.5.0 (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.
[info] [<0.32.0>] Apache CouchDB has started on http://127.0.0.1:5984/
[info] [<0.111.0>] 127.0.0.1 - - GET / 200
[error] [<0.586.0>] Could not open file /var/lib/couchdb/test_db.couch: no such file or directory
[info] [<0.121.0>] 127.0.0.1 - - PUT /test_db/unique_id 404
[error] [<0.656.0>] Could not open file /var/lib/couchdb/test_db.couch: no such file or directory
[info] [<0.585.0>] 127.0.0.1 - - PUT /test_db/unique_id 404


#2

Hey @mjstenbe :slightly_smiling:,

I tried researching it but came up short. The best I could suggest is to manually create an empty test_db.couch file:

  • sudo touch /var/lib/couchdb/test_db.couch

#3

I tried your suggestion, and created the file manually. After starting couchdb it crashes:

mjstenbe:~/workspace $ sudo su couchdb -c /usr/bin/couchdb
Apache CouchDB 1.5.0 (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.
[info] [<0.32.0>] Apache CouchDB has started on http://127.0.0.1:5984/
[error] [<0.175.0>] {error_report,<0.31.0>,
{<0.175.0>,crash_report,
[[{initial_call,{couch_file,init,[‘Argument__1’]}},
{pid,<0.175.0>},
{registered_name,[]},
{error_info,
{exit,
{{badmatch,{error,eacces}},
[{couch_file,init,1,
[{file,“couch_file.erl”},{line,314}]},
{gen_server,init_it,6,
[{file,“gen_server.erl”},{line,304}]},
{proc_lib,init_p_do_apply,3,
[{file,“proc_lib.erl”},{line,239}]}]},
[{gen_server,init_it,6,
[{file,“gen_server.erl”},{line,328}]},
{proc_lib,init_p_do_apply,3,
[{file,“proc_lib.erl”},{line,239}]}]}},
{ancestors,[<0.174.0>]},
{messages,[]},
{links,[#Port<0.2639>,<0.174.0>]},
{dictionary,[]},
{trap_exit,true},
{status,running},
{heap_size,610},


#4

Hi,

Quick question: How did you create the above DB (test_db) ? If you haven’t created it, writing to it would be an error. To create a couchDB database, you should open a new terminal and type in:

curl -X PUT localhost:5984/<database name>

or in your case

curl -X PUT localhost:5984/test_db

I hope this helps.

Regards,
​Mutahhir