redis基本安裝

Redis原理詳解




redis 特點

  1. 基於內存
    磁盤:
    性能低,安全好。
    內存:頻繁操作,可接受丟失
    性能高,安全不好。

    redis memcache(相比較)
    2.固化
    3.支持多種數據類型
    4.支持主從和集羣


redis的安裝

[root@localhost hahaha]# ls(兩個rpm包,一個tar包,一定對應好包名和操作系統!!)
jemalloc-3.6.0-1.el6.x86_64.rpm  jemalloc-devel-3.6.0-1.el6.x86_64.rpm  redis-stable  redis-stable.tar.gz

[root@localhost redis-stable]# redis-server /tmp/hahaha/redis-stable/redis.conf &
[1] 9778
[root@localhost redis-stable]# 9778:C 28 May 15:57:09.310 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
9778:C 28 May 15:57:09.310 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=9778, just started
9778:C 28 May 15:57:09.310 # Configuration loaded
9778:M 28 May 15:57:09.313 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 4.0.9 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 9778
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

9778:M 28 May 15:57:09.328 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
9778:M 28 May 15:57:09.329 # Server initialized
9778:M 28 May 15:57:09.329 # 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.
9778:M 28 May 15:57:09.330 # 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.
9778:M 28 May 15:57:09.330 * DB loaded from disk: 0.000 seconds
9778:M 28 May 15:57:09.330 * Ready to accept connections
^C
[root@localhost redis-stable]# ps -ef|grep redis
root      9778  2434  0 15:57 pts/1    00:00:00 redis-server 127.0.0.1:6379                     
root      9783  2434  0 15:57 pts/1    00:00:00 grep redis

我們之前說過tomcat連接mysql數據庫需要mysql-connector-java驅動,那麼tomcat連接redis又需要那些驅動呢??
1.commons-logging.zip
2.commons-pool2.jar
3.jedis.jar
4.tomcat-juli.zip
5.tomcat-redis-session-manager-tomcat-java.jar
*(以上的的驅動都應該放在tomcat服務目錄下的lib目錄,驅動版本一定得注意)
除此外還需要定義連接數據庫配置文件
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章