Memcached installation and configuration on Ubuntu

项月亮
1 min readJun 18, 2020

Installation

Before installing memcached, complete the installation of libevent library.

apt install libevent-devapt install memcached

Check if the process is success

memcached -V

Configuration

  • Start
memcached -u root -p 11211 -m 1024m -d

*Attention: Do not use this command directly!

Memcached don’t have password setting, so anyone who knows your IP and mamcached’s port can connect to your memcached use telnet through following command

telnet YOURIP PORT_OF_MEMCACHED

It’s a serious security problem, to refuse the connection from attackers, use following command to start memcached

memcached -u root -p 11211 -l 127.0.0.1 -m 1024m -d

The parameter -l with 127.0.0.1 ensures only localhost can connect to memecached.

  • Stop

*Attention: unofficial way to stop memcached. I don’t know what’s the standard command to stop. Actually I’ve tried many commands from different technical blogs but they all didn’t work.

ps -ef | grep memcached

Find the pid of memcached, and

kill -9 PID

Reference

Django使用Memcached缓存,大大提升你的网站访问速度

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response