redis安装

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

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值