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> 

好了,就是這么簡單。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM