Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-66546

Add support to unix:// connections to redis caching/sessions.

XMLWordPrintable

    • MOODLE_38_STABLE
    • MOODLE_404_STABLE
    • Hide

      Having redis locally.

      Update redis config so it open a socket. To avoid permissions problems between web server user and redis sever user set full permissions to others.

      unixsocket /var/run/redis/redis-server.sock
      unixsocketperm 777

       

      Restart redis:

      /etc/init.d/redis-server restart

      Redis Cache

      Test config

      Config - Plugins -> Caching / Configuration /cache/admin.php

      Redis -> Add instance:
      1. Store name: some name
      2. Server: Path to redis socket as in redis config with schema prepended (unix:///var/run/redis/redis-server.sock)
      3. Click on the "Help" icon of the Server input.
      4. Verify that you will see content like redis_add_help.png
      5. Verify that clicking on the hyperlinks will open the documentation pages of Redis.
      6. Save changes

      Confirm that there is a green tick in the Ready column for the store.

      Now you can either map individual cache definitions of types Application and Session to your newly created Redis instance, or, at the bottom of the page:

      Stores used when no mapping is present -> Edit mappings:
      1. Change Application and/or Session to your newly created Redis instance
      2. Save changes

      Plugins -> Caching / Cache stores / Redis /admin/settings.php?section=cachestore_redis_settings

      1. Test server: the name you gave yo your Redis server instance
      2. Server: Path to redis socket as in redis config with schema prepended (unix:///var/run/redis/redis-server.sock)
      3. Verify that you will see content like redis_test_help.png right below the Server field.
      4. Verify that clicking on the hyperlinks will open the documentation pages of Redis.
      5. Save changes

      Test

      Confirm that site is functioning without cache errors.

      Plugins -> Caching / Test performance /cache/testperformance.php

      For all tests:
      Confirm that Result for Redis is Tested.

      Note: Redis cache doesn't support REQUEST mode.

      Plugins -> Caching / Cache usage /cache/usage.php

      For all tests:
      Confirm that Redis store is used, either for the individual mappings, or across the board for the Application and Session types.

      Redis Session

      config.php

      $CFG->session_handler_class = '\core\session\redis';
      $CFG->session_redis_host = '<Redis server socket with schema prepended from above>';$CFG->session_redis_port = 0; // Set 0 to force socket.
       

      Home page with debug panel at the bottom

      Confirm that Session is core\session\redis and that page opens without an error.

      Show
      Having redis locally. Update redis config so it open a socket. To avoid permissions problems between web server user and redis sever user set full permissions to others. unixsocket /var/run/redis/redis-server.sock unixsocketperm 777   Restart redis: /etc/init.d/redis-server restart Redis Cache Test config Config - Plugins -> Caching / Configuration /cache/admin.php Redis -> Add instance: Store name : some name Server : Path to redis socket as in redis config with schema prepended (unix:///var/run/redis/redis-server.sock) Click on the "Help" icon of the Server input. Verify that you will see content like redis_add_help.png Verify that clicking on the hyperlinks will open the documentation pages of Redis. Save changes Confirm that there is a green tick in the Ready column for the store. Now you can either map individual cache definitions of types Application and Session to your newly created Redis instance, or, at the bottom of the page: Stores used when no mapping is present -> Edit mappings: Change Application and/or Session to your newly created Redis instance Save changes Plugins -> Caching / Cache stores / Redis /admin/settings.php?section=cachestore_redis_settings Test server : the name you gave yo your Redis server instance Server : Path to redis socket as in redis config with schema prepended (unix:///var/run/redis/redis-server.sock) Verify that you will see content like redis_test_help.png right below the Server field. Verify that clicking on the hyperlinks will open the documentation pages of Redis. Save changes Test Confirm that site is functioning without cache errors. Plugins -> Caching / Test performance /cache/testperformance.php For all tests: Confirm that Result for Redis is Tested . Note: Redis cache doesn't support REQUEST mode. Plugins -> Caching / Cache usage /cache/usage.php For all tests: Confirm that Redis store is used, either for the individual mappings, or across the board for the Application and Session types. Redis Session config.php $CFG ->session_handler_class = '\core\session\redis' ; $CFG ->session_redis_host = '<Redis server socket with schema prepended from above>' ; $CFG ->session_redis_port = 0; // Set 0 to force socket. Home page with debug panel at the bottom Confirm that Session is core\session\redis and that page opens without an error.

      Issue created because @ MDL-66139 it was detected that our redis cache store does not support:

      • tls:// connections (existing in older versions). Provides encrypted connections.
      • unix:// connections (new since php-redis v5). Provides relative unix sockets.

      (ref: https://github.com/phpredis/phpredis#connect-open)

      So, this is about:

      1) consider if it's worth supporting them.
      2) implement them once agreed.

      Also, worth noting that the same connection options should be working for redis sessions (haven't verified if they are already supported or no).

      Ciao

            carreraj Juan Carrera
            stronk7 Eloy Lafuente (stronk7)
            Meirza Meirza
            Huong Nguyen Huong Nguyen
            Carlos Escobedo Carlos Escobedo
            Votes:
            4 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 7 hours
                7h

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.