Docker Compose部署Redis

Docker Compose部署Redis

Docker Compose部署Redis

登录服务器并创建redis目录及redis配置文件

mkdir redis

cd redis

touch docker-compose.yaml

touch redis.conf

配置文件

docker-compose.yml配置文件

version: "3.3"
services:
    redis:
        image: "redis:latest"
        container_name: redis-pord
        restart: always
        ports:
          - "6379:6379"
        volumes:
          - ./redis.conf:/etc/redis/redis.conf:rw
          - ./data:/data:rw
        command:
          # 执行的命令
          redis-server /etc/redis/redis.conf --appendonly yes

redis.conf配置文件

requirepass 123456
appendonly yes

启动Redis

docker-compose up -d  # 启动
docker-compose stop  # 停止
docker-compose start # 启动
docker-compose restart # 重启
docker-compose down # 停止容器并移除

测试连接Redis

使用服务器IP加6379及Redis密码即可访问Redis了
image.png[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-HUQ0baxY-1612577261497)(/uploads/docker/images/m_c168ebd1cb1fe02b1ebf03e4ea2a71fa_r.png)]

Redis Windows版客户端下载地址:

https://github.com/qishibo/AnotherRedisDesktopManager/releases

评论

  欢迎来访晴天のVlog,博主无话可说,没有发布任何公告!

  欢迎来访晴天のVlog,评论区暂空,等你抢C位。

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×