I’m getting a ERR_TOO_MANY_REDIRECTS error when accessing grafana via DNS. Grafana is running on docker swarm which is behind HAProxy. The HAProxy instance load balances among the swarm nodes. The root_url is set to http://dns:3000/ . I am using Redis as the session store via twemproxy. I verified that cookies were being created. However, accessing the login page works fine but when logging in, I get the error. I switched the session store to MySQL and I did not get the error anymore. I’d like to use redis but seems like I am forced to use MySQL.
This is my redis config :
–env ‘GF_SESSION_PROVIDER=redis’
–env ‘GF_SESSION_PROVIDER_CONFIG=addr=ip:port,pool_size=100,prefix=grafana,password=pass’
Any information would be appreciated. Thanks!
Really hard to say. Could it be something to do with the connection getting closed? See:
opened 06:34AM - 21 Apr 17 UTC
closed 06:37AM - 21 Apr 17 UTC
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.
I would concur on the redis bug. Had the same issue and switched to ‘memory’ and it started working…