I am running a simple query using Clickhouse HTTP Interface
package main
import (
"fmt"
"net/http"
"time"
)
func main() {
url := "http://localhost:8123" + "?query=select%201"
req, _ := http.NewRequest("Post", url, nil)
// set headers
req.Header.Set("X-ClickHouse-User", "user") //user
req.Header.Set("X-ClickHouse-Key", "password") //password
client := &http.Client{
Timeout: 5 * time.Second,
}
resp, err := client.Do(req)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println("Success")
}
}
It is giving me this error
Post "http://localhost:8123?query=select%201": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
Note: If I use insert query instead of this select query it will give me the same error but also will insert the data correctly.
Any help would be appreciated.
Thanks