This product is a simple proxy which can allow existing applications which use Memcached set/get operations for caching to use Momento cache offering without any code changes.
- Transparent: allows existing applications which use Memcached to switch to Momento without code changes.
- Stats: get insight into runtime by using the Memcached
statscommand on the admin port. - Command Log: enables logging of commands for audit and offline workload analysis.
- Only
getandsetoperations are supported.
Follow the build steps in the readme.
The Momento proxy requires that the MOMENTO_API_KEY environment
variable is set and contains a valid Momento API key.
If you're new to Momento, you should refer to the Momento CLI docs for instructions to sign up and get an API key.
After obtaining an API key, you should create one or more caches to use with the proxy.
The Momento proxy uses a TOML configuration file. As there aren't any sensible defaults, we require that you provide a configuration file when using the proxy. See the example config and modify it to suit your requirements.
After completing the build and configuration, you are ready to run the Momento proxy.
cargo run --release --bin momento_proxy -- path/to/config.toml
Your application can now connect to the proxy on the configured port(s) to send requests to the corresponding Momento cache(s).
The resulting binary will be target/release/momento_proxy and it can be copied
to a standard system path (eg: /usr/local/bin).
You can run the momento-proxy container by pulling it from Momento's docker hub registry with following commands.
docker pull gomomento/momento-proxy
docker run -d \
-p 11211:11211 \
-p 6379:6379 \
-p 9999:9999 \
-e MOMENTO_API_KEY=<YOUR_MOMENTO_API_KEY> \
gomomento/momento-proxy
By default, this configuration is used for the Momento proxy.
To set your own, please provide an env variable CONFIG as well as the directory where your config file is located to -v when running a container.
docker run -d \
-p 11211:11211 \
-p 6379:6379 \
-p 9999:9999 \
-e MOMENTO_API_KEY=<YOUR_MOMENTO_API_KEY> \
-e CONFIG=my_custom_config.toml \
-v /your/path/to/config/dir:/app/config gomomento/momento-proxy
- Building a new momento-proxy image:
docker build --tag momento-proxy .
- Running the newly built image with the default config:
docker run -d \
-p 11211:11211 \
-p 6379:6379 \
-p 9999:9999 \
-e MOMENTO_API_KEY=<YOUR_MOMENTO_API_KEY> \
momento-proxy
- Running the newly built image with your custom config:
docker run -d \
-p 11211:11211 \
-p 6379:6379 \
-p 9999:9999 \
-e MOMENTO_API_KEY=<YOUR_MOMENTO_API_KEY> \
-e CONFIG=<YOUR_CONFIG_FILE> \
-v /your/path/to/config/dir:/app/config \
momento-proxy
- Testing to see if a container with the
momento-proxyis running properly withtelnetfor Memcache:
telnet 0.0.0.0 11211
Trying 0.0.0.0...
Connected to 0.0.0.0.
Escape character is '^]'
set foo 0 0 3
bar
STORED
- Or you can use
redis-clito test to see ifmomento-proxyis running properly for Redis:
redis-cli -h 0.0.0.0 -p 6379 SET FOO BAR
OK
redis-cli -h 0.0.0.0 -p 6379 GET FOO
"BAR"