zoukankan      html  css  js  c++  java
  • redis入门,linux安装

    1.下载 https://redis.io/download
    2.上传到linux服务器tools文件夹下
    3.解压到安装目录 tar -zxf /app/redis/redis-5.0.4.tar.gz
    4.进入解压文件目录使用make对解压的Redis文件进行编译 
        cd /app/redis/redis-5 
        make
    5.编译完成后进入src 用make install 进行安装
        部署
        1.为了方便管理,将Redis文件中的conf配置文件和常用命令移动到统一文件中
        mv redis.conf /app/redis/etc/
        进入src目录,移动mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server到/app/redis/bin/
        执行命令 :mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-server /app/redis/bin/
        执行./redis-server 启动redis
    6.设置后台启动redis
        1)、首先编辑conf文件,将daemonize属性改为yes(表明需要在后台运行)
        cd etc/
        vim redis.conf
        将no修改为yes
        2)、再次启动redis服务,并指定启动服务配置文件
        ./redis-server /app/redis/etc/redis.conf
    7.设置linux 通行端口redis(6379)并重启防火墙 service iptables resestart
    8.查看进程netstat -tunpl|grep 6379
    Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketTimeoutException: connect timed out
    出现以上问题 redis.conf 中bind 127.0.0.1 未用#注释掉
    1)机器之间网络无法联通
    2)ip和端口号不正确
    3)虚拟机中防火墙的原因(可能性较大)
    4)redis.conf 中bind 127.0.0.1 未用#注释掉
    Exception in thread "main" redis.clients.jedis.exceptions.JedisDataException: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside.
    出现以上问题解决方案
    1)[root@localhost bin]# cd /app/redis/redis-5.0.4/src/ 进入该目录
    2)[root@localhost src]# ./redis-cli    执行该命令
    127.0.0.1:6379> config set protected-mode "no" 将受保护模式改为no
  • 相关阅读:
    Python
    算法的时间复杂度和空间复杂度-总结
    列表自动滚动
    React 结合ant-mobile 省市区级联
    5G从小就梦想着自己要迎娶:高速率、低时延、大容量三个老婆
    一文读懂GaussDB(for Mongo)的计算存储分离架构
    cpu占用过高排查
    我是如何从零开始自学转行IT并进入世界500强实现薪资翻倍?
    Linux重定向用法详解
    说出来也许你不信,我被 Linux 终端嘲笑了……
  • 原文地址:https://www.cnblogs.com/hikoukay/p/11373952.html
Copyright © 2011-2022 走看看