Linux安裝Redis

環境:Centos 6.2redis

 

redis是當前比較熱門的NOSQL系統之一,它是一個key-value存儲系統。和Memcached相似,但很大程度補償了memcached的不足,它支持存儲的value類型相對更多,包括string、list、set、zset和hash。這些數據類型都支持push/pop、add/remove及取交集並集和差集及更豐富的操做。在此基礎上,redis支持各類不一樣方式的排序。Redis數據都是緩存在計算機內存中,而且會週期性的把更新的數據寫入磁盤或者把修改操做寫入追加的記錄文件。緩存

     redis官網地址:http://www.redis.io/服務器

 

一、下載文件memcached

http://download.redis.io/releases/redis-2.8.3.tar.gz測試

redis-2.8.3.tar.gz文件下載成功後上傳至/usr/localthis

 

二、安裝spa

[root@localhost local]# mkdir /usr/local/redisserver

[root@localhost local]#tar xzf redis-2.8.3.tar.gz排序

[root@localhost local]#cd redis-2.8.3內存

[root@localhost redis-2.8.3]#make

 

三、編譯完成後,在Src目錄下,有三個可執行文件redis-server、redis-benchmark、redis-cli。而後拷貝到一個目錄下。

[root@localhost redis-2.8.3]# cd src

[root@localhost src]# cp redis-server /usr/local/redis
[root@localhost src]# cp redis-benchmark /usr/local/redis
[root@localhost src]# cp redis-cli /usr/local/redis

 

四、啓動服務器的服務

[root@localhost src]# cd /usr/local/redis
[root@localhost redis]# ll
total 13688
-rwxr-xr-x. 1 root root 4156999 Jan 1 23:26 redis-benchmark
-rwxr-xr-x. 1 root root 4229443 Jan 1 23:27 redis-cli
-rwxr-xr-x. 1 root root 5627506 Jan 1 23:26 redis-server

[root@localhost redis]# ./redis-server
[4445] 01 Jan 23:28:56.519 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
[4445] 01 Jan 23:28:56.520 * Max number of open files set to 10032
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 2.8.3 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in stand alone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 4445
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'

[4445] 01 Jan 23:28:56.543 # Server started, Redis version 2.8.3
[4445] 01 Jan 23:28:56.544 # 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.
[4445] 01 Jan 23:28:56.544 * The server is now ready to accept connections on port 6379

 

五、而後用客戶端測試一下是否啓動成功。(打開另一個終端運行,redis客戶端

[root@localhost redis]# cd /usr/local/redis

[root@localhost redis]# ./redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> get foo"bar"127.0.0.1:6379>

相關文章
相關標籤/搜索