Redis下载与安装
一、Redis下载地址:http://redis.io/
二、linux安装Redis
1、上传文件至linux
2、解压文件在home目录下
tar -zxvf redis-5.0.3.tar.gz
3、安装插件gcc-c++ autoconf automake
[root@gzxy redis-5.0.3]# yum -y install gcc-c++ autoconf automake
4、预编译Redis
[root@gzxy redis-5.0.3]# make
5、创建安装路径
[root@gzxy redis-5.0.3]# mkdir -p /usr/local/redis
6、安装Redis到指定路径
[root@gzxy redis-5.0.3]# make PREFIX=/usr/local/redis/ install
7、进入到Redis的bin目录
[root@gzxy ~]# cd ../usr/local/redis/bin/
redis-cli:客户端
redis-server:服务端
8、前台启动Redis:
[root@gzxy bin]# ./redis-server
9、启动默认为前台启动,需要修改为后台启动
复制redis.conf到安装路径下
[root@gzxy redis-5.0.3]# cp redis.conf /usr/local/redis/bin/
编辑redis.conf文件
[root@gzxy bin]# vim redis.conf
显示行号
:set nu
10、修改redis.conf文件第136行
修改前:136 daemonize no
修改后:136 daemonize yes
11、启动Redis,此时为后台启动
[root@gzxy bin]# ./redis-server ./redis.conf
12、查看Redis服务
[root@gzxy bin]# ps -ef | grep redis
13、修改防火墙Centos6.8
查询防火墙状态:
[root@localhost ~]# service iptables status
停止防火墙:
[root@localhost ~]# service iptables stop
启动防火墙:
[root@localhost ~]# service iptables start
重启防火墙:
[root@localhost ~]# service iptables restart
永久关闭防火墙:
[root@localhost ~]# chkconfig iptables off
永久关闭后启用:
[root@localhost ~]# chkconfig iptables on
13、注释本机ip,实现多个ip访问redis.conf69行
69 #bind 127.0.0.1
88 #protected-mode yes
#添加密码
508 requirepass 123456
14、远程连接成功,写的不好,请多见谅!