Welcome to Centmin Mod Community
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 Active Member

    669
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    9:27 AM
  2. BamaStangGuy

    BamaStangGuy Active Member

    669
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    9:27 AM
    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

    59,298
    12,510
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,143
    Local Time:
    12:27 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    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

    59,298
    12,510
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,143
    Local Time:
    12:27 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    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

    59,298
    12,510
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,143
    Local Time:
    12:27 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Last edited: Feb 8, 2017
  6. BamaStangGuy

    BamaStangGuy Active Member

    669
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    9:27 AM
    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

    59,298
    12,510
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,143
    Local Time:
    12:27 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
  8. BamaStangGuy

    BamaStangGuy Active Member

    669
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    9:27 AM
    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

    59,298
    12,510
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,143
    Local Time:
    12:27 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    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 Active Member

    669
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    9:27 AM
    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

    59,298
    12,510
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,143
    Local Time:
    12:27 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    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 Active Member

    669
    192
    43
    May 25, 2014
    Ratings:
    +272
    Local Time:
    9:27 AM
    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

    59,298
    12,510
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,143
    Local Time:
    12:27 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Try adding railgun user to memcached group and changing socket permissions to 0755 and see
     
  14. Jimmy

    Jimmy Well-Known Member

    1,799
    391
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +999
    Local Time:
    10:27 AM
    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

    59,298
    12,510
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,143
    Local Time:
    12:27 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    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,799
    391
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +999
    Local Time:
    10:27 AM
    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,799
    391
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +999
    Local Time:
    10:27 AM
    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

    59,298
    12,510
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,143
    Local Time:
    12:27 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    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,799
    391
    83
    Oct 24, 2015
    East Coast USA
    Ratings:
    +999
    Local Time:
    10:27 AM
    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

    59,298
    12,510
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,143
    Local Time:
    12:27 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    also need to set in /etc/init.d/memcached
    Code (Text):
    SERVERCOUNT=2
    

    it's fixed to only register 1 or 2