Want more timely Centmin Mod News Updates?
Become a Member

Memcached Memcached Socket on Centmin Mod

Discussion in 'Other Centmin Mod Installed software' started by BamaStangGuy, Feb 8, 2017.

  1. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    651
    189
    43
    May 25, 2014
    Ratings:
    +264
    Local Time:
    2:25 PM
  2. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    651
    189
    43
    May 25, 2014
    Ratings:
    +264
    Local Time:
    2:25 PM
    Yep. Railgun also will not connect. It fails to restart saying can not connect on that paths socket. Change back to TCP and everything works fine.
     
  3. eva2000

    eva2000 Administrator Staff Member

    45,192
    10,277
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,927
    Local Time:
    5:25 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    On CentOS 7 try
    Code (Text):
    systemctl daemon-reload
    memcachedstop
    memcachedstart

    does that work, the systemctl daemon-reload might be needed after editing /etc/init.d/memcached
     
  4. eva2000

    eva2000 Administrator Staff Member

    45,192
    10,277
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,927
    Local Time:
    5:25 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Okay found the bug in init.d/memcached incorrectly used test -f for socket while i should of tested if it was a socket = test -S fixing soon. Strange how it worked for me though !
     
  5. eva2000

    eva2000 Administrator Staff Member

    45,192
    10,277
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,927
    Local Time:
    5:25 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Last edited: Feb 8, 2017
  6. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    651
    189
    43
    May 25, 2014
    Ratings:
    +264
    Local Time:
    2:25 PM
    So I finally figured out what was wrong. It is the permissions. I was reading this blog: Installing and configure Memcache on CentOS 7

    and changed to this:
    Code:
    OPTIONS="-s '/var/run/memcached/memcached.sock' -a 0766"
    and now everything works.

    Screen Shot 2017-02-08 at 4.24.24 AM.png

    Why would 775 work on your server but not mine?
     
    Last edited: Feb 8, 2017
  7. eva2000

    eva2000 Administrator Staff Member

    45,192
    10,277
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,927
    Local Time:
    5:25 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
  8. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    651
    189
    43
    May 25, 2014
    Ratings:
    +264
    Local Time:
    2:25 PM
    Code:
    [04:41][root@christianforums.whippmedia.com centminmod]# id nginx
    uid=1000(nginx) gid=1000(nginx) groups=1000(nginx)
    [04:41][root@christianforums.whippmedia.com centminmod]# id memcached
    uid=1001(memcached) gid=1001(memcached) groups=1001(memcached),1000(nginx)
     
  9. eva2000

    eva2000 Administrator Staff Member

    45,192
    10,277
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,927
    Local Time:
    5:25 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    looks good and same as mine on working servers, so far tested on local virtualbox centos 7 instance and 4 live centos 7 systems without issue with memcached unix socket with 0775 socket permissions
     
  10. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    651
    189
    43
    May 25, 2014
    Ratings:
    +264
    Local Time:
    2:25 PM
    I will do a fresh install on Linode since I can reproduce it on their servers. Will document anything I might do differently.
     
  11. eva2000

    eva2000 Administrator Staff Member

    45,192
    10,277
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,927
    Local Time:
    5:25 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    One thing is for railgun usage of memcached server, does railgun run on it's own user/group i.e. railgun ? you might need to add railgun user to memcached usergroup
    Code (Text):
    usermod -G memcached railgun
     
  12. BamaStangGuy

    BamaStangGuy Premium Member Premium Member

    651
    189
    43
    May 25, 2014
    Ratings:
    +264
    Local Time:
    2:25 PM
    Railgun is connecting fine to memcached now. So I guess it doesn't need to be a part of that group.

    Code:
    [04:54][root@christianforums.whippmedia.com centminmod]# id railgun
    uid=992(railgun) gid=991(railgun) groups=991(railgun)
     
  13. eva2000

    eva2000 Administrator Staff Member

    45,192
    10,277
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,927
    Local Time:
    5:25 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    Try adding railgun user to memcached group and changing socket permissions to 0755 and see
     
  14. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    3:25 PM
    1.17.x
    MariaDB 10.3.x
    How would you add another server? The below returns an error in the memcache.php page.

    Code:
    $MEMCACHE_SERVERS[] = array('unix:///var/run/memcached/memcached1.sock','unix:///var/run/memcached/memcached2.sock');
     
    Last edited: Apr 24, 2017
  15. eva2000

    eva2000 Administrator Staff Member

    45,192
    10,277
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,927
    Local Time:
    5:25 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    it's a PHP array so add a 2nd line
    PHP:
    $MEMCACHE_SERVERS[] = 'mymemcache-server1:11211'// add more as an array
    $MEMCACHE_SERVERS[] = 'mymemcache-server2:11211'// add more as an array
     
  16. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    3:25 PM
    1.17.x
    MariaDB 10.3.x
    Thanks!

    Also, if I would want to add additional memcache servers to the /etc/init.d/memcached I would just add additional variables throughout the file? Example:

    Code:
    SOCKETNAMEA='/var/run/memcached/memcached1.sock'
    SOCKETA="-s $SOCKETNAMEA -a 0775"
    SOCKETNAMEB='/var/run/memcached/memcached2.sock'
    SOCKETB="-s $SOCKETNAMEB -a 0775"
    SOCKETNAMEC='/var/run/memcached/memcached3.sock'
    SOCKETC="-s $SOCKETNAMEC -a 0775"
    
     
  17. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    3:25 PM
    1.17.x
    MariaDB 10.3.x
    For some reason the memcache.php file doesn't like the second server.

    Code:
    Cant connect to:unix:///var/run/memcached/memcached2.sock:0
    I had no problem getting it working when I switched to the socket. I went into the centmin menu, exited, restarted memcache, and restarted php / nginx.

    Was there anything else I had to do?
     
  18. eva2000

    eva2000 Administrator Staff Member

    45,192
    10,277
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,927
    Local Time:
    5:25 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    no that won't work, init.d/memcached file by Centmin Mod is hardcoded for 2 instances only right now.

    is 2nd memcached server running ?
     
  19. Jimmy

    Jimmy Well-Known Member

    1,704
    365
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +923
    Local Time:
    3:25 PM
    1.17.x
    MariaDB 10.3.x
    Ok, I wasn't sure if I could go through the file and add the extra variables to make it more than 2 servers... since you have everything in the file labeled 1/2 A/B.

    Was there something specific I needed to do to start the second server?

    Missed the SERVERCOUNT=1. Everything is working fine now! (y)
     
    Last edited: Apr 24, 2017
  20. eva2000

    eva2000 Administrator Staff Member

    45,192
    10,277
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +15,927
    Local Time:
    5:25 AM
    Nginx 1.19.x
    MariaDB 5.5/10.x
    also need to set in /etc/init.d/memcached
    Code (Text):
    SERVERCOUNT=2
    

    it's fixed to only register 1 or 2