dynomite icon indicating copy to clipboard operation
dynomite copied to clipboard

Dynomite - Redis session for PHP

Open nicolacontu opened this issue 6 years ago • 5 comments

Hello, I am trying to use dynomite to geo replicate redis sessions.

These are the versions I am using :

[root@cmd-redis1 ~]# redis-cli --version
redis-cli 5.0.1
[root@cmd-redis1 ~]# dynomite --version
This is dynomite-v0.7.0-9-gaec7c38
[root@cmd-redis1 ~]# redis-server --version
Redis server v=5.0.1 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=cf1c54ca8dfae683

I have 6 nodes, 3 racks and 3 datacenters.

Here is the config I have for one node :

dyn_o_mite:
  datacenter: dc-nyh
  rack: rack1
  dyn_listen: 10.151.2.125:7379
  dyn_seeds:
  - 10.151.2.126:7380:rack1:dc-nyh:2147483647
  - 10.150.20.125:7379:rack1:dc-dfw:0
  - 10.150.20.126:7380:rack1:dc-dfw:2147483647
  - 10.160.65.125:7379:rack1:dc-lon:0
  - 10.160.65.126:7380:rack1:dc-lon:2147483647
  listen: 0.0.0.0:8379
  servers:
  - 10.151.2.125:6379:1
  tokens: '0'
  secure_server_option: datacenter
  pem_key_file: dynomite.pem
  data_store: 0
  stats_listen: 127.0.0.1:22222
  read_consistency : DC_QUORUM
  write_consistency : DC_QUORUM

In my php.ini I have

session.save_handler = redis
;session.save_handler = memcache
session.save_path = "tcp://10.151.2.125:8379,tcp://10.151.2.126:8379"

So in each webserver per DC I am pointing the local dynomite servers.

If I try to login to my I see this in the logs :

[2019-04-05 09:57:32.884] dnode_client_unref_internal_try_put:52 unref <CONN_LOCAL_PEER_CLIENT 0x19652d0 -1 from '10.151.2.89:35912'> owner 0x19370a0 from pool 'dyn_o_mite'
[2019-04-05 10:01:12.329] proxy_accept:203 <CONN_PROXY 0x1938510 7 listening on '0.0.0.0:8379'> accepted <CONN_CLIENT 0x19652d0 19 from '127.0.0.1:43704'>
[2019-04-05 10:01:12.329] redis_parse_req:1546 parsed unsupported command 'COMMAND'
[2019-04-05 10:01:12.330] redis_parse_req:2237 parsed bad req 4 res 1 type 0 state 5
00000000  2a 31 0d 0a 24 37 0d 0a  43 4f 4d 4d 41 4e 44 0d   |*1..$7..COMMAND.|
00000010  0a                                                 |.|
[2019-04-05 10:01:12.330] core_close:414 close <CONN_CLIENT 0x19652d0 19 from '127.0.0.1:43704'> on event 00FF eof 0 done 0 rb 17 sb 0: Invalid argument
[2019-04-05 10:01:12.330] client_unref_internal_try_put:94 <CONN_CLIENT 0x19652d0 -1 from '127.0.0.1:43704'> unref owner <POOL 0x19370a0 'dyn_o_mite'>
[2019-04-05 10:01:20.137] proxy_accept:203 <CONN_PROXY 0x1938510 7 listening on '0.0.0.0:8379'> accepted <CONN_CLIENT 0x19652d0 19 from '127.0.0.1:43706'>
[2019-04-05 10:01:20.137] redis_parse_req:1546 parsed unsupported command 'COMMAND'
[2019-04-05 10:01:20.137] redis_parse_req:2237 parsed bad req 5 res 1 type 0 state 5
00000000  2a 31 0d 0a 24 37 0d 0a  43 4f 4d 4d 41 4e 44 0d   |*1..$7..COMMAND.|
00000010  0a                                                 |.|
[2019-04-05 10:01:20.137] core_close:414 close <CONN_CLIENT 0x19652d0 19 from '127.0.0.1:43706'> on event 00FF eof 0 done 0 rb 17 sb 0: Invalid argument
[2019-04-05 10:01:20.137] client_unref_internal_try_put:94 <CONN_CLIENT 0x19652d0 -1 from '127.0.0.1:43706'> unref owner <POOL 0x19370a0 'dyn_o_mite'>

In PHP I have the redis pecl extension installed. PHP v 7.2.14

I don't see COMMAND as compatible with dynomite : https://github.com/Netflix/dynomite/blob/dev/notes/redis.md

I tried then to change redis-cli to 3.0.7 and I am not getting the error about COMMAND but I see this in the error_log on apache :

[Fri Apr 05 12:10:21.956763 2019] [php7:notice] [pid 150544:tid 140261963302656] [client 10.222.90.33:54926] PHP WARNING: session_regenerate_id(): Session object destruction failed. ID: redis (path: tcp://10.151.2.125:8379,tcp://10.151.2.126:8379) in /data/www/cmd/pages/login.page on line 188, referer: http://nyh-cmd2.stag.gt-t.net/

If I downgrade redis-server as well the error is :

[Fri Apr 05 13:18:12.043633 2019] [php7:notice] [pid 179837:tid 139654653261568] [client 10.222.90.33:56536] PHP WARNING: Unknown: Failed to write session data (redis). Please verify that the current setting of session.save_path is correct (tcp://10.151.2.125:8379) in Unknown on line 0, referer: http://nyh-cmd2.stag.gt-t.net/?!=intranet|home|view

Can anyone help me to understand what to set in the php.ini? Is there a workaround?

Thanks

nicolacontu avatar Apr 05 '19 10:04 nicolacontu

Correct, the log message parsed unsupported command 'COMMAND' indicates that Dynomite does not support this command.

Moreover, the problem above seems to be a mismatch of the port numbers. I think you are trying to access 8379 but you have set the dyn_listen as 7379.

ipapapa avatar Apr 24 '19 20:04 ipapapa

No i tried with both ports and it does not work. I guess it is just not compatible with redis 5 and php


Da: Ioannis Papapanagiotou [email protected] Inviato: mercoledì 24 aprile 2019 22:24 A: Netflix/dynomite Cc: nicolacontu; Author Oggetto: Re: [Netflix/dynomite] Dynomite - Redis session for PHP (#650)

Correct, the log message parsed unsupported command 'COMMAND' indicates that Dynomite does not support this command.

Moreover, the problem above seems to be a mismatch of the port numbers. I think you are trying to access 8379 but you have set the dyn_listen as 7379.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Netflix/dynomite/issues/650#issuecomment-486411405, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADCZTEPVYNUXPGHGN43MYALPSC6ZJANCNFSM4HD2PD2A.

nicolacontu avatar Apr 26 '19 13:04 nicolacontu

We use PHP 7 and Redis 3.2 OK, but only specify a single node on save_path. Does that work for you?

mcouillard avatar Jul 05 '19 18:07 mcouillard

Nope, also with a single node, it does not work.

Ottieni Outlook per Androidhttps://aka.ms/ghei36


From: Michael [email protected] Sent: Friday, July 5, 2019 8:57:54 PM To: Netflix/dynomite Cc: nicolacontu; Author Subject: Re: [Netflix/dynomite] Dynomite - Redis session for PHP (#650)

We use PHP 7 and Redis 3.2 OK, but only specify a single node on save_path. Does that work for you?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Netflix/dynomite/issues/650?email_source=notifications&email_token=ADCZTEJRPK3MBF3XNWGDUF3P56KTFA5CNFSM4HD2PD2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZKEOXQ#issuecomment-508839774, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADCZTELMI6NHN2PIBLJVIMTP56KTFANCNFSM4HD2PD2A.

nicolacontu avatar Jul 05 '19 19:07 nicolacontu

I have redis 5

Ottieni Outlook per Androidhttps://aka.ms/ghei36


From: Nicola Contu Sent: Friday, July 5, 2019 9:09:51 PM To: Netflix/dynomite; Netflix/dynomite Cc: Author Subject: Re: [Netflix/dynomite] Dynomite - Redis session for PHP (#650)

Nope, also with a single node, it does not work.

Ottieni Outlook per Androidhttps://aka.ms/ghei36


From: Michael [email protected] Sent: Friday, July 5, 2019 8:57:54 PM To: Netflix/dynomite Cc: nicolacontu; Author Subject: Re: [Netflix/dynomite] Dynomite - Redis session for PHP (#650)

We use PHP 7 and Redis 3.2 OK, but only specify a single node on save_path. Does that work for you?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Netflix/dynomite/issues/650?email_source=notifications&email_token=ADCZTEJRPK3MBF3XNWGDUF3P56KTFA5CNFSM4HD2PD2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZKEOXQ#issuecomment-508839774, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADCZTELMI6NHN2PIBLJVIMTP56KTFANCNFSM4HD2PD2A.

nicolacontu avatar Jul 05 '19 19:07 nicolacontu