Learn about Centmin Mod LEMP Stack today
Become a Member

Xenforo Making the best use of Redis for Xenforo 2?

Discussion in 'Forum software usage' started by Jon Snow, Feb 4, 2019.

  1. eva2000

    eva2000 Administrator Staff Member

    45,155
    10,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,919
    Local Time:
    1:53 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    did you try just restarting the other redis server instances ?

    I am not having any problems on my test Xenforo 2.1 install with redis on the custom redis server ports even after updating main redis from 5.0.9 to 6.0.1 while custom redis server ports run 5.0.9 binary. To update custom redis server 5.0.9 binary you would need to destroy and recreate the custom redis server instances using redis generator script.

    does redis runtime directory exist ?
    Code (Text):
    ls -lah /var/run/redis


    edit: something has changed in original redis service file and/or centos systemd as restarting redis original service will create /var/run/redis runtime directory but on starting redis6479 etc service will remove the /var/run/redis runtime directory or combined with Services using the "Type=Notify" and "NotifyAccess=All" settings are vulnerable to being inadvertently shut down by other services - Red Hat Customer Portal. Will have to investigate

    edit: Looks like Plesk users have same issue with distro provided redis 6 updated servers Question - Changes to use Redis 6.0 in Plesk

    For a temp workaround, you can downgrade back to redis 5.0.9 and version lock the package so yum updates do not update to redis 6 until you version unlock it
    Code (Text):
    yum -y downgrade redis --enablerepo=remi
    yum versionlock redis
    

    Code (Text):
    yum versionlock redis
    Loaded plugins: fastestmirror, priorities, versionlock
    Adding versionlock on: 0:redis-5.0.9-1.el7.remi
    versionlock added: 1
    

    I confirm additional redis servers start up fine when downgraded to redis 5.0.9
    when ready to update to redis 6 again, do version unlock and yum update
    Code (Text):
    yum versionlock delete redis
    yum -y update redis --enablerepo=remi

    Code (Text):
    yum versionlock delete redis
    Loaded plugins: fastestmirror, priorities, versionlock
    Deleting versionlock for: 0:redis-5.0.9-1.el7.remi.*
    versionlock deleted: 1
    


    edit: seems changing the systemd service file's Type from notify to forking in redis6479 and redis6480 service files seems to allow redis 6 to start up

    so for /usr/lib/systemd/system/redis6480.service
    Code (Text):
    [Unit]
    Description=Redis persistent key-value database
    After=network.target
    
    [Service]
    ExecStart=/etc/redis6480/redis-server /etc/redis6480/redis6480.conf --supervised systemd
    ExecStop=/usr/local/bin/redis6480-shutdown
    Type=forking
    User=redis
    Group=redis
    RuntimeDirectory=redis
    RuntimeDirectoryMode=0755
    
    [Install]
    WantedBy=multi-user.target

    then do
    Code (Text):
    systemctl daemon-reload
    service redis6480 restart
    


    you can do changes via sed replacement from command line too
    Code (Text):
    sed -i 's|Type=notify|Type=forking|' /usr/lib/systemd/system/redis6479.service
    sed -i 's|Type=notify|Type=forking|' /usr/lib/systemd/system/redis6480.service
    systemctl daemon-reload
    systemctl restart redis6479 redis6480
    

    I've updated redis-generator.sh with the change too in commit at update redis-generator.sh for redis 6 systemd startup compatibility ยท centminmod/centminmod-redis@31f189b
     
    Last edited: May 7, 2020
  2. pamamolf

    pamamolf Premium Member Premium Member

    3,842
    377
    83
    May 31, 2014
    Ratings:
    +722
    Local Time:
    6:53 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    Is this something that we must edit manually ?

    I didn't notice any issues yet but it will be good to know if i have to edit anything to avoid any related issues...
     
  3. Sunka

    Sunka Well-Known Member

    1,140
    312
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +508
    Local Time:
    5:53 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    This error show to me when I reboot server. So if you update to redis v6, all will work OK, but first time you rbbot server it will begin throwing errors (only if you use older version for crating 2 another ports from script)
     
  4. Sunka

    Sunka Well-Known Member

    1,140
    312
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +508
    Local Time:
    5:53 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    I can confirm that after reboot everything seems fine. Using redis v6.0.1
    I used @eva2000 suggestion for manual changes

    Code:
    Existing users can manually make changes i.e. for redis6479 and redis6480 services
    
    ```
    sed -i 's|Type=notify|Type=forking|' /usr/lib/systemd/system/redis6479.service
    sed -i 's|Type=notify|Type=forking|' /usr/lib/systemd/system/redis6480.service
    systemctl daemon-reload
    systemctl restart redis6479 redis6480
    ```
     
  5. eva2000

    eva2000 Administrator Staff Member

    45,155
    10,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,919
    Local Time:
    1:53 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Good to know, did you do the other suggested change in @redbot's thread at Redis - redis6479 & redis6480 unable to start

     
  6. eva2000

    eva2000 Administrator Staff Member

    45,155
    10,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,919
    Local Time:
    1:53 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    This only applies to additional redis server instances generated with my unofficial/unsupported redis-generator.sh script at centminmod/centminmod-redis. Default Redis server installed via REMI YUM repo is unaffected by the issue @Sunka reported. You can see the last 2 commits for the fixes on May 5 and 7 at centminmod/centminmod-redis.

    I've added this note to the Readme at centminmod/centminmod-redis
     
  7. Sunka

    Sunka Well-Known Member

    1,140
    312
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +508
    Local Time:
    5:53 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    Code (Text):
    # ls -lah /var/run/redis
    total 8.0K
    drwxr-xr-x  2 redis nginx  80 May  8  2020 .
    drwxr-xr-x 29 root  root  820 May  8 01:13 ..
    -rw-r--r--  1 redis nginx   4 May  8  2020 redis_6480.pid
    -rw-r--r--  1 redis nginx   4 May  8  2020 redis_6481.pid
    
    # cat /etc/tmpfiles.d/redis.conf
    cat: /etc/tmpfiles.d/redis.conf: No such file or directory
    # cd  /etc/tmpfiles.d/
    # rm -f  /etc/tmpfiles.d/redis.conf
     
  8. eva2000

    eva2000 Administrator Staff Member

    45,155
    10,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,919
    Local Time:
    1:53 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    Looks right to me :)
     
  9. pamamolf

    pamamolf Premium Member Premium Member

    3,842
    377
    83
    May 31, 2014
    Ratings:
    +722
    Local Time:
    6:53 PM
    Nginx-1.17.x
    MariaDB 10.3.x
    As i am using only your Redis installation script and not the generator it should be ok for me ....
     
  10. pdinh97qng

    pdinh97qng Member

    91
    10
    8
    Jan 24, 2016
    Ratings:
    +27
    Local Time:
    8:53 AM
    I just installed a new server with redis using the installer and generator and can't connect to redis.
    Code:
    creating redis server: redis6479.service [increment value: 0]
    redis TCP port: 6479
    create systemd redis6479.service
    cp -a /usr/lib/systemd/system/redis.service /usr/lib/systemd/system/redis6479.service
    sed -i 's|Type=notify|Type=forking|' /usr/lib/systemd/system/redis6479.service
    create /etc/redis6479/redis6479.conf config file
    mkdir -p /etc/redis6479
    cp -a /etc/redis.conf /etc/redis6479/redis6479.conf
    -rw-r----- 1 redis root 81K May 17 13:31 /etc/redis6479/redis6479.conf
    -rw-r--r-- 1 root  root 332 May 20 08:36 /usr/lib/systemd/system/redis6479.service
    Job for redis6479.service failed because a timeout was exceeded. See "systemctl status redis6479.service" and "journalctl -xe" for details.
    Created symlink from /etc/systemd/system/multi-user.target.wants/redis6479.service to /usr/lib/systemd/system/redis6479.service.
    Note: Forwarding request to 'systemctl enable redis6479.service'.
    ## Redis TCP 6479 Info ##
    Could not connect to Redis at 127.0.0.1:6479: Connection refused
    -------------------------------------------------------
    creating redis server: redis6480.service [increment value: 1]
    redis TCP port: 6480
    create systemd redis6480.service
    cp -a /usr/lib/systemd/system/redis.service /usr/lib/systemd/system/redis6480.service
    sed -i 's|Type=notify|Type=forking|' /usr/lib/systemd/system/redis6480.service
    create /etc/redis6480/redis6480.conf config file
    mkdir -p /etc/redis6480
    cp -a /etc/redis.conf /etc/redis6480/redis6480.conf
    -rw-r----- 1 redis root 81K May 17 13:31 /etc/redis6480/redis6480.conf
    -rw-r--r-- 1 root  root 332 May 20 08:38 /usr/lib/systemd/system/redis6480.service
    Job for redis6480.service failed because a timeout was exceeded. See "systemctl status redis6480.service" and "journalctl -xe" for details.
    Created symlink from /etc/systemd/system/multi-user.target.wants/redis6480.service to /usr/lib/systemd/system/redis6480.service.
    Note: Forwarding request to 'systemctl enable redis6480.service'.
    ## Redis TCP 6480 Info ##
    Could not connect to Redis at 127.0.0.1:6480: Connection refused
     
  11. elargento

    elargento Member

    348
    17
    18
    Jan 4, 2016
    Ratings:
    +43
    Local Time:
    12:53 PM
    10
    do you apply it to guests or users too?
     
  12. eva2000

    eva2000 Administrator Staff Member

    45,155
    10,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,919
    Local Time:
    1:53 AM
    Nginx 1.17.x
    MariaDB 5.5/10.x
    can only be for guests