clxmm
首页
  • 01redis学习

    • 01redis开始
  • 02redis学习

    • 01redis开始
  • vue2学习

    • 01vue学习
  • centos安装zsh

    • centos安装zsh
GitHub (opens new window)
首页
  • 01redis学习

    • 01redis开始
  • 02redis学习

    • 01redis开始
  • vue2学习

    • 01vue学习
  • centos安装zsh

    • centos安装zsh
GitHub (opens new window)
  • 02redis

    • 1.Redis的优势-能干什么
      • 2.Redis的安装
        • 2.1 官网地址
        • 2.2 下载安装
        • 2.3 文档资料
    • 后端学习
    • redis02
    clxmm
    2024-06-24
    目录

    02redis

    # 1.Redis的优势-能干什么

    • 1.性能极高 – Redis能读的速度是110000次/秒,写的速度是81000次/秒
    • 2.数据类型丰富,不仅仅支持简单的key-value类型的数据,同时还提供list,set,zset,hash等数据结构
    • 3.Redis支持数据的持久化,可以将内存中的数据保持在磁盘中,重启的时候可以再次加载进行使用
    • 4.Redis支持数据的备份,即master-slave模式的数据备份

    # 2.Redis的安装

    # 2.1 官网地址

    https://redis.io/ (opens new window)

    中文:

    • http://www.redis.cn/ (opens new window)
    • https://www.redis.com.cn/documentation.html (opens new window)

    # 2.2 下载安装

    • 安装包: https://redis.io/download/ (opens new window)

    • docker 安装

      version: '3'
      services:
        redis:
          image: registry.cn-hangzhou.aliyuncs.com/zhengqing/redis:7.0.5                    # 镜像'redis:7.0.5'
          container_name: redis                                                             # 容器名为'redis'
      #    restart: unless-stopped                                                                   # 指定容器退出后的重启策略为始终重启,但是不考虑在Docker守护进程启动时就已经停止了的容器
          command: redis-server --requirepass 123456 --appendonly yes # 启动redis服务并添加密码为:123456,并开启redis持久化配置
          environment:                        # 设置环境变量,相当于docker run命令中的-e
            TZ: Asia/Shanghai
            LANG: en_US.UTF-8
          volumes:                            # 数据卷挂载路径设置,将本机目录映射到容器目录
            - "./redis/data:/data"
            - "./redis/config/redis.conf:/etc/redis/redis.conf"  # `redis.conf`文件内容`http://download.redis.io/redis-stable/redis.conf`
          ports:                              # 映射端口
            - "6379:6379"
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

    进入redis命令行

      chmod -R 777 ./redis
      # 运行 -- 单机模式
      docker-compose -f docker-compose-redis.yml -p redis up -d
      
      docker exec -it redis redis-cli -a 123456
    
    1
    2
    3
    4
    5

    # 2.3 文档资料

    源码地址 https://github.com/redis/redis (opens new window)

    在线测试: https://try.redis.io/ (opens new window)

    参考命令: http://doc.redisfans.com/ (opens new window)

    编辑 (opens new window)
    上次更新: 2024/07/30, 22:54:54
    最近更新
    01
    vue3
    02-08
    02
    vue3-1
    01-24
    03
    vue3
    01-18
    更多文章>
    Theme by Vdoing | Copyright © 2024-2025 Evan Xu | MIT License
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式