-
Notifications
You must be signed in to change notification settings - Fork 583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to create a password protected influxDB #201
Comments
Hi, Please see This Project is Dormant – explains why all the IOTstack activity is occuring at SensorsIot/IOTstack. If I understand what you are saying, you are expecting a Dockerfile ENV variable to wind up in influxdb.conf. I could be wrong but I really don't think environment variables work that way, irrespective of the context. In the case of a Dockerfile
More generally, if you set an environment variable in either of the following:
those still don't wind up in influxdb.conf. Variables set that way are just "available" to processes inside the container as they are launched. The process still has to check. Hold that thought. I'll come back to it. On the topic of timezones, I have had zero luck getting Influx to respect a timezone set globally.
Here is what I do. Step 1 is an alias defined in
With that in place, I can get into the Influx CLI just by typing
One of the measurements in the "power" database is called "hiking" (the name of the electricity meter). It is logging grid voltage every 10 seconds. Assume my time is 09:40 on Sept 17 2020, and my time-zone is UTC+10. If I query like this:
I get an empty result set - because 09:40 at UTC+0 is 19:40 UTC+10 and hasn't happened yet. If I set the time-zone offset to UTC+10 in the query:
I get a result but the timestamp in the
When I examine the log from the influxdb container via:
I see queries like the one below coming from Grafana. If I copy-and-paste the query:
it seems to me that Grafana is getting back UTC+0. It draws charts in local time so it must be doing that conversion work itself. Unlike the InfluxDB environment file, the Grafana environment file does contain a TZ:
but I have not experimented to see whether that is what Grafana actually respects, or if it is getting the information from the browser. Returning to the topic of InfluxDB environment variables, back in June I did a bit of a deep dive into the topic of which environment variables "worked" (appeared to have an effect) versus those that didn't. I had intended to work towards a PR to document some how-to but got side-tracked onto other things. Where I got to was this. First, you'd need to go into Influx and either
Then you define an administrative user:
plus some garden-variety users:
then set up the access rights:
Next, you drop out of the influx CLI (either Ctrl+D or
and then you put it all into effect by "upping" the stack.
Now, look at what happens if I try to access two different databases (the example "mydatabase" and a pre-existing "power" database):
Summary:
Some inferences I take from all this (which are probably fully documented somewhere in the InfluxDB doco):
With security enabled, there are a couple of ways of speeding-up your daily activities. You can pass the dba username and password on the end of the influx alias:
or you can set two more environment variables:
Those two variables are not some kind of general-access credentials that apply to everything. They are synonyms for the
or by starting a shell into the InfluxDB container and then invoking the CLI from there:
Whatever your approach, those username and password environment variables only apply to starting the CLI. I hope this helps. |
@WaleedNaveed I just wrote a gist that includes all of the above. If your question has been answered I'd appreciate it if you could remember to close this issue. |
I am working on a C# application with InfluxDB and Grafana. I am using InfluxData.Net (https://github.com/pootzko/InfluxData.Net#createdatabaseasync). I have to create a password protected Influx database. My code is:
Issue is that when i go to Grafana on the server and add new data source with this database, data source works fine and does not show any error regarding username/password. Even the data in the database is shown in the grafana. I am using InfluxDB image. I have also tried to enable INFLUXDB_HTTP_AUTH_ENABLED in DockerFile of InfluxDB. My DockerFile is:
When i run the image created from this DockerFile, i don't get INFLUXDB_HTTP_AUTH_ENABLED entry in influxdb.conf file. As per InfluxDB documentation, setting INFLUXDB_HTTP_AUTH_ENABLED in environment variable will enable the authentication on the influx server but, in my case its not working.
How can i make a password protected influx database through influxDB image ? What can be the possible issue ? I am stuck and unable to create the password protected database. Any help would be much appreciated.
The text was updated successfully, but these errors were encountered: