- 博客/
Docker Quickstart Redis Server
作者
Johny
熟练的 云原生搬砖师
Table of Contents
环境说明:#
- 系统镜像: Redis:5.x (示例容器为: redis:5.0.4 )
- 操作系统: Centos
- Docker 版本: 19.03.8
具体实现步骤#
操作系统简单优化#
echo 'vm.overcommit_memory=1
net.core.somaxconn=65535' >> /etc/sysctl.conf
sysctl -p
echo never > /sys/kernel/mm/transparent_hugepage/enable
下载容器#
docker pull redis:5.0.4
创建依赖文件夹#
mkdir -p /application/redis/{conf,data}
初始化配置文件#
wget https://raw.githubusercontent.com/antirez/redis/5.0/redis.conf -O /application/redis/conf/redis.conf
sed -i 's/logfile ""/logfile "access.log"/' /application/redis/conf/redis.conf # 开启日志
sed -i 's/# requirepass foobared/requirepass aabb/' /application/redis/conf/redis.conf # 设置密码
sed -i 's/appendonly no/appendonly yes/' /application/redis/conf/redis.conf # 开启持久化
sed -i 's/bind 127.0.0.1/bind 0.0.0.0/' /application/redis/conf/redis.conf # 修改端口监听
启动容器#
docker run \
-v /application/redis/conf/redis.conf:/etc/redis/redis.conf \
-v /application/redis/data:/data \
-p 6379:6379 \
--restart=always \
-m 8192M \
--memory-swap 0 \
--oom-kill-disable \
--privileged=true \
--name redis-server \
-d redis:5.0.4 redis-server /etc/redis/redis.conf
相关文章
Kind 部署本地k8s集群的使用记录
·326 字·1 分钟·
k8s
docker
devops
centos7
kind
Docker 部署多网口 openWrt 软路由
·810 字·2 分钟·
openwrt
linux
centos7
Docker 部署的 openWrt 软路由, 并解决无法与宿主机通信问题
·923 字·2 分钟·
fix
openwrt
n1
docker-compose
docker
openwrt