[BUG] Session with postgreSQL backend #7216

Open
druuhl opened this Issue Jan 11, 2017 · 5 comments

Projects

None yet

3 participants

@druuhl
druuhl commented Jan 11, 2017 edited

Session with postgreSQL backend doesnt work

Version grafana_4.1.0-1482230757beta1
Backend for configuration and sessions PostgreSQL psql (9.4.7, Server 9.4.4)
Running on Debian Jessie

I tried to configure Sessions with PostgreSQL Backend and created the table session, examples only for MySQL available

`CREATE TABLE session (
    key       CHAR(16) NOT NULL,
    data      bytea,
    expiry    numeric(11)  NOT NULL,
    PRIMARY KEY (key)
);`

configured the in the grafana.ini

[session]
provider = postgres
provider_config = user=DBUSER password=XXXX  host=DBHOST port=5432 
dbname=grafanadev1 sslmode=disabled
cookie_name = grafana_sess
#cookie secure = false only with http, with ssl it has be true
cookie_secure = false
session_life_time = 86400`

The Backend SQL works for configuration

my log after restart grafana-server

t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="alter dashboard_snapshot to mediumtext v2"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="create quota table v1"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="create index UQE_quota_org_id_user_id_target - v1"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="create plugin_setting table"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="create index UQE_plugin_setting_org_id_plugin_id - v1"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="Add column plugin_version to plugin_settings"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="create session table"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="Drop old table playlist table"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="Drop old table playlist_item table"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="create playlist table v2"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="create playlist item table v2"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="drop preferences table v2"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="drop preferences table v3"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="create preferences table v3"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="create alert table v1"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="add index alert org_id & id "
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="add index alert state"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="add index alert dashboard_id"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="create alert_notification table v1"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="Add column is_default"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="add index alert_notification org_id & name"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="Drop old annotation table v4"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="create annotation table v5"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="add index annotation 0 v3"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="add index annotation 1 v3"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="add index annotation 2 v3"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="add index annotation 3 v3"
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Skipping migration: Already executed" logger=migrator id="add index annotation 4 v3"
t=2017-01-11T10:27:43+0100 lvl=info msg="Starting plugin search" logger=plugins
t=2017-01-11T10:27:43+0100 lvl=dbug msg="Checking for updates"
t=2017-01-11T10:27:43+0100 lvl=info msg="Initializing CleanUpService" logger=cleanup
t=2017-01-11T10:27:43+0100 lvl=info msg="Initializing Alerting" logger=alerting.engine

After removing the session config parts, grafana works

@torkelo torkelo added the type: bug label Jan 11, 2017
@torkelo torkelo added this to the 4.2.0 milestone Jan 11, 2017
@torkelo
Member
torkelo commented Jan 11, 2017

we will try to replicate and test this soon

@bergquist bergquist self-assigned this Jan 11, 2017
@bergquist
Contributor
bergquist commented Jan 12, 2017 edited

I cannot reproduce this.

Are you using the same postgres server and database as main grafana database and session database?

Do you get any error in the console when trying to browse grafana while using postgres as session storage?

@torkelo
Member
torkelo commented Jan 12, 2017 edited

@bergquist not if the migration has already run, you need to remove the migration log entry as well if you want the migration engine to recreate it

@druuhl
druuhl commented Jan 13, 2017

@bergquist yes the same RDBMS / Database for grafana main DB and session, session is only one table.

When i restart the grafana-server, i have this in the grafana.log

t=2017-01-13T06:21:00+0100 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account to org"
t=2017-01-13T06:21:00+0100 lvl=info msg="Executing migration" logger=migrator id="copy data account_user to org_user"
t=2017-01-13T06:21:00+0100 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account_user to org_user"
t=2017-01-13T06:21:00+0100 lvl=info msg="Starting plugin search" logger=plugins
t=2017-01-13T06:21:00+0100 lvl=info msg="Initializing Alerting" logger=alerting.engine
t=2017-01-13T06:21:00+0100 lvl=info msg="Initializing CleanUpService" logger=cleanup
t=2017-01-13T06:21:00+0100 lvl=info msg="Starting Grafana" logger=main version=4.1.0-beta1 commit=v4.1.0-beta1 compiled=2016-12-20T11:25:58+0100
t=2017-01-13T06:21:00+0100 lvl=info msg="Config loaded from" logger=settings file=/usr/share/grafana/conf/defaults.ini
t=2017-01-13T06:21:00+0100 lvl=info msg="Config loaded from" logger=settings file=/etc/grafana/grafana.ini
t=2017-01-13T06:21:00+0100 lvl=info msg="Config overriden from command line" logger=settings arg="default.paths.data=/var/lib/grafana"
t=2017-01-13T06:21:00+0100 lvl=info msg="Config overriden from command line" logger=settings arg="default.paths.logs=/var/log/grafana"
t=2017-01-13T06:21:00+0100 lvl=info msg="Config overriden from command line" logger=settings arg="default.paths.plugins=/var/lib/grafana/plugins"
t=2017-01-13T06:21:00+0100 lvl=info msg="Path Home" logger=settings path=/usr/share/grafana
t=2017-01-13T06:21:00+0100 lvl=info msg="Path Data" logger=settings path=/var/lib/grafana
t=2017-01-13T06:21:00+0100 lvl=info msg="Path Logs" logger=settings path=/var/log/grafana
t=2017-01-13T06:21:00+0100 lvl=info msg="Path Plugins" logger=settings path=/var/lib/grafana/plugins
t=2017-01-13T06:21:00+0100 lvl=info msg="Initializing DB" logger=sqlstore dbtype=postgres
t=2017-01-13T06:21:00+0100 lvl=info msg="Starting DB migration" logger=migrator
t=2017-01-13T06:21:00+0100 lvl=info msg="Executing migration" logger=migrator id="copy data account to org"
t=2017-01-13T06:21:00+0100 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account to org"
t=2017-01-13T06:21:00+0100 lvl=info msg="Executing migration" logger=migrator id="copy data account_user to org_user"
t=2017-01-13T06:21:00+0100 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account_user to org_user"
t=2017-01-13T06:21:00+0100 lvl=info msg="Starting plugin search" logger=plugins
t=2017-01-13T06:21:00+0100 lvl=info msg="Initializing Alerting" logger=alerting.engine
t=2017-01-13T06:21:00+0100 lvl=info msg="Initializing CleanUpService" logger=cleanup
t=2017-01-13T06:21:00+0100 lvl=info msg="Starting Grafana" logger=main version=4.1.0-beta1 commit=v4.1.0-beta1 compiled=2016-12-20T11:25:58+0100
t=2017-01-13T06:21:00+0100 lvl=info msg="Config loaded from" logger=settings file=/usr/share/grafana/conf/defaults.ini
t=2017-01-13T06:21:00+0100 lvl=info msg="Config loaded from" logger=settings file=/etc/grafana/grafana.ini
t=2017-01-13T06:21:00+0100 lvl=info msg="Config overriden from command line" logger=settings arg="default.paths.data=/var/lib/grafana"
t=2017-01-13T06:21:00+0100 lvl=info msg="Config overriden from command line" logger=settings arg="default.paths.logs=/var/log/grafana"
t=2017-01-13T06:21:00+0100 lvl=info msg="Config overriden from command line" logger=settings arg="default.paths.plugins=/var/lib/grafana/plugins"
t=2017-01-13T06:21:00+0100 lvl=info msg="Path Home" logger=settings path=/usr/share/grafana
t=2017-01-13T06:21:00+0100 lvl=info msg="Path Data" logger=settings path=/var/lib/grafana
t=2017-01-13T06:21:00+0100 lvl=info msg="Path Logs" logger=settings path=/var/log/grafana
t=2017-01-13T06:21:00+0100 lvl=info msg="Path Plugins" logger=settings path=/var/lib/grafana/plugins
t=2017-01-13T06:21:00+0100 lvl=info msg="Initializing DB" logger=sqlstore dbtype=postgres
t=2017-01-13T06:21:00+0100 lvl=info msg="Starting DB migration" logger=migrator
t=2017-01-13T06:21:00+0100 lvl=info msg="Executing migration" logger=migrator id="copy data account to org"
t=2017-01-13T06:21:00+0100 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account to org"
t=2017-01-13T06:21:00+0100 lvl=info msg="Executing migration" logger=migrator id="copy data account_user to org_user"
t=2017-01-13T06:21:00+0100 lvl=info msg="Skipping migration condition not fulfilled" logger=migrator id="copy data account_user to org_user"
t=2017-01-13T06:21:00+0100 lvl=info msg="Starting plugin search" logger=plugins
t=2017-01-13T06:21:00+0100 lvl=info msg="Initializing CleanUpService" logger=cleanup
t=2017-01-13T06:21:00+0100 lvl=info msg="Initializing Alerting" logger=alerting.engine

but no other information, because grafana isnt started, telnet shows me a connection refused

@druuhl
druuhl commented Jan 24, 2017

@bergquist, if its work for you, pls provide the SQL for the session table, including grants if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment