Join the community today
Register Now

Now I have 2 nodes mysql/memcached and nginx/php, How can I connect to memcached?

Discussion in 'Other Centmin Mod Installed software' started by RoldanLT, Jun 16, 2015.

  1. RoldanLT

    RoldanLT Well-Known Member

    3,829
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    11:06 PM
    1.11
    10.2
    How can I connect to memcached from nginx/php server?

    I tried using the private IP that I use for Mysql, but can't login into my forum.
     
  2. RoldanLT

    RoldanLT Well-Known Member

    3,829
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    11:06 PM
    1.11
    10.2
    I mean here:
    Code:
    // Cache
    $config['cache'] = array(
        'enabled'                      => true,
        'cacheSessions'                => true,
        'frontend'                     => 'Core',
        'frontendOptions'              => array(
            'caching'                  => true,
            'cache_id_prefix'          => 'xf_',
            'automatic_serialization'  => true,
            'lifetime'                 => 0),
        'backend'                      => 'Libmemcached',
        'backendOptions'               => array(
            'servers'                  => array(
                array(
                    'host'             => 'localhost',
                    'port'             => 11211,
                    'weight'           => 1
                )
            )
        )
    );
    // End Cache
    Instead of localhost, I want to use memcached on other node.
     
  3. Steve Tozer

    Steve Tozer Member

    70
    42
    18
    Jul 28, 2014
    South Wales, UK
    Ratings:
    +49
    Local Time:
    4:06 PM
    1.91
    10.0.19
    On the other node, is memcached listening on 127.0.0.1 or is it listening on the public IP

    Check
    Code:
    /etc/rc.d/init.d/memcached
    Code:
    SERVERIP='127.0.0.1'
    Think you may need to change it to 0.0.0.0, Sure thats what I did when I had a server just running memcached

    Then change your code 'host' => 'localhost', to the private IP
     
  4. RoldanLT

    RoldanLT Well-Known Member

    3,829
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    11:06 PM
    1.11
    10.2
    Or use the current private IP?
     
  5. Steve Tozer

    Steve Tozer Member

    70
    42
    18
    Jul 28, 2014
    South Wales, UK
    Ratings:
    +49
    Local Time:
    4:06 PM
    1.91
    10.0.19
    Yea use the current private IP of that server, will only bind to that address

    Then restart memcached
     
    • Like Like x 1
    • Informative Informative x 1
  6. RoldanLT

    RoldanLT Well-Known Member

    3,829
    929
    113
    May 25, 2014
    Phillipines
    Ratings:
    +1,258
    Local Time:
    11:06 PM
    1.11
    10.2
    Nice, it works great now :)
     
  7. Steve Tozer

    Steve Tozer Member

    70
    42
    18
    Jul 28, 2014
    South Wales, UK
    Ratings:
    +49
    Local Time:
    4:06 PM
    1.91
    10.0.19
    :stop:(y):D Great stuff
     
    • Like Like x 1
  8. eva2000

    eva2000 Administrator Staff Member

    28,976
    6,578
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,764
    Local Time:
    1:06 AM
    Nginx 1.13.x
    MariaDB 5.5
    yup private ip for listen and ensure CSF firewall on both servers has whitelisted each others ips :)