zoukankan      html  css  js  c++  java
  • redis 4.0.11在macos 10.13.6下的安装

    一、首先系统要安装 homebrew

    $ brew install redis

    安装后的配置文件位置

    redis-server /usr/local/etc/redis.conf

    用redis-cli连接会报错:

    $ redis-cli

    Could not connect to Redis at 127.0.0.1:6379: Connection refused

    编辑配置文件 需要先开启服务端

    $ sudo vim  /usr/local/etc/redis.conf

    查找daemonize  /daemonize 把no 改为yes

    $ redis-server /usr/local/etc/redis.conf

    现在可以了

    $ redis-cli

    127.0.0.1:6379> set 'a' '123'

    OK

    127.0.0.1:6379> get 'a'

    "123"

    127.0.0.1:6379> exit

    二、配置redis

    开启远程访问,注释bind,在69行

    #bind 127.0.0.1 ::1

    增加登录密码

    查找requirepass  /requirepass ,在500行

    # requirepass foobared,记得打开注释并修改密码

    保存配置文件并退出

    重启redis服务

    先查看服务的状态:

    $ brew services list

    Name      Status  User    Plist

    kafka     stopped         

    nginx     stopped         

    redis     started wangjun /Users/wangjun/Library/LaunchAgents/homebrew.mxcl.redis.plist

    zookeeper stopped   

    重启redis服务

    $ brew services restart redis

    ==> Successfully started `redis` (label: homebrew.mxcl.redis)

    $redis-cli -a ********

    Warning: Using a password with '-a' option on the command line interface may not be safe

    127.0.0.1:6379> get 'a'

    "123"

        

  • 相关阅读:
    09.回文数
    08.字符串转换位整数
    背景图片自适应
    认证 (authentication) 和授权 (authorization) 的区别
    vue-组件之间传值
    数组对象去重
    二进制数转换十进制数
    node-删除对象中指定属性失效问题-JSON.parse实例化
    Vue-动态修改数组
    正则遇到的问题集合
  • 原文地址:https://www.cnblogs.com/herosoft/p/9717727.html
Copyright © 2011-2022 走看看