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.
chmod +x *.sh
cp *.sh /usr/local/sbin
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
nano /etc/default/memcached
Put your remote host in it.
REMOTE_CACHE="your-remote-memcached-server:11211"
systemctl restart memcached