C:\Users\Administrator>cd c:\
c:\>cd redis-2.6
c:\redis-2.6>redis-server.exe redis.conf
测试redis
- redis-cli
- redis 127.0.0.1:6379> set foo 123
- OK
- redis 127.0.0.1:6379> get foo
- "123"
- redis 127.0.0.1:6379> exit
4.关闭服务
redis-cli shutdown
如果端口变化可以指定端口:
redis-cli -p 6379 shutdown
127.0.0.1:6379> i+j
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> set w 3
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected>
5.启动服务
[root@localhost src]# redis-server
[24502] 28 Oct 01:54:35.784 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
[24502] 28 Oct 01:54:35.784 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.13 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 24502
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
[24502] 28 Oct 01:54:35.786 # Server started, Redis version 2.8.13
[24502] 28 Oct 01:54:35.786 # 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.
[24502] 28 Oct 01:54:35.786 * DB loaded from disk: 0.000 seconds
[24502] 28 Oct 01:54:35.786 * The server is now ready to accept connections on port 6379