influxdata / influx-stress

New tool for generating artificial load on InfluxDB
MIT License
121 stars 43 forks source link

URL string returned is invalid #30

Closed colorjiang closed 6 years ago

colorjiang commented 6 years ago

My influxdb and influx-stress are in different hosts. Command is: ./influx-stress insert cpu,cluster=xxx,dc=xxx,host=xxx,cpu=xxx --batch-size 10000 --host 192.168.12.5 --points 1 --pps 10000 --series 10000 --stats-host 192.168.12.5 --kapacitor true Test is failure, and error log is: no such host.

I modified writeURLFromConfig as following: func writeURLFromConfig(cfg ClientConfig) string { params := url.Values{} params.Set("db", cfg.Database) if cfg.User != "" { params.Set("u", cfg.User) } if cfg.Pass != "" { params.Set("p", cfg.Pass) } if cfg.RetentionPolicy != "" { params.Set("rp", cfg.RetentionPolicy) } if cfg.Precision != "n" && cfg.Precision != "" { params.Set("precision", cfg.Precision) } if cfg.Consistency != "one" && cfg.Consistency != "" { params.Set("consistency", cfg.Consistency) }

return "http://" + cfg.BaseURL + ":8086" + "/write?" + params.Encode()

} With new code, influx-stress runs ok.

https://github.com/influxdata/influx-stress/blob/5557223edf0fb7b4d3138279c348558e4f365c0b/write/client.go#L221

colorjiang commented 6 years ago

Not bug. The correct host parameter is: http://x.x.x.x:port.