zoukankan      html  css  js  c++  java
  • Redis安装-解压包安装

    下载地址:http://redis.io/download

    1、将下载好的redis复制到:/opt/software/redis-4.0.9.tar.gz

    2、在/opt/software/目录下执行命令:tar -zxvf redis-4.0.9.tar.gz -C /opt/local/

    3、进入/opt/local/redis-4.0.9/目录:cd /opt/local/redis-4.0.9

    4、执行make install命令;

    以上步骤可以将redis安装完成。

    将redis设置成开机启动

    1、进入redis目录:/opt/local/redis-4.0.9

    2、执行命令:./utils/install_server.sh

    3、一直默认即可:

    [root@localhost redis-4.0.9]# ./utils/install_server.sh 
    Welcome to the redis service installer
    This script will help you easily set up a running redis server
     
    Please select the redis port for this instance: [6379] 
    Selecting default: 6379
    Please select the redis config file name [/etc/redis/6379.conf] 
    Selected default - /etc/redis/6379.conf
    Please select the redis log file name [/var/log/redis_6379.log] 
    Selected default - /var/log/redis_6379.log
    Please select the data directory for this instance [/var/lib/redis/6379] 
    Selected default - /var/lib/redis/6379
    Please select the redis executable path [/usr/local/bin/redis-server] 
    Selected config:
    Port           : 6379
    Config file    : /etc/redis/6379.conf
    Log file       : /var/log/redis_6379.log
    Data dir       : /var/lib/redis/6379
    Executable     : /usr/local/bin/redis-server
    Cli Executable : /usr/local/bin/redis-cli
    Is this ok? Then press ENTER to go on or Ctrl-C to abort.
    Copied /tmp/6379.conf => /etc/init.d/redis_6379
    Installing service...
    Successfully added to chkconfig!
    Successfully added to runlevels 345!
    Starting Redis server...
    Installation successful!
    以上操作可以将redis设置为开机启动。

    PS:通过这种方式这是redis开机启动,redis的配置文件路径:/etc/redis/6379.conf

    所以如果修改redis的配置文件,修改路径应该是:/etc/redis/6379.conf

    redis安装目录下的配置文件/opt/local/redis-4.0.9/redis.conf修改会不生效;

    如果想要使用/opt/local/redis-4.0.9/redis.conf,修改/etc/init.d/redis_6379文件即可。

    redis客户端命令redis-cli任意位置执行

    将export PATH=$PATH:/opt/local/redis-4.0.9/redis-cli加入到/etc/profile最后一行
    
    [root@localhost redis-4.0.9]# vi /etc/profile
    [root@localhost redis-4.0.9]# source /etc/profile
    [root@localhost redis-4.0.9]# redis-cli 
  • 相关阅读:
    开发者论坛一周精粹(第九期)
    你刚吃的兰州牛肉面_背后就藏着大数据
    《C++覆辙录》——1.9:使用糟糕的语言
    老司机带你用MaxCompute和表格存储玩转车联网数据
    Gartner最新发布:2017年十大战略技术趋势
    js的事件的三个阶段,事件委托的原理
    Spring的AOP1
    了解SQL注入攻击
    了解XSS攻击
    了解Serialization
  • 原文地址:https://www.cnblogs.com/song-wentao/p/11291449.html
Copyright © 2011-2022 走看看