Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

java connnect problem

6 replies [Last post]
  • Login or register to post comments
Thu, 12/20/2012 - 20:15
kenhome
Offline
Joined: 12/20/2012
Groups: None

Hi All,
I am a new user who just learn couchbase recently, today when i install 2.0 in my centos5.8(1386) (VMware) ,i find the ip is already bound(0.0.0.0:8091) and this cause connect timed out in my java environment(win7,the main system) , how can i solve this problem?
regards,
kenhome

Top
  • Login or register to post comments
Thu, 12/20/2012 - 23:31
tgrall
Offline
Joined: 09/05/2012
Groups: None

Hello,

Do you know which process is running on port 8091?

What do you see when you try to access this port? (browser, telnet, ...)

So if you cannot find or use another port of you process, you can change the port of Couchbase Server using the Command Line Interface

I invite you to look at the following documentation:
http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-admin-cmdli...

Look at the "cluster-init" command.

Regards
Tug

__________________

Tug
@tgrall

Top
  • Login or register to post comments
Sun, 12/23/2012 - 07:04
kenhome
Offline
Joined: 12/20/2012
Groups: None

Hello,
Thanks a lot.
I can connect on the port 8091 this time,but i meet another question:

2012-12-23 21:56:32.038 INFO com.couchbase.client.CouchbaseConnection: Added {QA sa=/192.168.255.128:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2012-12-23 21:56:53.352 INFO com.couchbase.client.CouchbaseConnection: Connection state changed for sun.nio.ch.SelectionKeyImpl@9ebcd0
2012-12-23 21:56:53.353 INFO com.couchbase.client.CouchbaseConnection: Reconnecting due to failure to connect to {QA sa=192.168.255.128/192.168.255.128:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0}
java.net.ConnectException: Connection timed out: no further information

What's the wrong with it?
Regards,
kenhome

Top
  • Login or register to post comments
Sun, 12/23/2012 - 09:52
daschl
Offline
Joined: 05/19/2012
Groups: None

This may be because you're using java 1.7. If so, please downgrade to 1.6!

Also, can you please post your complete bootstrap code so we can examine it? Thanks!

Top
  • Login or register to post comments
Mon, 12/24/2012 - 06:06
kenhome
Offline
Joined: 12/20/2012
Groups: None

Thank daschl for solving my question, program running normal at 1.6!
However,it seems to run a little slowly on my computer.
Here is my source code:

public static void main(String[] args) {
ArrayList nodes = new ArrayList();
// Add one or more nodes of your cluster (exchange the IP with yours)
nodes.add(URI.create("http://192.168.255.128:8091/pools"));
// Try to connect to the client
CouchbaseClient client = null;
try {
client = new CouchbaseClient(nodes, "default", "");
} catch (Exception e) {
System.err.println("Error connecting to Couchbase: " + e.getMessage());
System.exit(1);
}
// Set your first document with a key of "hello" and a value of "couchbase!"
int timeout = 0; // 0 means store forever
client.set("hello", timeout, "couchbase!");
// Return the result and cast it to string
String result = (String)client.get("hello");
System.out.println(result);
// Shutdown the client
client.shutdown();
}

And this is the Result on the console:

2012-12-24 21:04:27.976 INFO com.couchbase.client.CouchbaseConnection: Added {QA sa=/192.168.255.128:11210, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
2012-12-24 21:04:49.289 INFO com.couchbase.client.CouchbaseConnection: Connection state changed for sun.nio.ch.SelectionKeyImpl@9ebcd0
2012-12-24 21:05:10.637 INFO com.couchbase.client.ViewConnection: Added 192.168.255.128 to connect queue
2012-12-24 21:05:10.641 INFO com.couchbase.client.CouchbaseClient: viewmode property isn't defined. Setting viewmode to production mode
couchbase!
2012-12-24 21:05:11.071 INFO com.couchbase.client.CouchbaseConnection: Shut down Couchbase client
2012-12-24 21:05:11.080 INFO com.couchbase.client.ViewConnection: Node 192.168.255.128 has no ops in the queue
2012-12-24 21:05:11.082 INFO com.couchbase.client.ViewNode: I/O reactor terminated for 192.168.255.128

Top
  • Login or register to post comments
Mon, 12/24/2012 - 07:50
daschl
Offline
Joined: 05/19/2012
Groups: None

From the logs, this looks absolutely correct. Keep in mind that connecting takes time, so do it only once if possible and reuse it! (maybe through a singleton).

What kind of performance problems do you experience?

Top
  • Login or register to post comments
Mon, 12/24/2012 - 08:46
kenhome
Offline
Joined: 12/20/2012
Groups: None

may be i install it on the main system(win7) and the couchbase version was 1.8 two weeks ago,haha...
Like you say,connecting takes time, I don't have any problem anymore at this point.
It's so kind of you,Thanks again!

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker