Problems in minimal.c

I have met a problem just like follow:

create_options.version = 3;
create_options.v.v0.host = “119.254.108.46:8091”;
create_options.v.v0.user = “Administrator”;
create_options.v.v0.passwd = “******”;
create_options.v.v0.bucket = “Administrator”;

I wanna connect to 119.254.108.46:8091, it stop at “Will wait for storage operation to complete” all the time.
I doubt If the host field is signed incorrectly?
And what problems could make this?

Thanks!

  1. If you use version=3 then you should use the fields in v.v3 within the structure. The various v.vXXX are arranged as a union. The version field indicates which field is valid
  2. It appears you are trying to connect to the administrative interface. You would need to set the type field to LCB_TYPE_CLUSTER, and remove the bucket field.

For solutions:

  1. The host field is no longer present in the v3 struct; you should use the connstr field, in which case you would do http://119.254.108.46
  2. Do not use the bucket field

See http://docs.couchbase.com/sdk-api/couchbase-c-client-2.4.4/group__lcb-init.html#structlcb__create__st3 for the link to the creation structure.

Thanks for your patient answer.

Our sever version is 2.2.
Is that mean I should sign version = 2,and use the fields in v.v2 within the structure ?

And there are localhost IP and server IP, which IP I should sign connstr field?

And the Server IP port is 8091, the program just request port 11210, why?

example; the localhost is 119.254.108.181:8091, and the Server IP is 10.80.16.190:8091,which one is signed v.v3.connstr?
Is “couchbase://10.80.16.190:8091/default” right?

No, the version field in the struct has nothing to do with the server version. It simply indicates which form of the union to use within the structure. Thus for any number n, you would set version=n and then use the fields available in v.vn.

Secondly, the client will by default try to bootstrap from port 11210 and if that fails, will try port 8091. Why is it so important that you client must connect to 8091*? - simply do not specify a port number, and the client will do the correct thing in determining where to connect to;

putting it all together

struct lcb_create_st crst { 0 };
crst.version = 3;
crst.v.v3.connstr = "couchbase://10.80.16.190/default

*Note that if you specify port 8091, the client will ignore it and assume you have made a mistake and you don’t really want to only use port 8091, but rather just connect to whatever the default port is on that specified server.

I think too much so that I go a wrong way.
Turn out which caused my problem is that I can not connect 10.80.16.190.
I’m going to find another way to solve my problem.
Thank you one more time! :smile: