mootools php faith camera linux

php

AWS Elasticache Auto
Discovery



You may be using Amazon Web Services' ElastiCache as your memcached solution. It provides metrics via CloudWatch and provides opportunities for auto scaling nodes in your cluster.

But let's say you do scale your cluster, either manually or automatically, how will you contend with registering each of the servers in your memcache object?



ElastiCache Auto Discovery Example

Amazon's ElastiCache Auto Discovery client extends the memcache object to register all of the nodes in your cluster. Here is an example of how simple it can be:


  $server_endpoint 
'myhost.bacdea.cfg.use1.cache.amazonaws.com';
  
$server_port 11211;
  
$ec = new Memcached();
  
$ec->setOption(Memcached::OPT_CLIENT_MODEMemcached::DYNAMIC_CLIENT_MODE);
  
$ec->addServer($server_endpoint$server_port);

  
$out $ec->set('joe''momma'60);
  echo 
'joe is your: '.$ec->get('mykey');

Be sure to read how to setup auto discovery as well as read others' comments on the costs and benefits of ElastiCache vs rolling your own memcached solution.



Last Updated: 2013-08-08 19:48:13
Creative Commons License Jay Johnston is a Zend Certified Engineer in PHP 5 LPI-ID: LPI000102450, Verfication Code: wmnnt56y2k  ... Jay Johnston is certified as LPIC-1 by the Linux Professional Institute