linux下安装redis

1.下载安装

  wget http://download.redis.io/releases/redis-4.0.11.tar.gz

  tar -zxvf redis-4.0.11.tar.gz

  cd redis-4.0.11

  make

  cd src/

  mkdir /usr/local/redis

  cp redis_cli redis_server /usr/local/redis

  cd ..

  cp redis.conf /usr/local/redis

  安装完毕....

2.前台启动

cd /usr/local/redis

./redis-server

3.后台启动 


 修改配置文件 redis.conf
  daemonize no  //no 改为yes
 
./redis-server redis.conf
ps
-A | grep redis 21595 ? 00:00:00 redis-server

4.客户端操作

[root@iZm5e1y15z8ms94adqia7hZ redis]# ./redis-cli 
redis 127.0.0.1:6379> set name xiaoming
OK
redis 127.0.0.1:6379> get name
"xiaoming"

5.redis-cli远程关闭redis-server 

redis-cli -h 127.0.0.1 -p 6379 shutdown

6.设置密码

修改redis.conf  
requirepass 密码
./redis-cli -h 127.0.0.1 -p 6379 -a 密码

 启动错误:

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

解决方法:
在
etc/sysctl.conf
文件中
添加
net.core.somaxconn= 1024

然后执行sysctl -p 就可以永久消除这个warning
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

解决方法: # yum install m4 # yum install autoconf

 

 

 


 






posted @ 2018-08-11 13:59  sunan  阅读(200)  评论(0编辑  收藏  举报