In two weeks I am moving to a Scala job. Someone suggested that a nice way to get started with a new language is to implement a 'mini memcached'. Open a socket, send some key/value pairs, store in a hash map: the idea is it's good to do a bit of network programming and get exposed to some libraries (collections, concurrency etc). I haven't quite figured out the spec for my mini memcached but to start, I though I'd try sending some stuff to a real instance of memcached and then swap it out for my mini version.
sudo apt-get install memcached
After doing this the memcached service was running.
When I did this, memcached was not running on all network interfaces by default. Therefore I changed the memcached config file:
sudo sed -i 's/127.0.0.1/0.0.0.0/g' /etc/memcached.conf
Then I restarted the service:
sudo service memcached restart
Installing Memcached on Ubuntu
sudo apt-get install memcached
After doing this the memcached service was running.
When I did this, memcached was not running on all network interfaces by default. Therefore I changed the memcached config file:
sudo sed -i 's/127.0.0.1/0.0.0.0/g' /etc/memcached.conf
Then I restarted the service:
sudo service memcached restart
Telnet to memcached to store a key/value pair
alexandra$ telnet 192.168.2.2 11211
Trying 192.168.2.2...
Connected to 192.168.2.2.
Escape character is '^]'.
set keyname 0 60 2
hi
STORED
get keyname
VALUE keyname 0 2
hi
END
If anything weird is happening, check the log:
tail /var/log/memcached.log
Vagrant VM running memcached
https://github.com/apojha/vagrant-vms/tree/master/memcached
No comments:
Post a Comment