Multiple instances of neos: Share sessions (and files)

I try to run Neos serving one site on two servers.
What is the recommended way to share backend sessions?
I tried Redis, but can not login to the backen even with just one server and its own Redis master. Neos talks to Redis, but login just stays at login screen.

Caches.yaml
Flow_Session_MetaData:
backend: Neos\Cache\Backend\RedisBackend
Flow_Session_Storage:
backend: Neos\Cache\Backend\RedisBackend

  1. which directories have to be shared (eg. by NFS-share) between both instances?

Redis should work, I think NFS share is a bad idea, if you have a big amount of sessions.

No error in your logs after a log in ?

No errors while trying to login.
system.log tells, that session is created and I recive the Cookie.

I found out, that Redis can not be used in Cluster Mode. Selecting the Database does not work in this case.

Is there an way to configure more than one Redis-Host? Neos should write all stuff to both Hosts.

Is there another way to share sessions without a single point of failure?

Currently not, you can only define a single hostname.

I never try to test Neos with a Redis cluster, what are the limitation exactly (only the select database issue, or more) ? And can we discover that Redis is in cluster mode ? With a bit more information, maybe I can prepare a PR to make the RedisBackend working with Redis in cluster mode.

Bests

There is a method \Neos\Cache\Backend\RedisBackend::getRedisClient, try to remove the line:

`$redis->select($this->database);

SELECT is not allowed in cluster mode. And test if there is other limitation.

SELECT 0
does work, so with default cache settings there is no error

the Problem seems to be
“SADD” “Flow_Session_MetaData:tag:drGfxZmTGSWMA8WIJn6iDmvcMHxfTsCx” “drGfxZmTGSWMA8WIJn6iDmvcMHxfTsCx”

In Normal Mode Redis justs adds. In Cluster Mode it tells the Apllication to follow to the corrent Node:
(error) MOVED 12892 192.168.169.62:6379

I think, the short answer is: It is no problem of Neos:

Thanks for your help

You could create MultiHostRedisBackend and share it with the community :slight_smile:

1 Like