You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Zoltan Lajos Kis <ki...@tmit.bme.hu> on 2009/10/28 21:06:31 UTC

Erlang-only CouchDB

Hello all,

Has anyone been experimenting with running CouchDB as an Erlang only 
application? What I would love to have is:
- stick CouchDB into my lib/ directory, and have it run as part of my 
release (everything running in a single Erlang VM).
- use Erlang views only (is erlview running within the same VM? is it 
up-to-date with CouchDB features?)
- access CouchDB via an Erlang interface (is hovercraft still running? 
does it support all features available via http?)
- no dependency on ICU, curl and SpiderMonkey (as I would not need them 
for anything)

Any pointers to references, case studies, whatever is much appreciated!

Regards,
ZoltAn.





Re: Erlang-only CouchDB

Posted by Senthilkumar Peelikkampatti <se...@gmail.com>.
I already tried that option, it even broke something else.
but got
1> application:start(couch).
{error,{"no such file or directory","couch.app"}}

It looks like erl is not inheriting or not obeying sudo

But finally, the below step did help me solve privilege issues,


   1. sudo bash
   2. set ERL_LIBS
   3. export it
   4. erl

Actual steps are

   1. sudo bash
   2. ERL_LIBS=/usr/local/lib/couchdb/erlang/lib
   3. export ERL_LIBS
   4. echo $ERL_LIBS  --- to verify the var is set properly
   5. erl
   6.

 solved  in my macbook OS-X 10.5.8  :)

Thanks paul.


On Sat, Oct 31, 2009 at 8:10 PM, Paul Davis <pa...@gmail.com>wrote:

> Senthilkumar,
>
> You'll need to make sure that the user running the Erlang shell has
> permissions to read/write to all the required directories as usual. A
> quick test would be to do
>
> $ ERL_LIBS=/usr/local/lib/couchdb/erlang/lib sudo erl
> 1> application:start(couch).
>
> Paul Davis
>
> On Sat, Oct 31, 2009 at 8:49 PM, Senthilkumar Peelikkampatti
> <se...@gmail.com> wrote:
> > Paul,
> >  Thanks for the quick reply,
> >
> > May be I am doing something wrong,
> >
> > These are the things I did to run couchdb using shell scripts
> >
> >   1. pull the source from SVN directly
> >   2. ./bootstrap and ./configure
> >   3. make && sudo make install
> >   4. I usually start in admin mode (sudo  ./couchdb )
> >
> > Now,
> >     for emulator start, I tried with your approach and got the following
> > error
> >
> >   application: couch
> >    exited: {bad_return,{{couch_app,start,
> >                                    [normal,
> >
> ["/usr/local/etc/couchdb/default.ini",
> >
>  "/usr/local/etc/couchdb/local.ini"]]},
> >                         {'EXIT',{{badmatch,{error,shutdown}},
> >                                  [{couch_server_sup,start_server,1},
> >
> {application_master,start_it_old,4}]}}}}
> >
> > I verified that the above config default.ini and local.ini is available
> at
> > the above location. Is there something wrong?
> >
> > --
> > Regards,
> > Senthilkumar Peelikkampatti,
> > http://pmsenthilkumar.blogspot.com/
> >
> >
> > On Sat, Oct 31, 2009 at 7:28 PM, Paul Davis <paul.joseph.davis@gmail.com
> >wrote:
> >
> >> Senthilkumar,
> >>
> >> The basic application loading should work something like this:
> >>
> >> $ ERL_LIBS=/usr/local/lib/couchdb/erlang/lib erl
> >> 1> application:start(couch).
> >>
> >> Paul Davis
> >>
> >> On Sat, Oct 31, 2009 at 8:18 PM, Senthilkumar Peelikkampatti
> >> <se...@gmail.com> wrote:
> >> > Paul,
> >> > I am on 0.11.xxx
> >> > Detailed one below,
> >> > Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0]
> >> > [hipe] [kernel-poll:true]
> >> > --
> >> > Regards,
> >> > Senthilkumar Peelikkampatti,
> >> > http://pmsenthilkumar.blogspot.com/
> >> >
> >> > Eshell V5.7.2  (abort with ^G)
> >> > 1> Apache CouchDB 0.11.0b830800 (LogLevel=info) is starting.
> >> > Apache CouchDB has started. Time to relax.
> >> >
> >> > On Sat, Oct 31, 2009 at 6:44 PM, Paul Davis <
> paul.joseph.davis@gmail.com
> >> >wrote:
> >> >
> >> >> On Sat, Oct 31, 2009 at 7:01 PM, Senthilkumar Peelikkampatti
> >> >> <se...@gmail.com> wrote:
> >> >> > I found almost 7-8 times faster when I use hovercraft compare to
> http
> >> >> > interfaced client like couchbeam or ecouch
> >> >>
> >> >> That sounds about right.
> >> >>
> >> >> > Besides, I am also trying to embed couchdb with my other Erlang
> >> >> application
> >> >> > but when I looked at the startup parameter of the couchdb it is not
> a
> >> >> naive
> >> >> > job to eliminate all the hard work of shell script.
> >> >>
> >> >> What version are you on? Trunk and 0.10.x should both simplify the
> >> >> startup procedure for starting in the VM by doing something like
> >> >> application:start(couch).
> >> >>
> >> >> HTH,
> >> >> Paul Davis
> >> >>
> >> >
> >>
> >
> >
> >
> > --
> > Regards,
> > Senthilkumar Peelikkampatti,
> > http://pmsenthilkumar.blogspot.com/
> >
>



-- 
Regards,
Senthilkumar Peelikkampatti,
http://pmsenthilkumar.blogspot.com/

Re: Erlang-only CouchDB

Posted by Paul Davis <pa...@gmail.com>.
Senthilkumar,

You'll need to make sure that the user running the Erlang shell has
permissions to read/write to all the required directories as usual. A
quick test would be to do

$ ERL_LIBS=/usr/local/lib/couchdb/erlang/lib sudo erl
1> application:start(couch).

Paul Davis

On Sat, Oct 31, 2009 at 8:49 PM, Senthilkumar Peelikkampatti
<se...@gmail.com> wrote:
> Paul,
>  Thanks for the quick reply,
>
> May be I am doing something wrong,
>
> These are the things I did to run couchdb using shell scripts
>
>   1. pull the source from SVN directly
>   2. ./bootstrap and ./configure
>   3. make && sudo make install
>   4. I usually start in admin mode (sudo  ./couchdb )
>
> Now,
>     for emulator start, I tried with your approach and got the following
> error
>
>   application: couch
>    exited: {bad_return,{{couch_app,start,
>                                    [normal,
>                                     ["/usr/local/etc/couchdb/default.ini",
>                                      "/usr/local/etc/couchdb/local.ini"]]},
>                         {'EXIT',{{badmatch,{error,shutdown}},
>                                  [{couch_server_sup,start_server,1},
>                                   {application_master,start_it_old,4}]}}}}
>
> I verified that the above config default.ini and local.ini is available at
> the above location. Is there something wrong?
>
> --
> Regards,
> Senthilkumar Peelikkampatti,
> http://pmsenthilkumar.blogspot.com/
>
>
> On Sat, Oct 31, 2009 at 7:28 PM, Paul Davis <pa...@gmail.com>wrote:
>
>> Senthilkumar,
>>
>> The basic application loading should work something like this:
>>
>> $ ERL_LIBS=/usr/local/lib/couchdb/erlang/lib erl
>> 1> application:start(couch).
>>
>> Paul Davis
>>
>> On Sat, Oct 31, 2009 at 8:18 PM, Senthilkumar Peelikkampatti
>> <se...@gmail.com> wrote:
>> > Paul,
>> > I am on 0.11.xxx
>> > Detailed one below,
>> > Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0]
>> > [hipe] [kernel-poll:true]
>> > --
>> > Regards,
>> > Senthilkumar Peelikkampatti,
>> > http://pmsenthilkumar.blogspot.com/
>> >
>> > Eshell V5.7.2  (abort with ^G)
>> > 1> Apache CouchDB 0.11.0b830800 (LogLevel=info) is starting.
>> > Apache CouchDB has started. Time to relax.
>> >
>> > On Sat, Oct 31, 2009 at 6:44 PM, Paul Davis <paul.joseph.davis@gmail.com
>> >wrote:
>> >
>> >> On Sat, Oct 31, 2009 at 7:01 PM, Senthilkumar Peelikkampatti
>> >> <se...@gmail.com> wrote:
>> >> > I found almost 7-8 times faster when I use hovercraft compare to http
>> >> > interfaced client like couchbeam or ecouch
>> >>
>> >> That sounds about right.
>> >>
>> >> > Besides, I am also trying to embed couchdb with my other Erlang
>> >> application
>> >> > but when I looked at the startup parameter of the couchdb it is not a
>> >> naive
>> >> > job to eliminate all the hard work of shell script.
>> >>
>> >> What version are you on? Trunk and 0.10.x should both simplify the
>> >> startup procedure for starting in the VM by doing something like
>> >> application:start(couch).
>> >>
>> >> HTH,
>> >> Paul Davis
>> >>
>> >
>>
>
>
>
> --
> Regards,
> Senthilkumar Peelikkampatti,
> http://pmsenthilkumar.blogspot.com/
>

Re: Erlang-only CouchDB

Posted by Senthilkumar Peelikkampatti <se...@gmail.com>.
Paul,
 Thanks for the quick reply,

May be I am doing something wrong,

These are the things I did to run couchdb using shell scripts

   1. pull the source from SVN directly
   2. ./bootstrap and ./configure
   3. make && sudo make install
   4. I usually start in admin mode (sudo  ./couchdb )

Now,
     for emulator start, I tried with your approach and got the following
error

   application: couch
    exited: {bad_return,{{couch_app,start,
                                    [normal,
                                     ["/usr/local/etc/couchdb/default.ini",
                                      "/usr/local/etc/couchdb/local.ini"]]},
                         {'EXIT',{{badmatch,{error,shutdown}},
                                  [{couch_server_sup,start_server,1},
                                   {application_master,start_it_old,4}]}}}}

I verified that the above config default.ini and local.ini is available at
the above location. Is there something wrong?

-- 
Regards,
Senthilkumar Peelikkampatti,
http://pmsenthilkumar.blogspot.com/


On Sat, Oct 31, 2009 at 7:28 PM, Paul Davis <pa...@gmail.com>wrote:

> Senthilkumar,
>
> The basic application loading should work something like this:
>
> $ ERL_LIBS=/usr/local/lib/couchdb/erlang/lib erl
> 1> application:start(couch).
>
> Paul Davis
>
> On Sat, Oct 31, 2009 at 8:18 PM, Senthilkumar Peelikkampatti
> <se...@gmail.com> wrote:
> > Paul,
> > I am on 0.11.xxx
> > Detailed one below,
> > Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0]
> > [hipe] [kernel-poll:true]
> > --
> > Regards,
> > Senthilkumar Peelikkampatti,
> > http://pmsenthilkumar.blogspot.com/
> >
> > Eshell V5.7.2  (abort with ^G)
> > 1> Apache CouchDB 0.11.0b830800 (LogLevel=info) is starting.
> > Apache CouchDB has started. Time to relax.
> >
> > On Sat, Oct 31, 2009 at 6:44 PM, Paul Davis <paul.joseph.davis@gmail.com
> >wrote:
> >
> >> On Sat, Oct 31, 2009 at 7:01 PM, Senthilkumar Peelikkampatti
> >> <se...@gmail.com> wrote:
> >> > I found almost 7-8 times faster when I use hovercraft compare to http
> >> > interfaced client like couchbeam or ecouch
> >>
> >> That sounds about right.
> >>
> >> > Besides, I am also trying to embed couchdb with my other Erlang
> >> application
> >> > but when I looked at the startup parameter of the couchdb it is not a
> >> naive
> >> > job to eliminate all the hard work of shell script.
> >>
> >> What version are you on? Trunk and 0.10.x should both simplify the
> >> startup procedure for starting in the VM by doing something like
> >> application:start(couch).
> >>
> >> HTH,
> >> Paul Davis
> >>
> >
>



-- 
Regards,
Senthilkumar Peelikkampatti,
http://pmsenthilkumar.blogspot.com/

Re: Erlang-only CouchDB

Posted by Paul Davis <pa...@gmail.com>.
Senthilkumar,

The basic application loading should work something like this:

$ ERL_LIBS=/usr/local/lib/couchdb/erlang/lib erl
1> application:start(couch).

Paul Davis

On Sat, Oct 31, 2009 at 8:18 PM, Senthilkumar Peelikkampatti
<se...@gmail.com> wrote:
> Paul,
> I am on 0.11.xxx
> Detailed one below,
> Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0]
> [hipe] [kernel-poll:true]
> --
> Regards,
> Senthilkumar Peelikkampatti,
> http://pmsenthilkumar.blogspot.com/
>
> Eshell V5.7.2  (abort with ^G)
> 1> Apache CouchDB 0.11.0b830800 (LogLevel=info) is starting.
> Apache CouchDB has started. Time to relax.
>
> On Sat, Oct 31, 2009 at 6:44 PM, Paul Davis <pa...@gmail.com>wrote:
>
>> On Sat, Oct 31, 2009 at 7:01 PM, Senthilkumar Peelikkampatti
>> <se...@gmail.com> wrote:
>> > I found almost 7-8 times faster when I use hovercraft compare to http
>> > interfaced client like couchbeam or ecouch
>>
>> That sounds about right.
>>
>> > Besides, I am also trying to embed couchdb with my other Erlang
>> application
>> > but when I looked at the startup parameter of the couchdb it is not a
>> naive
>> > job to eliminate all the hard work of shell script.
>>
>> What version are you on? Trunk and 0.10.x should both simplify the
>> startup procedure for starting in the VM by doing something like
>> application:start(couch).
>>
>> HTH,
>> Paul Davis
>>
>

Re: Erlang-only CouchDB

Posted by Senthilkumar Peelikkampatti <se...@gmail.com>.
Paul,
I am on 0.11.xxx
Detailed one below,
Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0]
[hipe] [kernel-poll:true]
-- 
Regards,
Senthilkumar Peelikkampatti,
http://pmsenthilkumar.blogspot.com/

Eshell V5.7.2  (abort with ^G)
1> Apache CouchDB 0.11.0b830800 (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.

On Sat, Oct 31, 2009 at 6:44 PM, Paul Davis <pa...@gmail.com>wrote:

> On Sat, Oct 31, 2009 at 7:01 PM, Senthilkumar Peelikkampatti
> <se...@gmail.com> wrote:
> > I found almost 7-8 times faster when I use hovercraft compare to http
> > interfaced client like couchbeam or ecouch
>
> That sounds about right.
>
> > Besides, I am also trying to embed couchdb with my other Erlang
> application
> > but when I looked at the startup parameter of the couchdb it is not a
> naive
> > job to eliminate all the hard work of shell script.
>
> What version are you on? Trunk and 0.10.x should both simplify the
> startup procedure for starting in the VM by doing something like
> application:start(couch).
>
> HTH,
> Paul Davis
>

Re: Erlang-only CouchDB

Posted by Paul Davis <pa...@gmail.com>.
On Sat, Oct 31, 2009 at 7:01 PM, Senthilkumar Peelikkampatti
<se...@gmail.com> wrote:
> I found almost 7-8 times faster when I use hovercraft compare to http
> interfaced client like couchbeam or ecouch

That sounds about right.

> Besides, I am also trying to embed couchdb with my other Erlang application
> but when I looked at the startup parameter of the couchdb it is not a naive
> job to eliminate all the hard work of shell script.

What version are you on? Trunk and 0.10.x should both simplify the
startup procedure for starting in the VM by doing something like
application:start(couch).

HTH,
Paul Davis

Re: Erlang-only CouchDB

Posted by Senthilkumar Peelikkampatti <se...@gmail.com>.
I found almost 7-8 times faster when I use hovercraft compare to http
interfaced client like couchbeam or ecouch
http://pmsenthilkumar.blogspot.com/2009/10/native-erlang-interface-to-couchdb.html,
this is mainly due to too many serialization and http transport latency, my
brief look at native client is here
http://pmsenthilkumar.blogspot.com/2009/10/native-erlang-interface-to-couchdb.html
Besides, I am also trying to embed couchdb with my other Erlang application
but when I looked at the startup parameter of the couchdb it is not a naive
job to eliminate all the hard work of shell script.


On Sat, Oct 31, 2009 at 5:52 PM, Senthilkumar Peelikkampatti <
senthilkumar.peelikkampatti@gmail.com> wrote:

> I fixed hovercraft and it is now sync up date with latest couchdb 0.11xxx.
> My fork is @ http://github.com/sendtopms/hovercraft
>
>
> On Wed, Oct 28, 2009 at 3:20 PM, Paul Davis <pa...@gmail.com>wrote:
>
>> Zoltan, (Got the A right!)
>>
>> On Wed, Oct 28, 2009 at 4:06 PM, Zoltan Lajos Kis <ki...@tmit.bme.hu>
>> wrote:
>> > Hello all,
>> >
>> > Has anyone been experimenting with running CouchDB as an Erlang only
>> > application? What I would love to have is:
>> > - stick CouchDB into my lib/ directory, and have it run as part of my
>> > release (everything running in a single Erlang VM).
>>
>> We've done some work to make CouchDB startable via application:start()
>> as per Erlang semantics. This should work in theory but there still
>> might be gotchyas with the base install. I know people have
>> successfully run it as a dependent app though.
>>
>> > - use Erlang views only (is erlview running within the same VM? is it
>> > up-to-date with CouchDB features?)
>>
>> Native Erlang views can be enabled with a config option. They're in
>> trunk now and will remain consistent with the JavaScript server
>> implementation.
>>
>> > - access CouchDB via an Erlang interface (is hovercraft still running?
>> does
>> > it support all features available via http?)
>>
>> Not sure if Hovercraft is up to date with trunk. I think I heard
>> someone on IRC say there was a minor version difference that was minor
>> to resolve.
>>
>> > - no dependency on ICU, curl and SpiderMonkey (as I would not need them
>> for
>> > anything)
>>
>> To remove the ICU dependency you'll have to patch CouchDB because its
>> a linked in driver that's required for collation regardless of view
>> server.
>>
>> Curl and Spidermonkey could be removed as install time dependencies
>> fairly easily by discarding couchjs after a build and updating the
>> configuration to not attempt to use it. I think some parts of the auth
>> code depend on having the JS view server available but you could ixnay
>> that pretty easily by giving it an Erlang implementation. Its a pretty
>> simple view IIRC.
>>
>> For build time dependencies, I don't foresee removing them. Though I
>> could be convinced if the patch to the build system isn't overly
>> intrusive.
>>
>> > Any pointers to references, case studies, whatever is much appreciated!
>> >
>> > Regards,
>> > ZoltAn.
>>
>> I've heard of people running as a subordinate in a VM but have no
>> direct experience myself. As I recall they basically built CouchDB and
>> then installed into their Erlang package for distribution. Or some
>> such. It  may take a bit of effort as its not use case that's had lots
>> of patches submitted.
>>
>> HTH,
>> Paul Davis
>>
>
>

Re: Erlang-only CouchDB

Posted by Senthilkumar Peelikkampatti <se...@gmail.com>.
I fixed hovercraft and it is now sync up date with latest couchdb 0.11xxx.
My fork is @ http://github.com/sendtopms/hovercraft


On Wed, Oct 28, 2009 at 3:20 PM, Paul Davis <pa...@gmail.com>wrote:

> Zoltan, (Got the A right!)
>
> On Wed, Oct 28, 2009 at 4:06 PM, Zoltan Lajos Kis <ki...@tmit.bme.hu>
> wrote:
> > Hello all,
> >
> > Has anyone been experimenting with running CouchDB as an Erlang only
> > application? What I would love to have is:
> > - stick CouchDB into my lib/ directory, and have it run as part of my
> > release (everything running in a single Erlang VM).
>
> We've done some work to make CouchDB startable via application:start()
> as per Erlang semantics. This should work in theory but there still
> might be gotchyas with the base install. I know people have
> successfully run it as a dependent app though.
>
> > - use Erlang views only (is erlview running within the same VM? is it
> > up-to-date with CouchDB features?)
>
> Native Erlang views can be enabled with a config option. They're in
> trunk now and will remain consistent with the JavaScript server
> implementation.
>
> > - access CouchDB via an Erlang interface (is hovercraft still running?
> does
> > it support all features available via http?)
>
> Not sure if Hovercraft is up to date with trunk. I think I heard
> someone on IRC say there was a minor version difference that was minor
> to resolve.
>
> > - no dependency on ICU, curl and SpiderMonkey (as I would not need them
> for
> > anything)
>
> To remove the ICU dependency you'll have to patch CouchDB because its
> a linked in driver that's required for collation regardless of view
> server.
>
> Curl and Spidermonkey could be removed as install time dependencies
> fairly easily by discarding couchjs after a build and updating the
> configuration to not attempt to use it. I think some parts of the auth
> code depend on having the JS view server available but you could ixnay
> that pretty easily by giving it an Erlang implementation. Its a pretty
> simple view IIRC.
>
> For build time dependencies, I don't foresee removing them. Though I
> could be convinced if the patch to the build system isn't overly
> intrusive.
>
> > Any pointers to references, case studies, whatever is much appreciated!
> >
> > Regards,
> > ZoltAn.
>
> I've heard of people running as a subordinate in a VM but have no
> direct experience myself. As I recall they basically built CouchDB and
> then installed into their Erlang package for distribution. Or some
> such. It  may take a bit of effort as its not use case that's had lots
> of patches submitted.
>
> HTH,
> Paul Davis
>

Re: Erlang-only CouchDB

Posted by Paul Davis <pa...@gmail.com>.
Zoltan, (Got the A right!)

On Wed, Oct 28, 2009 at 4:06 PM, Zoltan Lajos Kis <ki...@tmit.bme.hu> wrote:
> Hello all,
>
> Has anyone been experimenting with running CouchDB as an Erlang only
> application? What I would love to have is:
> - stick CouchDB into my lib/ directory, and have it run as part of my
> release (everything running in a single Erlang VM).

We've done some work to make CouchDB startable via application:start()
as per Erlang semantics. This should work in theory but there still
might be gotchyas with the base install. I know people have
successfully run it as a dependent app though.

> - use Erlang views only (is erlview running within the same VM? is it
> up-to-date with CouchDB features?)

Native Erlang views can be enabled with a config option. They're in
trunk now and will remain consistent with the JavaScript server
implementation.

> - access CouchDB via an Erlang interface (is hovercraft still running? does
> it support all features available via http?)

Not sure if Hovercraft is up to date with trunk. I think I heard
someone on IRC say there was a minor version difference that was minor
to resolve.

> - no dependency on ICU, curl and SpiderMonkey (as I would not need them for
> anything)

To remove the ICU dependency you'll have to patch CouchDB because its
a linked in driver that's required for collation regardless of view
server.

Curl and Spidermonkey could be removed as install time dependencies
fairly easily by discarding couchjs after a build and updating the
configuration to not attempt to use it. I think some parts of the auth
code depend on having the JS view server available but you could ixnay
that pretty easily by giving it an Erlang implementation. Its a pretty
simple view IIRC.

For build time dependencies, I don't foresee removing them. Though I
could be convinced if the patch to the build system isn't overly
intrusive.

> Any pointers to references, case studies, whatever is much appreciated!
>
> Regards,
> ZoltAn.

I've heard of people running as a subordinate in a VM but have no
direct experience myself. As I recall they basically built CouchDB and
then installed into their Erlang package for distribution. Or some
such. It  may take a bit of effort as its not use case that's had lots
of patches submitted.

HTH,
Paul Davis