Sessions configuration for postgresql

Hi,

I am using postgres and enable session and configure the postgres username and password, then i restart the service. But the service got failed. From the log i could not find much information. I m using postgres94 version.

FYI:-
t=2017-04-26T11:48:52+0800 lvl=info msg=“Starting Grafana” logger=main version=4.2.0 commit=349f3eb compiled=2017-03-22T18:06:41+0800
t=2017-04-26T11:48:52+0800 lvl=info msg=“Config loaded from” logger=settings file=/usr/share/grafana/conf/defaults.ini
t=2017-04-26T11:48:52+0800 lvl=info msg=“Config loaded from” logger=settings file=/etc/grafana/grafana.ini
t=2017-04-26T11:48:52+0800 lvl=info msg=“Config overriden from command line” logger=settings arg="default.paths.data=/var/lib/grafana"
t=2017-04-26T11:48:52+0800 lvl=info msg=“Config overriden from command line” logger=settings arg="default.paths.logs=/var/log/grafana"
t=2017-04-26T11:48:52+0800 lvl=info msg=“Config overriden from command line” logger=settings arg="default.paths.plugins=/var/lib/grafana/plugins"
t=2017-04-26T11:48:52+0800 lvl=info msg=“Path Home” logger=settings path=/usr/share/grafana
t=2017-04-26T11:48:52+0800 lvl=info msg=“Path Data” logger=settings path=/var/lib/grafana
t=2017-04-26T11:48:52+0800 lvl=info msg=“Path Logs” logger=settings path=/var/log/grafana
t=2017-04-26T11:48:52+0800 lvl=info msg=“Path Plugins” logger=settings path=/var/lib/grafana/plugins
t=2017-04-26T11:48:52+0800 lvl=info msg=“Initializing DB” logger=sqlstore dbtype=postgres
t=2017-04-26T11:48:52+0800 lvl=info msg=“Starting DB migration” logger=migrator
t=2017-04-26T11:48:52+0800 lvl=info msg=“Executing migration” logger=migrator id="copy data account to org"
t=2017-04-26T11:48:52+0800 lvl=info msg=“Skipping migration condition not fulfilled” logger=migrator id="copy data account to org"
t=2017-04-26T11:48:52+0800 lvl=info msg=“Executing migration” logger=migrator id="copy data account_user to org_user"
t=2017-04-26T11:48:52+0800 lvl=info msg=“Skipping migration condition not fulfilled” logger=migrator id="copy data account_user to org_user"
t=2017-04-26T11:48:52+0800 lvl=info msg=“Ldap enabled, reading config file” logger=ldap file=/etc/grafana/ldap.toml
t=2017-04-26T11:48:52+0800 lvl=info msg=“Starting plugin search” logger=plugins
t=2017-04-26T11:48:52+0800 lvl=info msg=“Registering plugin” logger=plugins name="Datatable Panel"
t=2017-04-26T11:48:52+0800 lvl=info msg=“Registering plugin” logger=plugins name="Pie Chart"
t=2017-04-26T11:48:52+0800 lvl=info msg=“Registering plugin” logger=plugins name=Splunk
t=2017-04-26T11:48:52+0800 lvl=info msg=“Registering plugin” logger=plugins name=Histogram
t=2017-04-26T11:48:52+0800 lvl=info msg=“Initializing Alerting” logger=alerting.engine
t=2017-04-26T11:48:52+0800 lvl=info msg=“Initializing CleanUpService” logger=cleanup

strange, no other reports on this failing.

Is your postgres connection details correct? Is Postgres up and running? If you wait a few minutes do you see anything else in log? (looks like it hanged)

Nope. i could not see any thing in the log

yes postgres db is running. if i remove the session configuration, i can restart grafana. i am suspecting to look for configuration. My sesssion configuration in this format. is there any thing wrong in my configuration.

FYI:-

postgres: user=**** password=***** host=127.0.0.1 port=5432 dbname=**** sslmode=disable

[session]
provider = postgres
provider_config = user=DBUSER password=XXXX  host=DBHOST port=5432 dbname=grafana sslmode=disabled

important that dbname=grafana (or the name of your grafana database)

Yes DB is correct. But whenever i restart the grafana service. i found this error in postgresql log.

FYI:-
< 2017-04-27 14:15:55.168 +08 >ERROR: relation “INFORMATION_SCHEMA.TABLES” does not exist at character 26
< 2017-04-27 14:15:55.168 +08 >STATEMENT: SELECT “TABLE_NAME” from “INFORMATION_SCHEMA”.“TABLES” WHERE “TABLE_SCHEMA”=$1 and “TABLE_NAME”=$2
< 2017-04-27 14:15:55.172 +08 >ERROR: relation “INFORMATION_SCHEMA.TABLES” does not exist at character 26
< 2017-04-27 14:15:55.172 +08 >STATEMENT: SELECT “TABLE_NAME” from “INFORMATION_SCHEMA”.“TABLES” WHERE “TABLE_SCHEMA”=$1 and “TABLE_NAME”=$2
< 2017-04-27 14:15:55.251 +08 >LOG: incomplete startup packet

that is strange, something wrong with your grafana db? Try removing the grafana db and recreate it, Grafana should recreate the schema

Even i m facing the same issues in new database as well.

what version of postgres are you using?

I m using postgresql9.4

I had this issue when I wrapped the username and password in quotes. I removed the quotes and everything worked as it should.

I have just run in to a similar issue where i could not connect to the database. I solved the issue by wrapping the whole config in “”“triple quotes”"" to treat it as literal and Grafana was able to start.