• 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
    
  • 相关阅读:
    Microsoft Artificial Intelligence Conference(2018.05.21)
    Insider Dev Tour(2018.06.28)
    AWS re:Invent(2019.01.09)
    OPPO Developers Conference(2018.12.26)
    Tencent Cloud Developers Conference(2018.12.15)
    China Intelligent Office Summit(2018.11.21)
    International Programming Retreat Day(2018.11.17)
    Intel Artificial Intelligence Conference(2018.11.14)
    OSC Source Code Innovation Salon(2018.10.20)
    Java CAS 比较并且更换值
  • 原文地址:https://www.cnblogs.com/bcomll/p/13411711.html
Copyright © 2020-2023  润新知