美文网首页
安装Redis

安装Redis

作者: 鱼__鱼 | 来源:发表于2018-09-29 17:39 被阅读0次

    Redis 是完全开源免费的,遵守BSD协议,是一个高性能的key-value数据库。
    Redis 与其他 key - value 缓存产品有以下三个特点:
    Redis支持数据的持久化,可以将内存中的数据保存在磁盘中,重启的时候可以再次加载进行使用。
    Redis不仅仅支持简单的key-value类型的数据,同时还提供list,set,zset,hash等数据结构的存储。
    Redis支持数据的备份,即master-slave模式的数据备份。

    一、yum install redis 安装

    [root@localhost ~]# yum install redis
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * webtatic: us-east.repo.webtatic.com
    Resolving Dependencies
    --> Running transaction check
    ---> Package redis.x86_64 0:3.2.12-1.el7 will be installed
    --> Processing Dependency: libjemalloc.so.1()(64bit) for package: redis-3.2.12-1.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-1.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:
    (1/2): jemalloc-3.6.0-1.el7.x86_64.rpm                                                                                                                            | 105 kB  00:00:00
    (2/2): redis-3.2.12-1.el7.x86_64.rpm                                                                                                                              | 544 kB  00:00:00
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                                                    4.4 MB/s | 648 kB  00:00:00
    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-1.el7.x86_64                                                                                                                                             2/2
      Verifying  : jemalloc-3.6.0-1.el7.x86_64                                                                                                                                           1/2
      Verifying  : redis-3.2.12-1.el7.x86_64                                                                                                                                             2/2
    
    Installed:
      redis.x86_64 0:3.2.12-1.el7
    
    Dependency Installed:
      jemalloc.x86_64 0:3.6.0-1.el7
    
    Complete!
    

    二、 redis-server -v 检查安装版本

    [root@localhost ~]# redis-server -v
    Redis server v=3.2.12 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=3dc3425a3049d2ef
    

    三、service redis start 启动redis

    [root@localhost ~]# service redis start
    Redirecting to /bin/systemctl start  redis.service
    

    四、chkconfig redis on 设置开机自启动

    [root@localhost ~]# chkconfig redis on
    Note: Forwarding request to 'systemctl enable redis.service'.
    Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service to /usr/lib/systemd/system/redis.service.
    

    五、验证是否加入开机自启动列表

    [root@localhost ~]# systemctl list-unit-files
    ...
    ...
    redis.service                                 enabled
    ...
    

    六、高级设置

    自行google一波

    七、安装php-redis扩展

    1. 查看支持插件支持
    [root@localhost ~]# yum list php71w-pecl-redis*
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * ius: mirrors.tongji.edu.cn
     * webtatic: uk.repo.webtatic.com
    Available Packages
    php71w-pecl-redis.x86_64                                                                         3.1.6-1.w7                                                                          webtatic
    
    1. yum -y install php71w-pecl-redis.x86_64 安装
    [root@localhost~]# yum -y install php71w-pecl-redis.x86_64
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * ius: mirrors.tongji.edu.cn
     * webtatic: us-east.repo.webtatic.com
    Resolving Dependencies
    --> Running transaction check
    ---> Package php71w-pecl-redis.x86_64 0:3.1.6-1.w7 will be installed
    --> Processing Dependency: php-pecl-igbinary(x86-64) for package: php71w-pecl-redis-3.1.6-1.w7.x86_64
    --> Running transaction check
    ---> Package php71w-pecl-igbinary.x86_64 0:2.0.5-1.w7 will be installed
    --> Processing Dependency: /usr/bin/pecl for package: php71w-pecl-igbinary-2.0.5-1.w7.x86_64
    --> Processing Dependency: /usr/bin/pecl for package: php71w-pecl-igbinary-2.0.5-1.w7.x86_64
    --> Running transaction check
    ---> Package php71w-pear.noarch 1:1.10.4-1.w7 will be installed
    --> Processing Dependency: php71w-xml for package: 1:php71w-pear-1.10.4-1.w7.noarch
    --> Processing Dependency: php71w-posix for package: 1:php71w-pear-1.10.4-1.w7.noarch
    --> Running transaction check
    ---> Package php71w-process.x86_64 0:7.1.22-1.w7 will be installed
    ---> Package php71w-xml.x86_64 0:7.1.22-1.w7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    =============================================================================================================================================================================================
     Package                                              Arch                                   Version                                          Repository                                Size
    =============================================================================================================================================================================================
    Installing:
     php71w-pecl-redis                                    x86_64                                 3.1.6-1.w7                                       webtatic                                 175 k
    Installing for dependencies:
     php71w-pear                                          noarch                                 1:1.10.4-1.w7                                    webtatic                                 340 k
     php71w-pecl-igbinary                                 x86_64                                 2.0.5-1.w7                                       webtatic                                  96 k
     php71w-process                                       x86_64                                 7.1.22-1.w7                                      webtatic                                  38 k
     php71w-xml                                           x86_64                                 7.1.22-1.w7                                      webtatic                                 127 k
    
    Transaction Summary
    =============================================================================================================================================================================================
    Install  1 Package (+4 Dependent packages)
    
    Total download size: 776 k
    Installed size: 4.1 M
    Downloading packages:
    (1/5): php71w-process-7.1.22-1.w7.x86_64.rpm                                                                                                                          |  38 kB  00:00:02
    (2/5): php71w-pecl-redis-3.1.6-1.w7.x86_64.rpm                                                                                                                        | 175 kB  00:00:02
    (3/5): php71w-pear-1.10.4-1.w7.noarch.rpm                                                                                                                             | 340 kB  00:00:03
    (4/5): php71w-xml-7.1.22-1.w7.x86_64.rpm                                                                                                                              | 127 kB  00:00:00
    (5/5): php71w-pecl-igbinary-2.0.5-1.w7.x86_64.rpm                                                                                                                     |  96 kB  00:00:05
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                                                        141 kB/s | 776 kB  00:00:05
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : php71w-process-7.1.22-1.w7.x86_64                                                                                                                                         1/5
      Installing : php71w-xml-7.1.22-1.w7.x86_64                                                                                                                                             2/5
      Installing : 1:php71w-pear-1.10.4-1.w7.noarch                                                                                                                                          3/5
      Installing : php71w-pecl-igbinary-2.0.5-1.w7.x86_64                                                                                                                                    4/5
      Installing : php71w-pecl-redis-3.1.6-1.w7.x86_64                                                                                                                                       5/5
      Verifying  : 1:php71w-pear-1.10.4-1.w7.noarch                                                                                                                                          1/5
      Verifying  : php71w-pecl-igbinary-2.0.5-1.w7.x86_64                                                                                                                                    2/5
      Verifying  : php71w-xml-7.1.22-1.w7.x86_64                                                                                                                                             3/5
      Verifying  : php71w-pecl-redis-3.1.6-1.w7.x86_64                                                                                                                                       4/5
      Verifying  : php71w-process-7.1.22-1.w7.x86_64                                                                                                                                         5/5
    
    Installed:
      php71w-pecl-redis.x86_64 0:3.1.6-1.w7
    
    Dependency Installed:
      php71w-pear.noarch 1:1.10.4-1.w7            php71w-pecl-igbinary.x86_64 0:2.0.5-1.w7            php71w-process.x86_64 0:7.1.22-1.w7            php71w-xml.x86_64 0:7.1.22-1.w7
    
    Complete!
    
    1. service php-fpm restart 重启php-fpm
    [root@localhost ~]# service php-fpm restart
    Redirecting to /bin/systemctl restart  php-fpm.service
    

    相关文章

      网友评论

          本文标题:安装Redis

          本文链接:https://www.haomeiwen.com/subject/yrsboftx.html