Welcome to Centmin Mod Community
Register Now

Redis Installing Redis on CentOS 7?

Discussion in 'Centmin Mod Insights' started by rdan, Sep 25, 2015.

  1. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:31 AM
    Mainline
    10.2
    This command works:
    yum -y install redis --enablerepo=remi --disableplugin=priorities
    But this, I got problems:


     
  2. eva2000

    eva2000 Administrator Staff Member

    55,158
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:31 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Code:
    chkconfig redis on
     
  3. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:31 AM
    Mainline
    10.2
    I think the right command is?
    systemctl enable redis.service
     
  4. eva2000

    eva2000 Administrator Staff Member

    55,158
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:31 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yes for CentOS 7.. although chkconfig should link to that too
     
  5. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:31 AM
    Mainline
    10.2

    Is that expected output?
     
  6. eva2000

    eva2000 Administrator Staff Member

    55,158
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:31 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  7. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:31 AM
    Mainline
    10.2
    Same as this one, is expected?
     
  8. eva2000

    eva2000 Administrator Staff Member

    55,158
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:31 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yup
     
  9. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:31 AM
    Mainline
    10.2
    About this:
    Only blank page for me :/
     
  10. eva2000

    eva2000 Administrator Staff Member

    55,158
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:31 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    followed all the steps Install - How to install Redis server on Centmin Mod LEMP stack | Centmin Mod Community ?

    Code:
    cd /usr/local/nginx/html
    git clone https://github.com/ErikDubbelboer/phpRedisAdmin redisadmin
    cd redisadmin
    git clone https://github.com/nrk/predis.git vendor
    chown -R nginx:nginx /usr/local/nginx/html/redisadmin
    then setup HTTP password authentication where you set your own USERNAME and PASSWORD

    Code:
    /usr/local/nginx/conf/htpasswd.sh create /usr/local/nginx/conf/htpasswd_redisadmin USERNAME PASSWORD
    in /usr/local/nginx/conf/conf.d/virtual.conf add
    Code:
    location /redisadmin {
         auth_basic "Private";
         auth_basic_user_file /usr/local/nginx/conf/htpasswd_redisadmin;
            include /usr/local/nginx/conf/php.conf;
            #allow 127.0.0.1;
            #allow YOURIPADDRESS;
            #deny all;
    }
    restart nginx server and php-fpm
    Code:
    nprestart
     
  11. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:31 AM
    Mainline
    10.2
    Still, blank page.
    Maybe because I set redis password?
     
  12. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:31 AM
    Mainline
    10.2
    I even compile PHP Redis now.
    Or what other module does it depend?
     
  13. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:31 AM
    Mainline
    10.2
    I got this error on log:
     
  14. eva2000

    eva2000 Administrator Staff Member

    55,158
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:31 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    From github
    So if you set the redis password in /etc/redis.conf need to setup the includes/config.inc.php

    Code:
    cp -a /usr/local/nginx/html/redisadmin/includes/config.sample.inc.php /usr/local/nginx/html/redisadmin/includes/config.inc.php
    so need to edit includes/config.inc.php and set your redis password you set in /etc/redis.conf
    Code:
          // Optional Redis authentication.
          //'auth' => 'redispasswordhere' // Warning: The password is sent in plain-text to the Redis server.
    contents of includes/config.inc.php
    PHP:
    <?php
    //Copy this file to config.inc.php and make changes to that file to customize your configuration.

    $config = array(
      
    'servers' => array(
        array(
          
    'name'   => 'local server'// Optional name.
          
    'host'   => '127.0.0.1',
          
    'port'   => 6379,
          
    'filter' => '*',

          
    // Optional Redis authentication.
          //'auth' => 'redispasswordhere' // Warning: The password is sent in plain-text to the Redis server.
        
    ),

        
    /*array(
          'host' => 'localhost',
          'port' => 6380
        ),*/

        /*array(
          'name'      => 'local db 2',
          'host'      => 'localhost',
          'port'      => 6379,
          'db'        => 1,             // Optional database number, see http://redis.io/commands/select
          'databases' => 1,             // Optional number of databases (prevents use of CONFIG command).
          'filter'    => 'something:*', // Show only parts of database for speed or security reasons.
          'seperator' => '/',           // Use a different seperator on this database (default uses config default).
          'flush'     => false,         // Set to true to enable the flushdb button for this instance.
          'charset'   => 'cp1251',      // Keys and values are stored in redis using this encoding (default utf-8).
          'keys'      => false,         // Use the old KEYS command instead of SCAN to fetch all keys for this server (default uses config default).
          'scansize'  => 1000           // How many entries to fetch using each SCAN command for this server (default uses config default).
        ),*/
      
    ),


      
    'seperator' => ':',


      
    // Uncomment to show less information and make phpRedisAdmin fire less commands to the Redis server. Recommended for a really busy Redis server.
      //'faster' => true,


      // Uncomment to enable HTTP authentication
      /*'login' => array(
        // Username => Password
        // Multiple combinations can be used
        'admin' => array(
          'password' => 'adminpassword',
        ),
        'guest' => array(
          'password' => '',
          'servers'  => array(1) // Optional list of servers this user can access.
        )
      ),*/


      /*'serialization' => array(
        'foo*' => array( // Match like KEYS
          // Function called when saving to redis.
          'save' => function($data) { return json_encode(json_decode($data)); },
          // Function called when loading from redis.
          'load' => function($data) { return json_encode(json_decode($data), JSON_PRETTY_PRINT); },
        ),
      ),*/


      // You can ignore settings below this point.

      
    'maxkeylen'           => 100,
      
    'count_elements_page' => 100,

      
    // Use the old KEYS command instead of SCAN to fetch all keys.
      
    'keys' => false,

      
    // How many entries to fetch using each SCAN command.
      
    'scansize' => 1000
    );

    ?>
     
  15. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:31 AM
    Mainline
    10.2
    Works now :D
    Only lack I have is the password to set :D.
    Thanks Eva!
     
  16. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:31 AM
    Mainline
    10.2
    This is the only PHP module I need right?
    [​IMG]

    Can't tell if I make it work with XenForo :/
     
  17. rdan

    rdan Well-Known Member

    5,449
    1,410
    113
    May 25, 2014
    Ratings:
    +2,204
    Local Time:
    1:31 AM
    Mainline
    10.2
    No need to White list Redis port on CSF?
     
  18. eva2000

    eva2000 Administrator Staff Member

    55,158
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:31 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yup
    no need unless you run Redis cluster across several servers
     
  19. Sunka

    Sunka Well-Known Member

    1,150
    325
    83
    Oct 31, 2015
    Pula, Croatia
    Ratings:
    +525
    Local Time:
    7:31 PM
    Nginx 1.17.9
    MariaDB 10.3.22
    Any info about this server error?

    Code:
    Server Error Log
    Error Info
    CredisException: read error on connection - library/Redis/lib/Credis/Client.php:1065
    Generated By: Unknown Account, Today at 11:57
    Stack Trace
    
    #0 /home/nginx/domains/pijanitvor.com/public/library/Redis/lib/Credis/Client.php(603): Credis_Client->__call('select', Array)
    #1 /home/nginx/domains/pijanitvor.com/public/library/Redis/Cm/Cache/Backend/Redis.php(144): Credis_Client->select(0)
    #2 /home/nginx/domains/pijanitvor.com/public/library/Zend/Cache.php(153): Cm_Cache_Backend_Redis->__construct(Array)
    #3 /home/nginx/domains/pijanitvor.com/public/library/Zend/Cache.php(94): Zend_Cache::_makeBackend('Redis', Array, false, false)
    #4 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Application.php(761): Zend_Cache::factory('Core', 'Redis', Array, Array)
    #5 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Application.php(971): XenForo_Application->loadCache(Object(Zend_Config))
    #6 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Application.php(1002): XenForo_Application->lazyLoad('cache', NULL)
    #7 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Application.php(1647): XenForo_Application::get('cache')
    #8 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Model.php(146): XenForo_Application::getCache()
    #9 /home/nginx/domains/pijanitvor.com/public/library/SV/RedisCache/RedisDataRegistry.php(152): XenForo_Model->_getCache(true)
    #10 /home/nginx/domains/pijanitvor.com/public/library/XenForo/Dependencies/Abstract.php(147): XenForo_Model_DataRegistry->getMulti(Array)
    #11 /home/nginx/domains/pijanitvor.com/public/library/XenForo/FrontController.php(127): XenForo_Dependencies_Abstract->preLoadData()
    #12 /home/nginx/domains/pijanitvor.com/public/index.php(13): XenForo_FrontController->run()
    #13 {main}
    
    Request State
    
    array(3) {
      ["url"] => string(50) "https://www.pijanitvor.com/index.php?ajax/adAction"
      ["_GET"] => array(1) {
        ["ajax/adAction"] => string(0) ""
      }
      ["_POST"] => array(6) {
        ["action"] => string(4) "view"
        ["id"] => string(1) "5"
        ["position"] => string(23) "ad_above_top_breadcrumb"
        ["_xfRequestUri"] => string(51) "/threads/pukao-mi-je-vrh-na-dvodjelnom-stapu.17919/"
        ["_xfNoRedirect"] => string(1) "1"
        ["_xfResponseType"] => string(4) "json"
      }
    }
    
    
     
  20. eva2000

    eva2000 Administrator Staff Member

    55,158
    12,249
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,825
    Local Time:
    3:31 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    could be redis server was down or being restarted or something ? might need to ask @Xon for specifics :)