標籤:
環境:Centos 6.2
redis是當前比較熱門的NOSQL系統之一,它是一個key-value儲存系統。和Memcached類似,但很大程度補償了memcached的不足,它支援儲存的value類型相對更多,包括string、list、set、zset和hash。這些資料類型都支援push/pop、add/remove及取交集並集和差集及更豐富的操作。在此基礎上,redis支援各種不同方式的排序。Redis資料都是緩衝在電腦記憶體中,並且會周期性的把更新的資料寫入磁碟或者把修改操作寫入追加的記錄檔案。
redis官網地址:http://www.redis.io/
1、下載檔案
http://download.redis.io/releases/redis-2.8.3.tar.gz
redis-2.8.3.tar.gz檔案下載成功後上傳至/usr/local
2、安裝
[[email protected] local]# mkdir /usr/local/redis
[[email protected] local]#tar xzf redis-2.8.3.tar.gz
[[email protected] local]#cd redis-2.8.3
[[email protected] redis-2.8.3]#make
3、編譯完成後,在Src目錄下,有三個可執行檔redis-server、redis-benchmark、redis-cli。然後拷貝到一個目錄下。
[[email protected] redis-2.8.3]# cd src
[[email protected] src]# cp redis-server /usr/local/redis
[[email protected] src]# cp redis-benchmark /usr/local/redis
[[email protected] src]# cp redis-cli /usr/local/redis
4、啟動伺服器的服務
[[email protected] src]# cd /usr/local/redis
[[email protected] 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
[[email protected] 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
5、然後用用戶端測試一下是否啟動成功。(開啟另外一個終端運行,redis用戶端)
[[email protected] redis]# cd /usr/local/redis
[[email protected] 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>
CenOS安裝Redis