Overview
- Full name
docker.io/malexer/twemproxy- Registry
- docker.io
- Namespace
- malexer
- Repository
- twemproxy
- Cached tags
- 3
- Last synced
- 07/06/2026, 08:30 PM
Introduction
twemproxy(nutcracker)Redis/Memcached 代理镜像,提供分片、连接池与故障转移,用于缓存集群前置聚合层。
Details
twemproxy 在客户端与多个 Redis/Memcached 节点之间做轻量代理,支持一致性哈希分片、请求 pipeline 与后端健康剔除。配置通过 nutcracker.yml 定义 listen 地址与 server 列表;本身无持久化状态,扩缩容需同步更新配置并 reload。适合高并发 Web 应用缓存层、降低客户端连接数;Redis Cluster 场景需评估是否仍需要 twemproxy 中间层。
快速启动
docker run -d --name twemproxy \
-p 22121:22121 \
-v $(pwd)/nutcracker.yml:/etc/nutcracker/nutcracker.yml \
docker.io/malexer/twemproxy:latest
推荐实践
docker run -d --name twemproxy \
--restart unless-stopped \
-p 22121:22121 \
-v /etc/twemproxy/nutcracker.yml:/etc/nutcracker/nutcracker.yml:ro \
docker.io/malexer/twemproxy:0.4.1
核心参数说明
-p 22121:22121— 代理监听端口(以 yml 中 alpha 池为准)-v .../nutcracker.yml:...— 后端 Redis 列表与哈希策略--restart unless-stopped— 缓存代理层高可用- 固定 tag — 与 Redis 协议版本兼容
- 修改 backend 后需 reload 或重启容器
Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: twemproxy
spec:
replicas: 2
selector:
matchLabels:
app: twemproxy
template:
metadata:
labels:
app: twemproxy
spec:
containers:
- name: twemproxy
image: docker.io/malexer/twemproxy:0.4.1
ports:
- containerPort: 22121
volumeMounts:
- name: config
mountPath: /etc/nutcracker
readOnly: true
volumes:
- name: config
configMap:
name: twemproxy-config
---
apiVersion: v1
kind: Service
metadata:
name: twemproxy
spec:
selector:
app: twemproxy
ports:
- port: 22121
targetPort: 22121
nutcracker.yml 放入 ConfigMap;应用 Pod 通过 ClusterIP 连接,按 QPS 扩展 replicas。
Latest tags (20)
View all 3 tags →| Tag | Arch | Pushed At | Size | Digest | Sync | Wish | Action |
|---|---|---|---|---|---|---|---|
docker.io/malexer/twemproxy :latest | linux/amd64 | 2021/09/21 20:24 | 3.0 MB | sha256:22e3231c47a1… | |||
docker.io/malexer/twemproxy :0.5.0 | linux/amd64 | 2021/09/21 20:23 | 3.0 MB | sha256:22e3231c47a1… | |||
docker.io/malexer/twemproxy :0.4.1 | linux/amd64 | 2018/02/04 07:03 | 2.3 MB | sha256:be0c893bd1f7… |