Skip to content
Mike Perham edited this page Jun 8, 2021 · 1 revision

Faktory uses a local copy of Redis to maintain and persist job data but does not expose it via TCP for security and support reasons. Faktory Enterprise can configure Redis to listen on a port, allowing replicas, remote access and other operational activities.

Usage

The simple way to open the gateway is to specify a port via FAKTORY_REDIS_PORT:

FAKTORY_REDIS_PORT=16379 /usr/local/bin/faktory -l debug

Faktory will bind Redis to localhost:16379. For the ultimate control over the TCP socket, you may specify the exact socat listener configuration which gives you a huge amount of flexibility, e.g.:

FAKTORY_REDIS_LISTENER=TCP-LISTEN:16379,fork,bind=someiface,pf=ipv4,reuseaddr /usr/local/bin/faktory -l debug

WARNING: Faktory's Redis must not be shared with any other application or infrastructure. It should be treated as read only when Faktory is running.

The gateway is not reconfigurable at runtime. If you want to enable or disable it, you must restart Faktory.

Configuring a Replica

Creating a real-time replica of your Faktory Redis database is simple once the Redis Gateway is in place. Here's a sample replika.conf:

bind 127.0.0.1 ::1
port 26379
tcp-backlog 128
tcp-keepalive 30
timeout 120

daemonize no
maxmemory-policy noeviction

# Specify the server verbosity level.
# This can be one of:
# debug (a lot of information, useful for development/testing)
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
loglevel notice
logfile ""

# write every 10 seconds if any keys have changed
save 10 1
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename /var/lib/faktory-replika.rdb
slaveof 127.0.0.1 16379

Start Faktory:

FAKTORY_REDIS_PORT=16379 /usr/local/bin/faktory -l debug

Then start the replica Redis instance like so:

/usr/local/bin/redis-server replika.conf

Adjust as necessary to run as a systemd service. Your replika instance will become a real-time replica and persist those replicated changes to disk every 10 seconds to /var/lib/faktory-replika.rdb.

Clone this wiki locally