• CentOS下配置Java开发环境安装redis


    前言

    偶然看到博客园支持markdown写博客,恰巧最近在看redis的资料,赶紧用markdown来写一份redis傻瓜式安装指南。

    安装包下载

    wget http://download.redis.io/releases/redis-5.0.5.tar.gz
    

    安装包解压

    tar -zxvf redis-5.0.5.tar.gz -C /usr/local/
    

    安装

    切换到redis目录并执行make(需要安装gcc)
    cd /usr/local/redis-5.0.5/
    make
    
    看到以下内容即执行成功
    Hint: It's a good idea to run 'make test' ;)
    make[1]: Leaving directory `/usr/local/redis-5.0.5/src'
    
    切至src目录下执行make install
    cd src/
    make install
        CC Makefile.dep
    
    Hint: It's a good idea to run 'make test' ;)
    
        INSTALL install
        INSTALL install
        INSTALL install
        INSTALL install
        INSTALL install
    

    启动

    前台启动

    1. 指定服务脚本和conf文件启动reids,出现如下图标则启动成功。
    /usr/local/redis-5.0.5/src/redis-server /usr/local/redis-5.0.5/redis.conf
                    _._                                                  
               _.-``__ ''-._                                             
          _.-``    `.  `_.  ''-._           Redis 5.0.5 (00000000/0) 64 bit
      .-`` .-```.  ```\/    _.,_ ''-._                                   
     (    '      ,       .-`  | `,    )     Running in standalone mode
     |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
     |    `-._   `._    /     _.-'    |     PID: 24440
      `-._    `-._  `-./  _.-'    _.-'                                   
     |`-._`-._    `-.__.-'    _.-'_.-'|                                  
     |    `-._`-._        _.-'_.-'    |           http://redis.io        
      `-._    `-._`-.__.-'_.-'    _.-'                                   
     |`-._`-._    `-.__.-'    _.-'_.-'|                                  
     |    `-._`-._        _.-'_.-'    |                                  
      `-._    `-._`-.__.-'_.-'    _.-'                                   
          `-._    `-.__.-'    _.-'                                       
              `-._        _.-'                                           
                  `-.__.-'                                               
    

    后台启动

    1. 修改配置文件redis.conf将默认启动方式修改为后台启动,daemonize默认值为no,即前台启动,修改为yes,即后台启动。
    vim redis.conf
    daemonize no → daemonize yes
    
    1. 执行脚本后台启动redis。
    /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf 
    4387:C 31 Jul 2020 17:56:29.083 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    4387:C 31 Jul 2020 17:56:29.083 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=4387, just started
    4387:C 31 Jul 2020 17:56:29.083 # Configuration loaded
    

    测试

    1. 登录redis客户端
     ./redis-cli 
    
    2. 查看keys
    127.0.0.1:6379> keys *
    (empty list or set)
    
    3. 存数据
    127.0.0.1:6379> set name zmc
    OK
    
    4. 取数据
    127.0.0.1:6379> get name
    "zmc"
    
    5. 退出
    127.0.0.1:6379> quit
    
    6. 关闭服务端
    ./redis-cli shutdown
    
  • 相关阅读:
    【Flask教程02】路由基本定义
    Ubuntu16.04下设置静态IP
    实例讲解虚拟机3种网络模式(桥接、nat、Host-only)
    greenplum单机安装
    GreenPlum 基础操作 入门教程
    repo
    RAW nand clear NAND eMMC
    #运算符、不同的指针类型、数组和指针、指针运算、堆、栈、静态区、只读区、下标VS指针
    LDPC知识点
    宏表达式与函数、#undef、条件编译、
  • 原文地址:https://www.cnblogs.com/bcomll/p/13411711.html
Copyright © 2020-2023  润新知