linux下redis安装:
1、官网下载https://redis.io/download
wget http://download.redis.io/releases/redis-5.0.4.tar.gz
2、解压
tar xzf redis-5.0.4.tar.gz
3、进入目录编译
cd redis-5.0.4
make
4、编译成功之后,执行install操作即可:
sudo make install
5、启动服务端
redis-server & #加上`&`号使redis以后台程序方式运行
6、启动客户端
redis-cli -h127.0.0.1 -p 6379
Linux开启关闭redis
1.先启动:redis-server(redis-server redis.conf)
2.后登陆:redis-cli(redis-cli -p 6379) 使用redis-cli客户端检测连接是否正常
root@greatwall-os:/home# redis-cli
127.0.0.1:6379> set key "hello world"
OK
127.0.0.1:6379> get key "hello world"
3.关闭:redis-cli shutdown 或者kill -9 PID
root@greatwall-os:/home# redis-cli shutdown
9090:M 02 Apr 2019 14:27:10.481 # User requested shutdown...
9090:M 02 Apr 2019 14:27:10.481 * Saving the final RDB snapshot before exiting.
9090:M 02 Apr 2019 14:27:10.504 * DB saved on disk
9090:M 02 Apr 2019 14:27:10.504 # Redis is now ready to exit, bye bye...
[1]+ 已完成 redis-server
redis是否在运行:
root@greatwall-os:/home/mysoft/redis-5.0.4/src# ps aux| grep redis
root 8499 0.0 0.1 48736 9320 pts/7 Tl 13:40 0:00 src/redis-server *:6379
root 8715 0.0 0.0 15668 7624 pts/3 S+ 14:03 0:00 ./redis-cli shutdown
root 8735 0.0 0.0 12216 580 pts/7 S+ 14:06 0:00 grep --color=auto redis
从图上可以看出,redis-server 目前正在6379 端口运行
检测是否安装redis-cli与redis-server:
root@greatwall-os:~# whereis redis-cli
redis-cli: /usr/local/bin/redis-cli
root@greatwall-os:~# whereis redis-server
redis-server: /usr/local/bin/redis-server
17万+

被折叠的 条评论
为什么被折叠?



