Replikasi Memcached Menggunakan Repcached di Ubuntu 16.04

Memcached dapat kita gunakan sebagai cache untuk website atau juga dapat kita gunakan untuk menyimpan session PHP. Jika kita memiliki website yang diletakkan dibeda data center, untuk saling berbagi session agar tidak harus login lagi jika user mengakses site di data center yang berbeda.

Berikut langkah-langkahnya : 

download & install repcached

# wget https://launchpad.net/~niedbalski/+archive/ubuntu/memcached-repcached/+files/memcached_1.4.14-0ubuntu10repcache3_amd64.deb
# dpkg -i memcached_1.4.14-0ubuntu10repcache3_amd64.deb

setelah diinstall memcached akan langsung berjalan, stop proses memcached yang sedang berjalan

# killall -9 memcached

salin konfigurasi dasar memcached ke konfigurasi repcached pada server 1

# cp /etc/memcached.conf /etc/memcached_server1.conf

edit konfigurasi repcached

# vi /etc/memcached_server1.conf
# Run as daemon
-d
# Logfile location
logfile /var/log/memcached.log
# Memory Amount
-m 1024
# Connection Port TCP
-p 11211
# User under which the daemon will run
-u memcache
# Bind on IP
-l 117.53.44.101
# Connections Limit
-c 4096
# Return error when memory is exhausted (rather than removing items)
-M
# Slave Memcached Server
-x 117.53.44.102

start service repcached

# service memcached start

salin konfigurasi dasar memcached ke konfigurasi repcached pada server 2

# cp /etc/memcached.conf /etc/memcached_server2.conf

edit konfigurasi repcached

# vi /etc/memcached_server2.conf
# Run as daemon
-d
# Logfile location
logfile /var/log/memcached.log
# Memory Amount
-m 1024
# Connection Port TCP
-p 11211
# User under which the daemon will run
-u memcache
# Bind on IP
-l 117.53.44.102
# Connections Limit
-c 4096
# Return error when memory is exhausted (rather than removing items)
-M
# Slave Memcached Server
-x 117.53.44.101

start service repcached

# service memcached start

verifikasi pada server 1

# telnet 117.53.44.101 11211
Trying 117.53.44.101...
Connected to 117.53.44.101.
Escape character is '^]'.
set rcn 0 0 10
routecloud
STORED
get rcn
VALUE rcn 0 10
routecloud
END

verifikasi pada server 2

# telnet 117.53.44.102 11211
Trying 117.53.44.102...
Connected to 117.53.44.102.
Escape character is '^]'.
get rcn
VALUE rcn 0 10
routecloud
END

 

About the author
arisyi

Routecloud Networks

Information about Server, Linux and Computer Network.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to Routecloud Networks.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.