码迷,mamicode.com
首页 > 系统相关 > 详细

ubuntu如何安装redis

时间:2020-06-26 13:03:29      阅读:53      评论:0      收藏:0      [点我收藏+]

标签:specified   enabled   des   creat   mem   sudo   val   running   ring   

在终端下输入

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 cant 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访问

zhaoyao@CIT000174NB:/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> 

好了,就是这么简单。

ubuntu如何安装redis

标签:specified   enabled   des   creat   mem   sudo   val   running   ring   

原文地址:https://www.cnblogs.com/lizhaoyao/p/13194274.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!