Want more timely Centmin Mod News Updates?
Become a Member

Redis Crash

Discussion in 'Other Centmin Mod Installed software' started by Matt Williams, Jan 1, 2016.

  1. eva2000

    eva2000 Administrator Staff Member

    55,803
    12,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,858
    Local Time:
    12:08 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Indeed a limitation of OpenVZ, hence why i like and prefer KVM or Xen VPSes :D

     
  2. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +162
    Local Time:
    10:08 AM
    latest
    latest
    I lowered the maxmemory to 200 for now and see if it stops again.
     
  3. Matt Williams

    Matt Williams WordPress Fanatic

    537
    104
    43
    Nov 22, 2014
    Virginia, USA
    Ratings:
    +157
    Local Time:
    10:08 PM
    latest
    10
    Add Monit - Easy, proactive monitoring of processes, programs, files, directories, filesystems and hosts | Monit - if it crashes, Monit will restart it automatically for you. Monit is the best tool in my bag. I wrote a small .sh file for when to much Sawp is being used up @ 75% - it clears it for me and drops it back down - Monit keeps everything in check and monitors/manages and maintains all services. nginx, memcached, redis, php-fpm, mysql, the file system.

    This tool should be a "must use" on any VPS system.
     
  4. eva2000

    eva2000 Administrator Staff Member

    55,803
    12,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,858
    Local Time:
    12:08 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yeah played with monit for my own stuff and at https://community.centminmod.com/posts/20509/. Just be careful with mysql, you don't want to auto restart if you have problems if you really understand what happens when mysql restarts and when their data issues especially with innodb tables. You rather want to be able to diagnose mysql and manually start back up or otherwise risk corruption and even lengthier restart/start up times AND still have database issues after startup.
     
    Last edited: Feb 9, 2016
  5. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +162
    Local Time:
    10:08 AM
    latest
    latest
    I'm trying to set up monit to monitor redis

    Code (Text):
    check process redis-server
        with pidfile "/var/run/redis/redis.pid"
        start program = "/bin/systemctl start  redis.service"
        stop program = "/bin/systemctl start  redis.service"
        if 2 restarts within 3 cycles then timeout    
        if failed host 127.0.0.1 port 6379 then restart
        


    but there doesn't seem to be a redis.pid

    I read the commands below on stackoverflow to give redis permission to create the pid file

    Code (Text):
    mkdir /var/run/redis
    chown redis /var/run/redis


    is this ok?
     
  6. eva2000

    eva2000 Administrator Staff Member

    55,803
    12,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,858
    Local Time:
    12:08 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    centos 6 or 7 ?

    If you need redis to create and write a pid file, you need to run Redis in daemonized mode by setting in /etc/redis.conf
    Code (Text):
    daemonize yes
    

    and restarting redis service.

    info from /etc/redis.conf defines the pidfile = /var/run/redis_6379.pid
    Code (Text):
    cat /etc/redis.conf | grep pid
    # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
    # If a pid file is specified, Redis writes it where specified at startup
    # When the server runs non daemonized, no pid file is created if none is
    # specified in the configuration. When the server is daemonized, the pid file
    # is used even if not specified, defaulting to "/var/run/redis.pid".
    # Creating a pid file is best effort: if Redis is not able to create it
    pidfile /var/run/redis_6379.pid

    Code (Text):
    cat /etc/redis.conf | grep daemonize
    # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
    daemonize no
    # When the server runs non daemonized, no pid file is created if none is
    # specified in the configuration. When the server is daemonized, the pid file
    # output for logging but daemonize, logs will be sent to /dev/null
     
  7. eva2000

    eva2000 Administrator Staff Member

    55,803
    12,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,858
    Local Time:
    12:08 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    looks like you need to edit /etc/redis.conf to
    Code (Text):
    pidfile /var/run/redis/redis.pid
    

    run these commands in SSH
    Code (Text):
    mkdir /var/run/redis
    chown redis /var/run/redis
    

    and restart redis server
     
  8. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +162
    Local Time:
    10:08 AM
    latest
    latest
    7

    Does this mean that if daemonize is no then the pid file is = pidfile /var/run/redis_6379.pid since it's specified in the config?
     
  9. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +162
    Local Time:
    10:08 AM
    latest
    latest
    OK I just manually created the pid file with daemonized to yes

    [​IMG]

    now to test if my monit config works :D

    thanks George
     
  10. eva2000

    eva2000 Administrator Staff Member

    55,803
    12,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,858
    Local Time:
    12:08 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    no.. only when daemonize yes does a pid file get created

    don't manually create the file !

    redis has to create it for you
     
  11. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +162
    Local Time:
    10:08 AM
    latest
    latest
    Oh sorry I didn't mean that I created the pid manually.

    I just followed the steps here

    I helped redis create the pid file rather :D
     
  12. eva2000

    eva2000 Administrator Staff Member

    55,803
    12,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,858
    Local Time:
    12:08 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    ah i see.. should be good to go then :)
     
  13. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +162
    Local Time:
    10:08 AM
    latest
    latest
    why do we have to create rediscache_newdomain.com.conf implying that we need to create one for each domain that uses redis when the content of it is just the same?

    e.g. the content of rediscache_newdomain.com.conf is just the same as rediscache_newdomain2.com.conf and so on

    why not just one rediscache.conf and then include it on the corresponding nginx vhost file that needs it?
     
  14. eva2000

    eva2000 Administrator Staff Member

    55,803
    12,272
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,858
    Local Time:
    12:08 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    for automation wise, otherwise centmin.sh wouldn't know if a site or other site on server uses redis caching at nginx level and you can also customise per site the rediscache settings for each site with corresponding rediscache_*.conf include file i.e. other cookie or site url exclusions to add for not caching in redis etc