Help connect to couchbase

i have this

package main

import (

"fmt"
//"github.com/golang/glog"
//"strconv"
"time"
"gopkg.in/couchbaselabs/gocb.v0"
//"github.com/couchbase/go-couchbase"

)

func main() {

callCouchbase("10.0.30.98:8092", "power", "d3v3nv" )

}

func callCouchbase(connection string, bucket string, password string) {
connection_string := “couchbase://” + connection
var err error
fmt.Println(“Opening connection to couchbase at: %s\n”, connection_string)

cluster, err = gocb.Connect(connection_string)
if(err != nil) {
	fmt.Println("Unable to make connection to Couchbase server...")
}
fmt.Println("Opening couchbase bucket: %s with password: %s", bucket, password)
Couchbase, err = cluster.OpenBucket(bucket, password)
if(err != nil) {
	panic(err)
} else {
	fmt.Println(err, "Connected...")
}

}

when i run it i get
Opening connection to couchbase at: %s
couchbase://10.0.30.98:8092
Opening couchbase bucket: %s with password: %s power d3v3nv
panic: Failed to connect to all specified hosts.

goroutine 1 [running]:
main.callCouchbase(0x7736d0, 0xf, 0x7846f0, 0xe, 0x769170, 0x6)
/root/go/src/test/test.go:47 +0x54c
main.main()
/root/go/src/test/test.go:27 +0x60

I am pulling my hair out . Thanks for the help.

Hey mshivakumar,

You are using the couchbase scheme along with a hard-coded port of 8092, however, 8092 is actually not a bootstrap port. Please try to use

callCouchbase("10.0.30.98:11210", "power", "d3v3nv" )

or simply:

callCouchbase("10.0.30.98", "power", "d3v3nv" )

Cheers, Brett

Hi,
it is a Empty bucket (power ) i created . I tried it with no port and with port 11210 and when i try to edit the bucket configuration i see Standard port (TCP port 11211. Needs SASL auth.) so i tried it with 11211 as well i still get the error Failed to connect to all specified hosts.
Just for fun i changed the passowrd to “somethingwrong”, as always it sits there and thinks for 2 mins and says Failed to connect to all specified hosts.does that say some thing.
Thanks for the help .

i trashed all the things i am doing on i just tried

package main

import (
github.com/couchbaselabs/gocb
)

func main() {
myCluster, _ := gocb.Connect(“couchbase://10.0.30.98”) // ip address where couch is installed
myBucket, _ := myCluster.OpenBucket(“beer-sample”, “d3v3nv”) // that is my pass

var beer map[string]interface{}
cas, _ := myBucket.Get(“aass_brewery-juleol”, &beer)

beer[“comment”] = “Random beer from Norway”

myBucket.Replace(“aass_brewery-juleol”, &beer, cas, 0)
}

when i run it i get

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x20 pc=0x44ee25]

goroutine 1 [running]:
github.com/couchbaselabs/gocb.func·004(0xc20803aae0, 0x0, 0x0, 0x0, 0x0)
/root/go/src/github.com/couchbaselabs/gocb/bucket_crud.go:99 +0x85
github.com/couchbaselabs/gocb.(*Bucket).hlpGetExec(0x0, 0x649f80, 0xc20802c018, 0xc20806bec8, 0x0, 0x0, 0x0)
/root/go/src/github.com/couchbaselabs/gocb/bucket_crud.go:24 +0x213
github.com/couchbaselabs/gocb.(*Bucket).Get(0x0, 0x76f9f0, 0x13, 0x649f80, 0xc20802c018, 0x0, 0x0, 0x0)
/root/go/src/github.com/couchbaselabs/gocb/bucket_crud.go:101 +0x7d
main.main()
/root/go/src/test2/test.go:12 +0xd6

the error is inline cas, _ := myBucket.Get(“aass_brewery-juleol”, &beer)

Thanks for your advice and help.

Hey , did you get the problem of Panic error resolved. Have same issue .

@chvck Hi ,
we hit the same issue with Panic Error and its very intermittent . We are on CB 6.5 Enterprise edition and thinking of to build application in Production but this gives us some less hope … what could be the error reason and its random …sometime it works for 2 people and sometime other 2 people gets error for EXACT same query . we have 4 node cluster and our bucket is 400K records only and cluster size is huge … any ideas ?