Skip to content
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

[Bug] Session storage does not work with Redis #8183

Closed
halcyonardency opened this issue Apr 21, 2017 · 3 comments
Closed

[Bug] Session storage does not work with Redis #8183

halcyonardency opened this issue Apr 21, 2017 · 3 comments

Comments

@halcyonardency
Copy link

Please include this information:

  • What Grafana version are you using?
    grafana-4.2.0-1.x86_64
  • What datasource are you using?
    graphite
  • What OS are you running grafana on?
    CentOS 7-latest
  • What did you do?
    Set redis up as a session cache
  • What was the expected result?
    Sessions should sustain
  • What happened instead?
    Session expire after a few seconds

relevant grafana ini:

[session]
provider = redis
provider_config = addr=1.2.3.4:5000,pool_size=100,password=SECRETS

relevant haproxy config in front of redis:

defaults REDIS
    mode tcp
    timeout connect 3s
    timeout server 6s
    timeout client 6s

frontend front_redis
    bind *:5000 name redis
    tcp-request inspect-delay 100ms
    acl site_dead nbsrv(back_redis) lt 1
    tcp-request connection reject if site_dead
    default_backend back_redis

backend back_redis
    option tcp-check
    tcp-check connect
    tcp-check send AUTH\ SECRETS\r\n
    tcp-check expect string +OK
    tcp-check send PING\r\n
    tcp-check expect string +PONG
    tcp-check send info\ replication\r\n
    tcp-check expect string role:master
    tcp-check send QUIT\r\n
    tcp-check expect string +OK
    server redis_6379 1.2.3.1:6379 check inter 1s
    server redis_6379 1.2.3.2:6379 check inter 1s

I suspect that Grafana expects a forever open connection to redis.. as the redis connection expires after 5-6 seconds of inactivity, Grafana doesn't handle this gracefully, expires the session, reconnects, and creates a new session. This is filling redis with several abandoned sessions. If i constantly refresh my Grafana browser, I stay logged in. If I wait 10 seconds and then refresh grafana, my session is expired (and I am logged out again). As a note, I am also using ldap for authentication which is why maintaining session state is important.

@torkelo
Copy link
Member

torkelo commented Apr 21, 2017

yes, look like it does not support redis proxies that closes the connection.

Will close this issue as we are working on removing the need for a backend session store:
#7741

Hopefully available in next v4.3 or v4.4

@torkelo torkelo closed this as completed Apr 21, 2017
@halcyonardency
Copy link
Author

halcyonardency commented Apr 21, 2017

I am attempting to set up a cluster of grafana servers -- in the mean time, is there a work around so my users don't keep getting logged out (other than going to a single grafana server or having connections never expire)?

@torkelo
Copy link
Member

torkelo commented Apr 21, 2017

is there a way to not have the redis haproxy close connections? other option is to switch to mysql or postgres session storeage (depending on what you use for main db)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants