Skip to content

Instantly share code, notes, and snippets.

@clly
Created January 24, 2015 00:25
Show Gist options
  • Save clly/7dac181f85c12fbd9b7d to your computer and use it in GitHub Desktop.
Save clly/7dac181f85c12fbd9b7d to your computer and use it in GitHub Desktop.
Cassandra healthcheck
// Author: Connor Kelly
import (
"fmt"
"log"
"github.com/gocql/gocql"
)
func main() {
cluster := gocql.NewCluster("127.0.0.1")
cluster.Keyspace = "example"
cluster.Consistency = gocql.Quorum
session, _ := cluster.CreateSession()
defer session.Close()
var date string
if err := session.Query(`SELECT now() FROM system.local`).Consistency(gocql.One).Scan(&date); err != nil {
log.Fatal(err)
}
fmt.Println("Date:", date)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment