redis基本安装
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了redis基本安装相关的知识,希望对你有一定的参考价值。
redis 特点
-
基于内存
磁盘:
性能低,安全好。
内存:频繁操作,可接受丢失
性能高,安全不好。redis memcache(相比较)
2.固化
3.支持多种数据类型
4.支持主从和集群
redis的安装
[[email protected] 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
[[email protected] redis-stable]# redis-server /tmp/hahaha/redis-stable/redis.conf &
[1] 9778
[[email protected] 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
[[email protected] 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目录,驱动版本一定得注意)
除此外还需要定义连接数据库配置文件
以上是关于redis基本安装的主要内容,如果未能解决你的问题,请参考以下文章