zoukankan      html  css  js  c++  java
  • ubuntu如何安装redis

    在终端下输入

    sudo apt search redis

    查找一下发现了 redis-server

    如果找不到 你可能需要使用 update 更新一下了

    sudo apt-get update

    然后就安装

    sudo apt-get install redis-server

    安装完毕后启动 redis

    /usr/bin/redis-server

    启动后可以看到

    21154:C 26 Jun 10:27:39.157 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    21154:C 26 Jun 10:27:39.157 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=21154, just started
    21154:C 26 Jun 10:27:39.157 # Warning: no config file specified, using the default config. In order to specify a config file use /usr/bin/redis-server /path/to/redis.conf
    21154:M 26 Jun 10:27:39.157 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
    21154:M 26 Jun 10:27:39.157 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
    21154:M 26 Jun 10:27:39.157 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
                    _._                                                  
               _.-``__ ''-._                                             
          _.-``    `.  `_.  ''-._           Redis 4.0.9 (00000000/0) 64 bit
      .-`` .-```.  ```/    _.,_ ''-._                                   
     (    '      ,       .-`  | `,    )     Running in standalone mode
     |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
     |    `-._   `._    /     _.-'    |     PID: 21154
      `-._    `-._  `-./  _.-'    _.-'                                   
     |`-._`-._    `-.__.-'    _.-'_.-'|                                  
     |    `-._`-._        _.-'_.-'    |           http://redis.io        
      `-._    `-._`-.__.-'_.-'    _.-'                                   
     |`-._`-._    `-.__.-'    _.-'_.-'|                                  
     |    `-._`-._        _.-'_.-'    |                                  
      `-._    `-._`-.__.-'_.-'    _.-'                                   
          `-._    `-.__.-'    _.-'                                       
              `-._        _.-'                                           
                  `-.__.-'                                               
    
    21154:M 26 Jun 10:27:39.164 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
    21154:M 26 Jun 10:27:39.164 # Server initialized
    21154:M 26 Jun 10:27:39.164 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
    21154:M 26 Jun 10:27:39.164 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
    21154:M 26 Jun 10:27:39.164 * Ready to accept connections

    然后开一个终端 进行cli访问

    $:/etc/redis$ /usr/bin/redis-cli 
    127.0.0.1:6379> keys *
    (empty list or set)
    127.0.0.1:6379> set user name
    OK
    127.0.0.1:6379> get user
    "name"
    127.0.0.1:6379> 

    好了,就是这么简单。

  • 相关阅读:
    SQL语句字符串处理大全
    iframe的属性
    The GridView 'gv ' fired event RowEditing which wasn 't handled.
    parttime job
    一个女孩如何准备行装和安全的独自旅行
    DORADO展现中间件的实现
    在asp.net 2.0中使用自定义的provider (转)
    MemberShip 的使用介绍(转)
    DBHelper
    jQuery学习——介绍演示网站
  • 原文地址:https://www.cnblogs.com/lizhaoyao/p/13194274.html
Copyright © 2011-2022 走看看