2015/03/03 22:43:27 connect: failed to connect to "127.0.0.1:9042": authentication required (using "org.apache.cassandra.auth.PasswordAuthenticator")
Session error no connections were made when creating the session
<nil>
panic: runtime error: invalid memory address or nil pointer dereference
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x78f63]
// test project main.go
package main
import (
"fmt"
"github.com/gocql/gocql"
)
func main() {
cluster := gocql.NewCluster("127.0.0.1")
cluster.Keyspace = "mykeyspace"
session, err := cluster.CreateSession()
fmt.Println("Session error ", err)
fmt.Println(session)
defer session.Close()
var user_name, address, city, password, phone, state, zip string
if err := session.Query("SELECT user_name, address, city, password, phone, state, zip FROM users").Scan(&user_name, &address, &city, &password, &phone, &state, &zip); err != nil {
fmt.Println("Err in query ", err)
}
fmt.Println(user_name, " ", address, " ", city)
}
I have also attached a part of the .yaml file
# - AllowAllAuthenticator performs no checks - set it to disable authentication.
# - PasswordAuthenticator relies on username/password pairs to authenticate
# users. It keeps usernames and hashed passwords in system_auth.credentials table.
# Please increase system_auth keyspace replication factor if you use this authenticator.
authenticator: PasswordAuthenticator
# Authorization backend, implementing IAuthorizer; used to limit access/provide permissions
# Out of the box, Cassandra provides org.apache.cassandra.auth.{AllowAllAuthorizer,
# CassandraAuthorizer}.
#
# - AllowAllAuthorizer allows any action to any user - set it to disable authorization.
# - CassandraAuthorizer stores permissions in system_auth.permissions table. Please
# increase system_auth keyspace replication factor if you use this authorizer.
authorizer: CassandraAuthorizer
thanks ....