赞
踩
安装:
wget http://download.redis.io/redis-stable.tar.gz
tar -xzvf redis-stable.tar.gz
cd redis-stable
make
cd src
make install PREFIX=/usr/local/redis
cd ../
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc
vi /usr/local/redis/etc/redis.conf //将daemonize no 改成daemonize yes
vi /etc/rc.local //在里面添加内容:/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf (意思就是开机调用这段开启redis的命令)
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
redis-server /usr/local/redis/etc/redis.conf //启动redis
pkill redis //停止redis
# 卸载redis:
rm -rf /usr/local/redis //删除安装目录
rm -rf /usr/bin/redis-* //删除所有redis相关命令脚本
m -rf /root/download/redis-4.0.4 //删除redis解压文件夹
接下里我们在配置文件redis.conf中进行相关的配置
#打开配置文件vim redis.conf
开启远程访问
将第70行的bind注释,第90行将protected-mode改为no
设置密码
取消第502行的注释,并修改密码
requirepass
接下来重启redis:
#首先查询到redis的pid后,kill掉,然后重启
[root@localhost bin]# ps -ef|grep redis
root 20940 1 0 12:12 ? 00:00:18 ./redis-server *:6379
[root@localhost bin]# kill 20940
[root@localhost bin]# ./redis-server redis.conf
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。