ubuntu安装redis
切换root用户
apt-get install redis-server
然后y继续就行
redis服务会自动启动
# 检查Redis服务器系统进程
~ ps -aux|grep redis
redis 4162 0.1 0.0 10676 1420 ? Ss 23:24 0:00 /usr/bin/redis-server /etc/redis/redis.conf
conan 4172 0.0 0.0 11064 924 pts/0 S+ 23:26 0:00 grep --color=auto redis
# 通过启动命令检查Redis服务器状态
~ netstat -nlt|grep 6379
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN
# 通过启动命令检查Redis服务器状态
~ sudo /etc/init.d/redis-server status
redis-server is running
通过命令行客户端访问Redis
redis-cli
redis 127.0.0.1:6379>
# 命令行的帮助
redis 127.0.0.1:6379> help
redis-cli 2.2.12
Type: "help @" to get a list of commands in
"help " for help on
"help " to get a list of possible help topics
"quit" to exit
# 查看所有的key列表
redis 127.0.0.1:6379> keys *
(empty list or set)
强制杀死进程
用ps查看进程
ps -ef
kill -s 9 1827(进程号)
其中-s 9 制定了传递给进程的信号是9,即强制、尽快终止进程。各个终止信号及其作用见附录。
1827则是上面ps查到的PID

本文详细介绍了在Ubuntu系统中如何切换root用户并使用apt-get安装Redis服务器,包括检查Redis服务状态、使用命令行客户端连接Redis及强制关闭Redis进程的步骤。
6905

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



