首页 / LINUX / redis入门,linux安装
redis入门,linux安装
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了redis入门,linux安装,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2417字,纯文字阅读大概需要4分钟。
内容图文
![redis入门,linux安装](/upload/InfoBanner/zyjiaocheng/1324/9a1eb2d4b6fe49548299d376a7107924.jpg)
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
原文:https://www.cnblogs.com/hikoukay/p/11373952.html
内容总结
以上是互联网集市为您收集整理的redis入门,linux安装全部内容,希望文章能够帮你解决redis入门,linux安装所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。