Redis相关命令

280 阅读1分钟

1. redis是否正在运行

  • ps aux | grep redis

    • ps: 命令是program status的缩写,意为程序状态,可以查看当前的程序状态。
    • aux:
        -a 显示所有用户的进程
    
        -u 显示用户名和启动时间
    
        -x 显示所有进程,包括没有控制终端的进程
    
    • |: 管道导向符号
    • grep redis:(global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来。
  • netstat -lntp

2. 启动redis

  • redis-server /etc/redis.conf

3. 关闭redis

  • 不带密码:

    • /usr/bin/redis-cli shutdown
  • 带密码:

    • redis-cli -a [password]
    • shutdown

参考文献

[1] blog.csdn.net/dream2009gd… [2] blog.csdn.net/wg22222222/…