Created
January 24, 2015 00:25
-
-
Save clly/7dac181f85c12fbd9b7d to your computer and use it in GitHub Desktop.
Cassandra healthcheck
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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