yum安装
1.查看是否有安装包
yum list | grep redis
2. 进行安装
yum install -y redis.x86_64
3.修改/etc/redis.conf
注释掉只允许本地访问
配置redis为后台启动
将daemonize no 改成daemonize yes
修改密码
requirepass 123456
4.关闭防火墙
service iptables stop
5.启动redis
service redis start
6.停止redis
service redis stop
解压安装包进行安装
下载Redis安装包wget http://download.redis.io/releases/redis-3.2.9.tar.gz 解压Redis安装包tar -zxvf redis-3.2.9.tar.gz 安装cd redis-3.2.9 make cd src make install PREFIX=/usr/local/redis 移动配置文件到安装目录下cd ../ mkdir /usr/local/redis/etc mv redis.conf /usr/local/redis/etc
修改/etc/redis.conf注释掉只允许本地访问 配置redis为后台启动 将daemonize no 改成daemonize yes 修改密码 requirepass 123456
关闭防火墙service iptables stop
开启redis/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
连接Redis客户端
/usr/local/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a "123456" PING 结果表示成功
停止Redis服务/usr/local/redis/bin/redis-cli -h 127.0.0.1 -p 6379 -a "123456" shutdown
|