Intermittent connection issues with influx

Since using InfluxDB shell version: 1.7.8 I am seeing intermittent connection refused. How do I resolve the errors.
ERR: Post http://localhost:8086/query dial tcp connect: connection refused

Hello @bizomb,
Can you please share your request?
Thank you.

When running influx i get connection refused intermittently. It has been restarted and reinstalled but still occurs.