I just getting started with Couchbase in Go, using the library gocb.
Just as a proof of concept trying to query my server for a specific ID and get a result. Here is a modified code sample below.
cOpts := gocb.ClusterOptions{
Authenticator: gocb.PasswordAuthenticator{
Username: "user",
Password: "pw",
},
}
cluster, err := gocb.Connect("couchbase://my.dev.server.net/", cOpts)
if err != nil {
panic(err)
}
qOpts := gocb.QueryOptions{}
// create query
queryStr := "SELECT * FROM myBucket WHERE id = '123456789'"
rows, err := cluster.Query(queryStr, &qOpts)
if err != nil {
panic(err)
}
fmt.Printf("rows: %v\n", rows)
for rows.Next() {
var intfc interface{}
err = rows.Row(&intfc)
if err != nil {
panic(err)
}
fmt.Printf("interface result: %v\n", intfc)
}
The couchbase server is on 5.1.
I am either getting...
panic: ambiguous timeout | {"statement":"SELECT * FROM myBucketName WHERE id = '123456789'","client_context_id":"cdd52a06-c7a5-4d3d-8r26-99fg806d559e"}
...when I run the above code.
OR
If I put in the following lines after the gocb.Connect(...
I get the error that is after that.
err = cluster.WaitUntilReady(25*time.Second, &gocb.WaitUntilReadyOptions{DesiredState: gocb.ClusterStateOnline})
if err != nil {
panic(err)
}
...error...
panic: unambiguous timeout | {"InnerError":{"InnerError":{"InnerError":{},"Message":"unambiguous timeout"}},"OperationID":"WaitUntilReady","Opaque":"","TimeObserved":25000263891,"RetryReasons":["NOT_READY"],"RetryAttempts":105,"LastDispatchedTo":"","LastDispatchedFrom":"","LastConnectionID":""}
NOTE: I changed the Username
, Password
, Server/connStr
, bucket
, and the id
just for example purposes here.
What am I missing here?