Skip to content

Instantly share code, notes, and snippets.

@solso
Created July 26, 2012 13:56
Show Gist options
  • Save solso/3182170 to your computer and use it in GitHub Desktop.
Save solso/3182170 to your computer and use it in GitHub Desktop.
Support material for blog post of redis replication
#!/bin/sh
## --- tunnel_to_master_redis
REDIS_MASTER=XYZ
REDIS_SLAVE_PORT=6280
AUTOSSH_POLL=300
AUTOSSH_PORT=20000
AUTOSSH_GATETIME=10
AUTOSSH_LOGFILE=/var/log/autossh/autossh.log
AUTOSSH_PATH=/usr/bin/ssh
AUTOSSH_PIDFILE=/var/run/autossh/autossh.pid
export AUTOSSH_POLL AUTOSSH_LOGFILE AUTOSSH_PATH AUTOSSH_GATETIME AUTOSSH_PORT
autossh -2 -fN -M ${AUTOSSH_PORT} -C -L ${REDIS_SLAVE_PORT}:localhost:6379 ${REDIS_MASTER}
check process autossh with pidfile /var/run/autossh/autossh.pid
start_program = "/home/bender/bin/tunnel_to_master_redis" as uid bender
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment