Advertisement: Linux VPS for $4/month - based on OpenVZ, credit card accepted, automatic setup.
+ Post New Thread
Results 1 to 3 of 3

Thread: Install memcache/memcached on WHM linux centos server

  1. #1
    Administrator Fli's Avatar
    Join Date
    Mar 2013
    Posts
    2,425
    Post Thanks / Like
    Blog Entries
    1

    Install memcache/memcached on WHM linux centos server



    How to install memcache/memcached at Linux CentOS with WHM control panel.

    1.
    WHM / Software / Easyapache / Build based on previous ... tick (enable) memcache (in extended apps), Build

    2.
    SSH command: yum install memcached
    if not found, try installing so called EPEL or RPMFORGE repository.

    3.
    WHM / Software / Module Installers / PHP Pecl / search for memcache and install memcache + memcached

    4.
    SSH command: service httpd restart

    5. Veriffy its running by looking phpinfo();
    example adding following code into a .php file and running it, find "memcache" on that page.
    Code:
    <?php phpinfo(); ?>
    6. In my case memcached was not running even it was found in phpinfo(). So make it running and make it run at boot (it was off by default)
    service memcached restart
    chkconfig memcached on

    7. Configuration file: /etc/init.d/memcached (need to restart memcached after its changed)

    8. See memcached stats: memcached-tool 127.0.0.1:11211 stats
    (total_connections value should be increasing as time will go / websites are loaded)

    values:
    curr_connections Current number of open connections.
    cmd_get Total number of retrieval requests (get operations).
    cmd_set Total number of storage requests (set operations).
    get_hits Number of keys that have been requested and found present.
    limit_maxbytes Number of bytes this server is permitted to use for storage.
    bytes Current number of bytes used by this server to store items.
    evictions Number of valid items removed from cache to free memory for new items.

    9. Have firewall, make sure port 11211 is in the allowed ports. I have CSF firewall, so i editted /etc/csf/csf.conf
    And added 11211 to the TCP_IN and TCP_OUT line and restarted firewall by command "csf -r"

    10. PHP testing script for memcache:
    <?php
    $mem = new Memcache();
    $mem->addServer("127.0.0.1", 11211);

    $result = $mem->get("blah");

    if ($result) {
    echo $result;
    } else {
    echo "No matching key found. I'll add that now!";
    $mem->set("blah", "I am data! I am held in memcached!") or die("Couldn't save anything to memcached...");
    }
    ?>

  2. #2
    Junior Member iamrajsanth's Avatar
    Join Date
    Nov 2014
    Posts
    1
    Post Thanks / Like


    Is this useful / helpfull? Yes | No
    Currently am getting 50k visitors per day and i have 32GB of ram. For this how much memory i have to set for memcached. Awaiting your kind reply. Thank you.

  3. #3
    Administrator Fli's Avatar
    Join Date
    Mar 2013
    Posts
    2,425
    Post Thanks / Like
    Blog Entries
    1


    Is this useful / helpfull? Yes | No
    Hi, im newbie too, but i would check "memcached-tool" command (mentioned in the first post) output. if evictions is zero or near zero, i guess you dont need to increase memory size, maybe

+ Post New Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
 Protected by : ZB BLOCK  &  StopForumSpam