Friday 27 July 2012

CouchBase: Permission denied

It's 1400hrs, I have an hour or so to kill, so I going take some blog notes as I play with CouchBase. I must be having one of the those weeks where nothing is going to go well; thankfully we're almost at the end of the week.

I'm finally up and running with an instance of CouchBase (though I had to change OS and grab the latest build), and I can see buckets and documents.  Yay!  The next logical step for me is to connect programmatically, and maybe create a prototype app.

Let's watch the video as it will only take 5 minutes. I love the fact this it titled "Get Started in 5 Minutes" but the video is 11 minutes long...

To save you some time, download the driver and add it to your classpath; saved you 10 minutes and 32 seconds.

I believe a 'Hello, World!' program should demonstrate the simplest thing possible, so I just wanted to connect to the instance.

public static void main(String args[]) 
 throws Exception {

 URI server = new URI("http://192.168.0.8:8091/pools");
 ArrayList servers = new ArrayList();
 servers.add(server);
        
 CouchbaseClient client = new CouchbaseClient(servers, "default", "");
}



It looks to be failing due to a "Permission denied" exception.  FFS!  I'm starting to get slightly miffed. Running a quick wget indicates there should be no such permission issues.



Ah, ha!  Fortunately I've seen this before, it just took me moment for the old brain cells to remember. To fix the issue you need to add the follow as a VM param:
-Djava.net.preferIPv4Stack=true

Now that I can finally connect, let's get the KVPs from a bucket.   It looks like TAP is the way to go.

TapClient tc = new TapClient(servers, "default", "");
tc.tapDump("some id here");

tapDump returns a TapStream, but I can't find the TapStream dependency. This dude managed to find it, but looks like he may have other issues.

I'm getting bored, and my head is getting sore with all this brick wall hitting.  I know it's early, but I fancy a nice cold Never Mind The Anabolics, it's in a bottle so I don't have to worry about tap streams...

Oh, and it looks like my issue with installing on Win7 64-bit has been around a while.

4 comments:

  1. Sounds like agony. If you want to experience a truly brilliant example of downloading, installing and getting started check out http://www.elasticsearch.org/.

    ReplyDelete
    Replies
    1. I'm going to give elasticsearch the 5 minute test on Monday morning. I'm thinking I should have called this blog, "Jan and his 5 minutes worth of patience", or "Gone in 300 seconds".

      Delete
  2. Hi, I'm the "dude" you reference. Sorry for the IPv6 issue. We weren't aware of that, but I'll make sure we get it fixed. Please feel free to raise issues on couchbase.com/issues too.

    To be fair about the video, it's introducing, talking through the client library, the process, and then showing doing it. Then he goes a few steps further, covering docs at the end. I bet if I timed just the actions, it's less than 5 minutes.

    Regarding TAP, as you probably noted from it's documentation, it's currently an experimental feature. We track the groups and forums, help people out where needed though it's still evolving a bit.

    It is true that the Win7 64-bit installation issue has been around a while. It's a bit of a bug in InstallShield which requires extra work on our part to make sure there isn't a conflict when installing a C++ redistributable that we depend upon. In the runup to beta here, I expect we'll get that addressed as well. As we get closer to beta, the bugs we fix are the smaller ones or ones for which a workaround exists-- like this. I'm sure you know what I mean.

    ReplyDelete
    Replies
    1. Hi ingenthr, aka Dude (-;

      The IPv6 issue is not your fault - I think the blame falls squarely with Oracle for that one.

      I'm cool with the video being 11 minutes, I'm just not very patient tbh. When it comes to quick start installation guides, I like just the facts I need to get going.

      TAP => Noted, experimental.

      I hear you with the minor bugs, it's a familiar pattern.

      This all started because we had Perry in the office on Wednesday stressing the "SIMPLE" part of the Couchbase tagline. I love simple, simple is one of my favourite words. I'm already a bit of a MongoDB user, which really is simple. I just wanted to compare their relative simplicity in terms of getting up and running with a dev environment (on various OS) from a standing start. With MongoDB, you can get there in 5 minutes. With Couchbase, I played for an hour yesterday and an hour today.

      Delete