Ubuntu安装 redis,并后台运行

Ubuntu16.04 上安装运行 redis过程。

安装:apt install reids

设置redis.conf

vi /etc/redis/redis.conf

默认情况下Redis不作为后台服务运行,这里设置为yes,即可作为后台服务运行

1
2
3
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes

启动redis 服务

redis-server /etc/redis/redis.conf

检测服务是否已经启动

1
ps -ef |grep redis

检测6379端口是否监听

1
netstat -lntp | grep 6379

检测客户端连接是否正常 使用客户端redis-cli

1
2
3
4
5
6
7
redis-cli
127.0.0.1:6379> keys *
#(empty list or set)
127.0.0.1:6379> set key "hello world"
#OK
127.0.0.1:6379> get key
#"hello world"

停止redis服务

1
redis-cli shutdown

Comments

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×