• docker安装并运行redis


      拉取镜像:

    [mall@VM_0_7_centos ~]$ sudo docker pull redis:3.2
    [sudo] password for mall: 
    3.2: Pulling from library/redis
    f17d81b4b692: Pull complete 
    b32474098757: Pull complete 
    8980cabe8bc2: Pull complete 
    58af19693e78: Pull complete 
    a977782cf22d: Pull complete 
    9c1e268980b7: Pull complete 
    Digest: sha256:7b0a40301bc1567205e6461c5bf94c38e1e1ad0169709e49132cafc47f6b51f3
    Status: Downloaded newer image for redis:3.2
    docker.io/library/redis:3.2

      docker运行redis:

    [mall@VM_0_7_centos ~]$ sudo docker run -p 6379:6379 --name redis -v /mydata/redis/data:/data -d redis:3.2 redis-server --appendonly yes
    55a9d1906429869ab46db6e889c44b5822f695ec81869f1cfc8f9ed0ddb48ee8

      参数说明:

      -p 6379:6379:端口映射,本地端口6379映射到docker容器端口6379

      --name redis:指定容器名称为redis

      -v /mydata/redis/data:/data:将容器的配置文件夹/data挂在到当前主机/mydata/redis/data

      -d -d redis:3.2 redis-server:以守护进程deamon运行redis服务器

      --appendonly yes:开启AOF模式持久化

      进入docker,使用redis客户端连接服务端:

    [mall@VM_0_7_centos ~]$ sudo docker exec -it redis redis-cli
    [sudo] password for mall: 
    127.0.0.1:6379> set hello world
    OK
    127.0.0.1:6379> get hello
    "world"
    127.0.0.1:6379> 
  • 相关阅读:
    dfs模板(真心不会深搜)
    背包九讲文档
    POJ3414—Pots(bfs加回溯)
    统计元音
    前m大的数(哈希入门)&&sort
    数据结构实验:哈希表
    More is better
    畅通工程&&How Many Tables
    OpenCV学习:Mat结构中的数据共享机制
    VC++ :实现简单的文件拖放(Drag and Drop)功能
  • 原文地址:https://www.cnblogs.com/wuxun1997/p/11769867.html
Copyright © 2020-2023  润新知