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"

        

  • 相关阅读:
    socket server的N种并发模型
    进程、线程以及Goroutine的区别
    分布式从ACID、CAP、BASE的理论推进
    epoll的理论与IO阻塞机制
    golang面试题知识点总结
    golang中如何进行项目模块及依赖管理
    面对golang中defer,要注意什么?
    Kaggle 学习之旅
    推荐在线学习读书网站
    k8s 的 dashboard 的实践
  • 原文地址:https://www.cnblogs.com/herosoft/p/9717727.html
Copyright © 2011-2022 走看看