Mac、Ubuntu安装Redis

来源:互联网 发布:快手录喊麦用什么软件 编辑:程序博客网 时间:2024/06/05 09:28
  • 一、Ubuntu安装

    • Ubuntu安装Redis通过apt-get

      $sudo apt-get update$sudo apt-get install redis-server
    • Ubuntu卸载Redis通过apt-get

      $sudo apt-get remove redis-server
  • 二、Mac安装

    • Mac安装Redis通过brew

      $sudo brew update#sudo brew install redis
    • Mac卸载Redis通过brew

      brew uninstall redis
  • 三、常用操作

    • 1、启动

      //ubuntu$redis-server//mac/usr/local/Cellar/redis/4.0.1/bin/redis-server & 
    • 2、命令窗口

      $redis-cli/usr/local/Cellar/redis/4.0.1/bin/redis-cli
    • 3、验证是否安装成功

  • 四、远程服务上执行命令

    • 1、语法

      redis-cli -h host -p port -a password
    • 2、例子

      redis-cli -h 192.168.0.137 -p 6379 [-a password]
  • 五、配置文件目录

    • Mac的redis.conf位置

      /usr/local/etc/redis.conf
    • Ubuntu的redis.conf位置

      /etc/redis/redis.conf
原创粉丝点击