100%[=====================================================================================================================================================>] 1,364,993 31.0K/s in 39s
/usr/local/redis3.0.4/etc:
redis.conf
[iyunv@web1 redis-3.0.4]# vim /usr/local/redis3.0.4/etc/redis.conf
...
################################ GENERAL #####################################
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes \\默认是no改为yes,这样启动就会在后台运行
#daemonize no
...
:wq \\保存退出
[iyunv@web1 redis-3.0.4]# ln -sv /usr/local/redis3.0.4/bin/* /usr/local/bin/ \\软连接到PATH去,这样就不用输入绝对路径,可以直接使用命令。
[iyunv@web1 redis-3.0.4]# redis- \\瞧见没
redis-benchmark redis-check-aof redis-check-dump redis-cli redis-sentinel redis-server redis-trib.rb
[iyunv@web1 redis-3.0.4]# redis-server /usr/local/redis3.0.4/etc/redis.conf \\启动Redis,必须制定配置文件,不然出现如下情况
[iyunv@web1 redis-3.0.4]# redis-server
12912:C 25 Sep 10:58:42.547 # Warning: 注意这里-->no config file specified, using the default config.<--注意这里 In order to specify a config file use redis-server /path/to/redis.conf
12912:M 25 Sep 10:58:42.548 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.0.4 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 12912
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
12912:M 25 Sep 10:58:42.550 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
12912:M 25 Sep 10:58:42.550 # Server started, Redis version 3.0.4
12912:M 25 Sep 10:58:42.550 # 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.
12912:M 25 Sep 10:58:42.550 # 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.
12912:M 25 Sep 10:58:42.550 * The server is now ready to accept connections on port 6379<--这里会无休止提示,并且还会占用我们的session,session关闭则服务停止,这也是为什么配置文件我只强调“daemonize yes \\默认是no改为yes,这样启动就会在后台运行”
\\下面是正常启动访问关闭
[iyunv@web1 redis-3.0.4]# netstat -tunlp| grep 6379
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 12827/redis-server
tcp 0 0 :::6379 :::* LISTEN 12827/redis-server
[iyunv@web1 redis-3.0.4]# redis-cli
127.0.0.1:6379> exit
[iyunv@web1 redis-3.0.4]# redis-cli shutdown
[iyunv@web1 redis-3.0.4]# netstat -tunlp| grep 6379
[iyunv@web1 redis-3.0.4]#