linux下redis的安装和配置

1:cd /usr/src/ 进入下载目录,如果想下载到别的目录也是可以;

2:执行  wget http://download.redis.io/releases/redis-3.2.2.tar.gz 下载redis的安装文件;本宫安装的是3.2.2的版本;

3:解压   tar -zxvf redis-3.2.2.tar.gz   解压完成后如图1.1

linux下redis的安装和配置

 图1.1

4:进入  cd redis-3.2.2

5:编辑 make 这一步可能会出现一个问题,本宫安装过程中遇见的问题;

[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以延长等待时间 重新测试;如图1.2中修改

6:执行  make install PREFIX=/usr/local/redis 进行安装

安装完成后如图1.3,可能会出现没有redis.conf这个文件,可以从刚解压的redis-3.2.2/src下面mv一个;

linux下redis的安装和配置

图1.3

这样就可以启动redis的啦,在redis的bin的目录下执行;

linux下redis的安装和配置

启动的时候可能会出现的问题

1: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 ;然后sysctl -p 使配置文件生效;一定要执行