Redis二进制安装

Redis二进制安装

(0) cd /usr/src 进入下载目录

(1) yum install -y wget gcc make tcl 安装依赖

(2) wget http://download.redis.io/releases/redis-3.2.2.tar.gz 下载源码包     redis官网http://www.redis.io

(3) tar -zxvf redis-3.2.2.tar.gz     解压

(4) cd redis-3.2.2    进入redis目录   

(5) make  编译

(6) make test 测试     

 

测试结果如下,正常

\o/ All tests passed without errors!

扫描二维码关注公众号,回复: 2618633 查看本文章

Cleanup: may take some time... OK

make[1]: Leaving directory `/app/redis-3.2.11/src'

 

测试过程报错

[exception]: Executing test client: NOREPLICAS Not enough good slaves to write..

NOREPLICAS Not enough good slaves to write.

while executing

这种情况下,可以修改当前目录文件tests/integration/replication-2.tcl,将after 1000改为after 10000以延长等待时间 重新测试

(7) make install     PREFIX未指定目录,默认安装到/usr/local/bin里面了

该目录下生成几个可执行文件

redis-benchmark   性能测试程序

redis-check-aof

redis-check-rdb

redis-cli     客户端可执行程序

redis-server  服务端可执行程序

(8)启动redis服务 redis-server  不加配置文件为默认,一般需加redis.conf

启动后出现的错误及解决办法

WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

解决方法:往/etc/sysctl.conf 中添加vm.overcommit_memory = 1

 

WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128

解决方法:echo 511 > /proc/sys/net/core/somaxconn    写到/etc/rc.local里面   rc.local 是开机启动程序 是一个软连接  (确定两者都有执行权限)lrwxrwxrwx. 1 root root 13 Aug  2 07:50 /etc/rc.local -> rc.d/rc.local

 

WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.

解决方法:echo never > /sys/kernel/mm/transparent_hugepage/enabled 写到/etc/rc.local里面

还有想在后台运行的话修改配置redis.conf   daemonize yes 就可以了

 

Redis的启动,查看,关闭,登录,退出,帮助

启动命令(全路径/usr/local/redis/bin/redis-server

redis-server(命令)    /usr/local/redis/etc/redis.conf (配置文件) &  (为redis-server指定配置文件并后台启动)

查看命令

Ps -ef |grep redis     或   netstat -anptu|grep 6379  或  lsof -i :6379

关闭命令

redis-cli  shutdown  参数(-h -p -u -a 对应 ip地址,端口号,用户名,密码   注意,参数放在前面

登录命令

redis-cli    参数(-h -p -u -a 对应 ip地址,端口号,用户名,密码

退出命令

127.0.0.1:6379> quit

命令帮助

Redis-server   --help  或  redis-cli   --help

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


猜你喜欢

转载自blog.51cto.com/13648313/2156241