Learn about Centmin Mod LEMP Stack today
Register Now

Xenforo Change from memcached to Redis = XF crashes!

Discussion in 'Forum software usage' started by Rdurty2, Feb 8, 2016.

  1. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    My Xenforo install has been running flawlessly memcached, but I would like to switch it over to Redis. No real reason, just that I'm bored and like to experiment with new things...on a live forum lol

    This is now my second time trying Redis with the same outcome.


    I follow the instructions here: https://community.centminmod.com/posts/18863/

    And here: https://community.centminmod.com/posts/18769/

    I can see the Redis cache populating when I browse my forum but every 3-5 minutes my XF will go down and report server 500 error. Then after a couple minutes it comes back up. This cycle repeats.

    I can not figure out why this is happening and defer to the experts here. For now I have switched back to memcached as I cannot figure this out and it has happened both times I've followed the instructions for Redis and Xenforo

    I'm using latest stable .08 CMM install

    Redis Log:

    Code:
    5246:M 08 Feb 13:15:02.087 # Server started, Redis version 3.0.7
    5246:M 08 Feb 13:15:02.509 * DB saved on disk
    5246:M 08 Feb 13:15:02.512 * DB loaded from append only file: 0.425 seconds
    5246:M 08 Feb 13:15:02.512 * The server is now ready to accept connections on port 6379
    5246:M 08 Feb 13:16:03.043 * 10000 changes in 60 seconds. Saving...
    5246:M 08 Feb 13:16:03.043 * Background saving started by pid 5563
    5563:C 08 Feb 13:16:03.048 * DB saved on disk
    5563:C 08 Feb 13:16:03.048 * RDB: 0 MB of memory used by copy-on-write
    5246:M 08 Feb 13:16:03.143 * Background saving terminated with success
    
     
    Last edited: Feb 8, 2016
  2. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    This steps I have done are as follows:

    Install Xenforo Redis Cache add-on

    Edit XF config.php to reflect:
    Code:
    $config['cache']['enabled'] = true;
    $config['cache']['cacheSessions'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions'] = array(
    'caching' => true,
    'cache_id_prefix' => 'xfxx_',
    'automatic_serialization' => false,
    'lifetime' => 0
    );
    
    $config['cache']['backend'] = 'Redis';
    
    $config['cache']['backendOptions'] = array(
    'server' => '127.0.0.1',
    'port' => 6379,
    'use_lua' => true,
    );
    require(XenForo_Application::getConfigDir().'/SV/RedisCache/Installer.php');
    Configure Redis LRU
    Code:
    maxmemory 100mb
    maxmemory-policy allkeys-lru
    maxmemory-samples 10
    appendonly yes
    Restarted Redis Server

    Flush Redis Cache

    Install phpRedisAdmin
     
  3. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:37 AM
    Mainline
    10.2
    and PHP version?
    Extra PHP modules loaded?
     
  4. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    PHP - 5.6.17

    Code:
    [root@einstein ~]# php --ini
    Configuration File (php.ini) Path: /usr/local/lib
    Loaded Configuration File:         /usr/local/lib/php.ini
    Scan for additional .ini files in: /etc/centminmod/php.d
    Additional .ini files parsed:      /etc/centminmod/php.d/a_customphp.ini,
    /etc/centminmod/php.d/curlcainfo.ini,
    /etc/centminmod/php.d/geoip.ini,
    /etc/centminmod/php.d/igbinary.ini,
    /etc/centminmod/php.d/imagick.ini,
    /etc/centminmod/php.d/memcache.ini,
    /etc/centminmod/php.d/memcached.ini,
    /etc/centminmod/php.d/mongodb.ini,
    /etc/centminmod/php.d/redis.ini,
    /etc/centminmod/php.d/zendopcache.ini,
    /etc/centminmod/php.d/zzzz_phpsessions.ini
    
    Is that what you are looking for?
     
  5. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:37 AM
    Mainline
    10.2
    No idea why this is happening :/

    I still recommend you disable the modules you don't use like:
    • geoip
    • memcache
    • mongodb
     
  6. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    I'm not sure why it's happening either. It's driving me nuts!

    Good idea on disabling the modules I don't use.
     
  7. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    Could Zend OpCache be causing problems with Redis LRU cache?
     
  8. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +162
    Local Time:
    1:37 AM
    latest
    latest
    did you check redis log for clues?

    Code:
    /var/log/redis/redis.log
     
  9. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    Yeah I posted the redis.log file contents in my first post. Doesn't look as though there is anything in there that is helpful to the situation
     
  10. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +162
    Local Time:
    1:37 AM
    latest
    latest
    oh sorry I missed that. When your XF forum goes down I'm guessing redis is down as well?

    and what kind of server? If it's a VPS is it KVM, OpenVZ? how many GB of RAM does your server have?
     
  11. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    Not sure how to know if Redis goes down along with XF. I don't think it is as that would probably be reflected in the log file.

    This is a Linode KVM with 1gb memory. Currently only using around 350mb of that 1gb
     
  12. dorobo

    dorobo Active Member

    420
    104
    43
    Jun 6, 2014
    Ratings:
    +162
    Local Time:
    1:37 AM
    latest
    latest
    you can check by

    $ service redis status

    or

    $ redis-cli info

    and since you're on KVM did you add

    vm.overcommit_memory = 1 in /etc/sysctl.conf

    and then

    $ sysctl -p

    just so we could be sure that everything's been set up properly

    I bet redis crashes that's why XF is down. A related thread is here

    Redis Crash | Centmin Mod Community
     
  13. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    I did make that change to vm.overcommit_memory and then ran sysctl -p

    I made sure to follow those directions perfectly. Maybe this evening I will switch back over to Redis and try to catch it crashing or something.
     
  14. eva2000

    eva2000 Administrator Staff Member

    55,189
    12,251
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,829
    Local Time:
    3:37 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    could a XF addon conflict cause this ? @Xon

    2 to 3 mins in while forum still works run and post output for
    Code:
    redis-cli info
     
  15. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    The only addon's I have are Digital Point Bettery Analytics and Pixel Exit's Admin Center.

    I will post up the output shortly.
     
  16. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    Forums are giving error 500 now every other minute, but Redis server is up the entire time. Cleared all browser cache as well, same issue. I feel like I"m not meant to run Redis lol

    Code:
    # Server
    redis_version:3.0.7
    redis_git_sha1:00000000
    redis_git_dirty:0
    redis_build_id:5ece30e075eed8d2
    redis_mode:standalone
    os:Linux 4.1.5-x86_64-linode61 x86_64
    arch_bits:64
    multiplexing_api:epoll
    gcc_version:4.4.7
    process_id:20806
    run_id:24fe9b81ddc49a531482ab0497b1fd771b4172c3
    tcp_port:6379
    uptime_in_seconds:604
    uptime_in_days:0
    hz:10
    lru_clock:12120764
    config_file:/etc/redis.conf
    
    # Clients
    connected_clients:1
    client_longest_output_list:0
    client_biggest_input_buf:0
    blocked_clients:0
    
    # Memory
    used_memory:1153280
    used_memory_human:1.10M
    used_memory_rss:4313088
    used_memory_peak:20280632
    used_memory_peak_human:19.34M
    used_memory_lua:52224
    mem_fragmentation_ratio:3.74
    mem_allocator:jemalloc-3.6.0
    
    # Persistence
    loading:0
    rdb_changes_since_last_save:135
    rdb_bgsave_in_progress:0
    rdb_last_save_time:1454961232
    rdb_last_bgsave_status:ok
    rdb_last_bgsave_time_sec:0
    rdb_current_bgsave_time_sec:-1
    aof_enabled:1
    aof_rewrite_in_progress:0
    aof_rewrite_scheduled:0
    aof_last_rewrite_time_sec:-1
    aof_current_rewrite_time_sec:-1
    aof_last_bgrewrite_status:ok
    aof_last_write_status:ok
    aof_current_size:11736339
    aof_base_size:11197186
    aof_pending_rewrite:0
    aof_buffer_length:0
    aof_rewrite_buffer_length:0
    aof_pending_bio_fsync:0
    aof_delayed_fsync:0
    
    # Stats
    total_connections_received:233
    total_commands_processed:6172
    instantaneous_ops_per_sec:0
    total_net_input_bytes:833408
    total_net_output_bytes:37544967
    instantaneous_input_kbps:0.00
    instantaneous_output_kbps:0.00
    rejected_connections:0
    sync_full:0
    sync_partial_ok:0
    sync_partial_err:0
    expired_keys:0
    evicted_keys:0
    keyspace_hits:5262
    keyspace_misses:264
    pubsub_channels:0
    pubsub_patterns:0
    latest_fork_usec:429
    migrate_cached_sockets:0
    
    # Replication
    role:master
    connected_slaves:0
    master_repl_offset:0
    repl_backlog_active:0
    repl_backlog_size:1048576
    repl_backlog_first_byte_offset:0
    repl_backlog_histlen:0
    
    # CPU
    used_cpu_sys:0.53
    used_cpu_user:0.72
    used_cpu_sys_children:0.00
    used_cpu_user_children:0.00
    
    # Cluster
    cluster_enabled:0
    
    # Keyspace
    db0:keys=68,expires=12,avg_ttl=45330798
    
     
  17. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    I just changed the cache_id_prefix in XF config.php from the value that it was previously set at for memcached. We are going on 5 minutes or so and everything is solid. Interesting...

    For some reason the header on the forum which is almost exactly the same as the one here on CMM loads very slow with Redis
     
  18. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    Spoke too soon. XF just broke again with error 500. Redis server is still running.

    Refreshed a few times and things are working again. what the heck is going on
     
  19. Rdurty2

    Rdurty2 Member

    38
    9
    8
    Oct 31, 2015
    Ratings:
    +12
    Local Time:
    1:37 PM
    1.11.4
    10.0.27
    Just found these errors in php-fpm

    Code:
    [08-Feb-2016 20:09:33 UTC] PHP Fatal error:  Zend_Cache::throwException(): Failed opening required 'Zend/Cache/Exception.php' (include_path='/home/nginx/domains/xxx$
    [08-Feb-2016 20:09:33 UTC] PHP Warning:  Uncaught exception 'ErrorException' with message 'require_once(): open_basedir restriction in effect. File(/home/nginx/domains/xxx$
    Stack trace:
    #0 /home/nginx/domains/xxx/public/library/Zend/Cache.php(208): XenForo_Application::handlePhpError(2, 'require_once():...', '/home/nginx/dom...', 208, Array)
    #1 /home/nginx/domains/xxx/public/library/Zend/Cache.php(208): Zend_Cache::throwException()
    #2 /home/nginx/domains/xxx/public/library/Zend/Cache.php(148): Zend_Cache::throwException('file Zend/Cache...')
    #3 /home/nginx/domains/xxx/public/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Redis', Array, false, false)
    #4 /home/nginx/domains/xxx/public/library/XenForo/Application.php(762): Zend_Cache::factory('Core', 'Redis', Array in /home/nginx/domains/xxx/publ$
    [08-Feb-2016 20:09:33 UTC] PHP Fatal error:  Zend_Cache::throwException(): Failed opening required 'Zend/Cache/Exception.php' (include_path='/home/nginx/domains/xxx$
     
  20. eva2000

    eva2000 Administrator Staff Member

    55,189
    12,251
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,829
    Local Time:
    3:37 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+