一、安装过程可能出现的问题:
- CentOS5.7默认没有安装gcc,这会导致我们无法make成功。使用yum安装:
yum -y install gcc
- make时报如下错误:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory zmalloc.h:55:2: error: #error "Newer version of jemalloc required" make[1]: *** [adlist.o] Error 1 make[1]: Leaving directory `/data0/src/redis-2.6.2/src' make: *** [all] Error 2
原因是jemalloc重载了Linux下的ANSI C的malloc和free函数。解决办法:make时添加参数。
make MALLOC=libc
- make之后,会出现一句提示
Hint: To run 'make test' is a good idea ;)
但是不测试,通常是可以使用的。若我们运行make test ,会有如下提示
[devnote@devnote src]$ make test You need tcl 8.5 or newer in order to run the Redis test make: ***[test] Error_1
解决办法是用yum安装tcl8.5(或去tcl的官方网站http://www.tcl.tk/下载8.5版本,并参考官网介绍进行安装)
yum install tcl
二、Redis连接被拒(错误日志:图一)和Redis解除保护模式(错误日志:图二)
解决方案
首先考虑是否网络是连通的。然后进行如下操作
1、首先要关闭防火墙
检查防火墙状态 sudo service iptables status
Redhat使用了SELinux来增强安全,关闭的办法为:
1. 永久有效
修改 /etc/selinux/config 文件中的 SELINUX="" 为 disabled ,然后重启。
2. 即时生效
setenforce 0
关闭防火墙的方法为:
1. 永久性生效
开启:chkconfig iptables on
关闭:chkconfig iptables off
2. 即时生效,重启后失效
开启:service iptables start
关闭:service iptables stop
2、修改redis服务器的配置文件
vi redis.conf
注释以下绑定的主机地址
# bind 127.0.0.1
3、修改redis服务器的参数配置
修改redis的守护进程为no ,不启用
127.0.0.1:6379> config set daemonize "no"
OK
修改redis的保护模式为no,不启用
127.0.0.1:6379> config set protected-mode "no"
OK