redis 单机

最后更新于:2022-04-02 03:06:40

[TOC] ## 使用 [下载redis.conf 文件](https://github.com/antirez/redis/blob/unstable/redis.conf) ``` $ mkdir /home/docker/redis/{conf,data} -p cd /home/docker/redis //可能下载失败使用连接中的redis.conf $ wget https://raw.githubusercontent.com/antirez/redis/4.0/redis.conf -O conf/redis.conf $ sed -i 's/logfile ""/logfile "access.log"/' conf/redis.conf $ sed -i 's/# requirepass foobared/requirepass 123456/' conf/redis.conf $ sed -i 's/appendonly no/appendonly yes/' conf/redis.conf $ docker run \ -p 6379:6379 \ -v $PWD/data:/data \ -v $PWD/conf/redis.conf:/etc/redis/redis.conf \ --privileged=true \ --name myredis \ -d redis redis-server /etc/redis/redis.conf ``` ## 问题 用 docker 启动需要注释 `daemonize yes`或改为`no`这行,作用是开启守护进程
';