导读 | Redis是一种高级key-value数据库。它跟memcached类似,不过数据可以持久化,而且支持的数据类型很丰富。在运维的工作中,缓存是一个非常重要的技术,静态文件的缓存我们有:nginx的缓存,squid的缓存等,数据库的缓存我们有redis和memcache等,甚至有些公司会选择做redis的集群。上次我们讲了redis的缓存的安装和简单的配置上,现在我们来看下redis的配置和后期的压测 |
设置环境变量添加redis 相关命令
Redis 的运行模式对比
在Linux系统进行make后,我们其实是可以直接进入安装包的"/usr/local/src/redis-3.2.9/src"直接运行redis的,这种呢是一种非系统守护进程的模式运行的:
[root@zbbix redis-3.2.9]# ls 00-RELEASENOTES BUGS CONTRIBUTING COPYING deps INSTALL Makefile MANIFESTO README.md redis.conf runtest runtest-cluster runtest-sentinel sentinel.conf src tests utils [root@zbbix redis-3.2.9]# pwd /usr/local/src/redis-3.2.9 [root@zbbix redis-3.2.9]# src/redis-server 9795:C 11 Jul 23:34:09.872 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf 9795:M 11 Jul 23:34:09.875 * Increased maximum number of open files to 10032 (it was originally set to 1024). _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.2.9 (00000000/0) 64 bit .-`` .-```. ```/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 9795 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://www.51sjk.com/Upload/Articles/1/0/329/329274_20220921144558456.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 9795:M 11 Jul 23:34:09.883 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 9795:M 11 Jul 23:34:09.884 # Server started, Redis version 3.2.9 9795:M 11 Jul 23:34:09.884 # 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. 9795:M 11 Jul 23:34:09.891 # 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. 9795:M 11 Jul 23:34:09.891 * The server is now ready to accept connections on port 6379 ^C9795:signal-handler (1499787252) Received SIGINT scheduling shutdown... 9795:M 11 Jul 23:34:12.419 # User requested shutdown... 9795:M 11 Jul 23:34:12.419 * Saving the final RDB snapshot before exiting. 9795:M 11 Jul 23:34:12.481 * DB saved on disk 9795:M 11 Jul 23:34:12.481 # Redis is now ready to exit, bye bye...