modulepackage
0.0.0-20230627130346-248ac9a6adfc
Repository: https://github.com/microsoft/redplex.git
Documentation: pkg.go.dev
# README
redplex
Project status: redplex is actively maintained and was running in production at Mixer from 2017 to 2021.
redplex is a tool to multiplex Redis pubsub. It implements the Redis protocol and is a drop-in replacement for existing Redis pubsub servers, simply boot redplex and change your port number. This is a useful tool in situations where you have very many readers for pubsub events, as Redis pubsub throughput is inversely proportional to the number of subscribers for the event.
Note: some Redis clients have health checks that call commands like INFO on boot. You'll want to turn these off, as redplex does not implement commands expect for SUBSCRIBE, PSUBSCRIBE, UNSUBSCRIBE, PUNSUBSCRIBE, and EXIT.
Usage
➜ redplex git:(master) ./redplex --help
usage: redplex [<flags>]
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-l, --listen="127.0.0.1:3000" Address to listen on
-n, --network="tcp" Network to listen on
--remote="127.0.0.1:6379" Remote address of the Redis server
--remote-network="tcp" Remote network to dial through (usually tcp or tcp6)
--sentinels=SENTINELS ... A list of Redis sentinel addresses
--sentinel-name=SENTINEL-NAME
The name of the sentinel master
--log-level="info" Log level (one of debug, info, warn, error
--dial-timeout=10s Timeout connecting to Redis
--write-timeout=2s Timeout during write operations
--pprof-server=PPROF-SERVER
Address to bind a pprof server on. Not bound if empty.
# Packages
No description provided by the author
# Functions
NewDirectDialer creates a DirectDialer that dials to the given address.
NewPubsub creates a new Pubsub instance.
NewRequest creates a new request to send to the Redis server.
NewSentinelDialer creates a SentinelDialer.
NewServer creates a new Redplex server.
ParseBulkMessage expects that the byte slice starts with the length delimiter, and returns the contained message.
ParsePublishCommand parses the given pubsub command efficiently.
ParseRequest parses a method and arguments from the reader.
ReadNextFull copies the next full command from the reader to the buffer.
SubscribeResponse returns an appropriate response to the given subscribe or unsubscribe command.
# Constants
MessageBulk is the prefix for Redis bulk messages.
MessageError is the prefix for Redis line errors in the protocol.
MessageInt is the prefix for Redis line integers in the protocol.
MessageMutli is the prefix for Redis "multi" messages (arrays).
MessageStatus is the prefix for Redis line statues in the protocol.
# Variables
ErrWrongMessage is returned in Parse commands if the command is not a pubsub command.
# Structs
DirectDialer creates a direct connection to a single Redis server or IP.
The Listener wraps a function that's called when a pubsub message it sent.
PublishCommand is returned from ParsePublishCommand.
Pubsub manages the connection of redplex to the remote pubsub server.
The SentinelDialer dials into the Redis cluster master as defined by the assortment of sentinel servers.
Server is the redplex server which accepts connections and talks to the underlying Pubsub implementation.
# Type aliases
Request is a byte slice with utility methods for building up Redis commands.