• 在CentOS上安装Redis


    在centos上安装Redis.

    1. yum install redis   --查看是否有redis   yum 源

    [root@localhost ~]# yum install redis
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.optus.net
     * extras: mirrors.cn99.com
     * updates: mirror.bit.edu.cn
    No package redis available.
    Error: Nothing to do
    

      

    2. yum install epel-release  --下载fedora的epel仓库

    [root@localhost ~]# yum install epel-release
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirror.optus.net
     * extras: mirrors.cn99.com
     * updates: mirror.bit.edu.cn
    Resolving Dependencies
    --> Running transaction check
    ---> Package epel-release.noarch 0:7-11 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ===================================================================================================================================
     Package                             Arch                          Version                     Repository                     Size
    ===================================================================================================================================
    Installing:
     epel-release                        noarch                        7-11                        extras                         15 k
    
    Transaction Summary
    ===================================================================================================================================
    Install  1 Package
    
    Total download size: 15 k
    Installed size: 24 k
    Is this ok [y/d/N]: y
    Downloading packages:
    epel-release-7-11.noarch.rpm                                                                                |  15 kB  00:00:00
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : epel-release-7-11.noarch                                                                                        1/1
      Verifying  : epel-release-7-11.noarch                                                                                        1/1
    
    Installed:
      epel-release.noarch 0:7-11
    
    Complete!
    

    3 .yum install redis          --安装Redis

    [root@localhost ~]# yum install redis
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    epel/x86_64/metalink                                                                                        | 6.8 kB  00:00:00
     * base: mirror.optus.net
     * epel: hkg.mirror.rackspace.com
     * extras: mirrors.cn99.com
     * updates: mirror.bit.edu.cn
    epel                                                                                                        | 5.4 kB  00:00:00
    (1/3): epel/x86_64/group_gz                                                                                 |  88 kB  00:00:00
    (2/3): epel/x86_64/primary_db                                                                               | 6.8 MB  00:00:01
    (3/3): epel/x86_64/updateinfo                                                                               | 996 kB  00:00:02
    Resolving Dependencies
    --> Running transaction check
    ---> Package redis.x86_64 0:3.2.12-2.el7 will be installed
    --> Processing Dependency: libjemalloc.so.1()(64bit) for package: redis-3.2.12-2.el7.x86_64
    --> Running transaction check
    ---> Package jemalloc.x86_64 0:3.6.0-1.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ===================================================================================================================================
     Package                        Arch                         Version                              Repository                  Size
    ===================================================================================================================================
    Installing:
     redis                          x86_64                       3.2.12-2.el7                         epel                       544 k
    Installing for dependencies:
     jemalloc                       x86_64                       3.6.0-1.el7                          epel                       105 k
    
    Transaction Summary
    ===================================================================================================================================
    Install  1 Package (+1 Dependent package)
    
    Total download size: 648 k
    Installed size: 1.7 M
    Is this ok [y/d/N]: y
    Downloading packages:
    warning: /var/cache/yum/x86_64/7/epel/packages/jemalloc-3.6.0-1.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
    Public key for jemalloc-3.6.0-1.el7.x86_64.rpm is not installed
    (1/2): jemalloc-3.6.0-1.el7.x86_64.rpm                                                                      | 105 kB  00:00:00
    (2/2): redis-3.2.12-2.el7.x86_64.rpm                                                                        | 544 kB  00:00:00
    -----------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                              733 kB/s | 648 kB  00:00:00
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
    Importing GPG key 0x352C64E5:
     Userid     : "Fedora EPEL (7) <epel@fedoraproject.org>"
     Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
     Package    : epel-release-7-11.noarch (@extras)
     From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
    Is this ok [y/N]: y
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : jemalloc-3.6.0-1.el7.x86_64                                                                                     1/2
      Installing : redis-3.2.12-2.el7.x86_64                                                                                       2/2
      Verifying  : redis-3.2.12-2.el7.x86_64                                                                                       1/2
      Verifying  : jemalloc-3.6.0-1.el7.x86_64                                                                                     2/2
    
    Installed:
      redis.x86_64 0:3.2.12-2.el7
    
    Dependency Installed:
      jemalloc.x86_64 0:3.6.0-1.el7
    
    Complete!
    

    4.  service redis start    --启动redis服务

    5. redis-cli  --进入redis

    [root@localhost ~]# ps -ef | grep redis
    root      14823  14725  0 19:41 pts/1    00:00:00 grep --color=auto redis
    [root@localhost ~]# service redis start
    Redirecting to /bin/systemctl start redis.service
    [root@localhost ~]# ps -ef | grep redis
    redis     14840      1  0 19:42 ?        00:00:00 /usr/bin/redis-server 127.0.0.1:6379
    root      14844  14725  0 19:42 pts/1    00:00:00 grep --color=auto redis
    [root@localhost ~]# redis-cli
    127.0.0.1:6379> ?
    redis-cli 3.2.12
    To get help about Redis commands type:
          "help @<group>" to get a list of commands in <group>
          "help <command>" for help on <command>
          "help <tab>" to get a list of possible help topics
          "quit" to exit
    
    To set redis-cli perferences:
          ":set hints" enable online hints
          ":set nohints" disable online hints
    Set your preferences in ~/.redisclirc  

    6. shutdown 关闭服务

    127.0.0.1:6379> shutdown SAVE
    not connected>
    not connected>
    Could not connect to Redis at 127.0.0.1:6379: Connection refused
    not connected>
    [root@localhost ~]# ps -ef | grep redis
    root      14903  14725  0 20:24 pts/1    00:00:00 grep --color=auto redis
    

      

    shutdown命令后面可以跟修饰符

    SAVE 和 NOSAVE 修饰符

      • 通过使用可选的修饰符,可以修改 SHUTDOWN 命令的表现。比如说:
      • 执行 SHUTDOWN SAVE 会强制让数据库执行保存操作,即使没有设定(configure)保存点
        执行 SHUTDOWN NOSAVE 会阻止数据库执行保存操作,即使已经设定有一个或多个保存点(你可以将这一用法看作是强制停止服务器的一个假想的 ABORT 命令)

      

     

      

      

  • 相关阅读:
    python 性能测试
    python calendar
    python datetime
    Zookeeper的功能以及工作原理
    ADB 源码分析(一) ——ADB模块简述【转】
    ADB模块源码分析(二)——adb server的启动
    C/C++中的预编译指令
    开启andriod手机的adbd,进行无线adb调试
    adb和adbd详尽分析
    adb client, adb server, adbd原理浅析(附带我的操作过程)
  • 原文地址:https://www.cnblogs.com/julymaple/p/11305374.html
Copyright © 2020-2023  润新知