Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 1010 Bytes

README.md

File metadata and controls

40 lines (32 loc) · 1010 Bytes

Automatic memcached replication on service restart.

Make sure you are aware that memcached-tool dump command can lock your memcached instance for a while if it has a lot of records, this warning is displayed when running the memcached-tool.

Copy memcache-copy.sh and memcache-firewall.sh in /usr/local/sbin/

chmod +x *.sh
cp *.sh /usr/local/sbin

Modify the systemctl start-up configuration

Run the following command to start an editor

systemctl edit memcached

Put the following, save and exit.

[Service]
ExecStartPre=+/usr/local/sbin/memcache-firewall.sh
ExecStartPost=+/usr/local/sbin/memcache-copy.sh
ExecStopPost=+/usr/local/sbin/memcache-firewall.sh
EnvironmentFile=/etc/default/memcached

Edit /etc/default/memcached and add your remote host.

nano /etc/default/memcached

Put your remote host in it.

REMOTE_CACHE="your-remote-memcached-server:11211"

Restart memcached to test the setup.

systemctl restart memcached