How to install Memcached on Fedora 16 “Verne”

ADVERTISEMENT

Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.

Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its APIis available for most popular languages.

ADVERTISEMENT
Article will continue after the ad

Here is the simple steps to install Memcached on Fedora 16.

Open Terminal and then switch to root user.

[raj@geeksite~/]$ su -l

Install Memcached:

Install Memcached using the following command.

[root@geeksite~/]# yum install memcached

Edit Memcached configuration file to change / enable the features.

[root@geeksite~/]# vi /etc/sysconfig/memcached

There are some default settings available in the configuration file, change it (if necessary). The following is example settings for 256MB caching.

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="256"
OPTIONS=""

Start Memcached.

[root@geeksite~/]# systemctl start memcached.service

To auto-start Memcached on booting.

[root@geeksite~/]# systemctl enable memcached.service

Confirm the Memcached running status.

[root@geeksite~/]# memcached-tool  127.0.0.1:11211 stats
#127.0.0.1:11211   Field       Value
         accepting_conns           1
               auth_cmds           0
             auth_errors           0
                   bytes           0
              bytes_read           7
           bytes_written           0
              cas_badval           0
                cas_hits           0
              cas_misses           0
               cmd_flush           0
                 cmd_get           0
                 cmd_set           0
               cmd_touch           0
             conn_yields           0
   connection_structures          11
        curr_connections          10
              curr_items           0
               decr_hits           0
             decr_misses           0
             delete_hits           0
           delete_misses           0
       evicted_unfetched           0
               evictions           0
       expired_unfetched           0
                get_hits           0
              get_misses           0
              hash_bytes      262144
       hash_is_expanding           0
        hash_power_level          16
               incr_hits           0
             incr_misses           0
                libevent 2.0.10-stable
          limit_maxbytes    67108864
     listen_disabled_num           0
                     pid        1323
            pointer_size          32
               reclaimed           0
            reserved_fds          20
           rusage_system    0.030995
             rusage_user    0.000000
                 threads           4
                    time  1331986204
       total_connections          11
             total_items           0
              touch_hits           0
            touch_misses           0
                  uptime         900
                 version      1.4.10

Iptables entry:

Add the following entry to allow the incoming connection on port no 11211.

-A INPUT -m state --state NEW -m tcp -p tcp --dport 11211 -j ACCEPT

Check the remote connectivity.

[root@geeksite~/]# echo stats | nc memcache_host_name_or_ip 11211

Install PHP Module:

Install Memcached PHP module to work with PHP5.

[root@geeksite~/]# yum install php php-pecl-memcache

Now restart the Memcached and Apache server to take effect.

[root@geeksite~/]# systemctl restart memcached.service
[root@geeksite~/]# systemctl restart httpd.service

That’s all!

 

ADVERTISEMENT

POSTS YOU MAY LIKE -:)

Share This Post

Shares