码迷,mamicode.com
首页 > 其他好文 > 详细

Contos7下安装Redis

时间:2018-11-29 22:29:23      阅读:237      评论:0      收藏:0      [点我收藏+]

标签:detail   127.0.0.1   isa   oauth   contos   make   figure   html   load   

第一步:在线下载Redis的安装包

cd /opt/
wget http://download.redis.io/releases/redis-5.0.2.tar.gz

`ps:也可自行下载到本地,让后上传到 opt 目录下`

第二步:解压下载Redis源码压缩包

tar -zxvf redis-5.0.2.tar.gz

`ps:使用 rm -rf redis-5.0.2.tar.gz 可删除下载`

第三步:编译源代码

cd redis-5.0.2/
make

第四步:安装Redis

cd src/
make install

第五步:配置Redis服务

cd /opt/redis-5.0.2/
./utils/install_server.sh

`ps:然后一路回车`

第六步:安装完成

  • 查看Redis进程: ps -ef|grep redis

  • Redis客户端:redis-cli

  • 启动Redis:service redis_6379 start

  • 停止Redis (安全关闭,不要使用kill,防止数据丢失):

    启动客户端:redis-cli -a 123456

    安全关闭:SHUTDOWN

出现的问题

(error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.

原因:强制关闭Redis快照导致不能持久化。

解决方案:运行 config set stop-writes-on-bgsave-error no

为redis设置访问密码

vim /etc/redis/6379.conf

修改:#requirepass foobared 为 requirepass 123456 
重启redis,这样redis访问密码就设置为123456了

再次进入 redis-cli 
输入命令 keys* 进行操作时会提示 (error) NOAUTH Authentication required. 
这时只要输入:auth 123456 即可操作

修改redis远程访问

vim /etc/redis/6379.conf

修改 bind 127.0.0.1 为 # bind 127.0.0.1 (其实就是注释掉哈)
重启redis即可远程访问

Windows redis客户端

Redis Desktop Manager
官网下载地址:https://redisdesktop.com/download
然后按照 https://www.cnblogs.com/zheting/p/7670154.html 来使用就OK了。

end

Contos7下安装Redis

标签:detail   127.0.0.1   isa   oauth   contos   make   figure   html   load   

原文地址:https://www.cnblogs.com/lixingwu/p/10041159.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!