# 2.1 環境安裝
## 2.1.1 安裝
從redis.cn 下載最新redis包,3.0穩定版系列.
```bash
tar -zxvf redis-3.2.1.tar.gz
```
```bash
cd redis-3.2.1/
```
首先打開README.md,翻閱基本build和install方式。
```bash
make
```
嘗試環境是否可以正常使用。
```bash
make test
```
如果出現
```cpp
\o/ All tests passed without errors!
```
表示redis環境沒有問題。
最后安裝路徑
```cpp
sudo make install
```
##2.1.2 啟動redis
```bash
$redis-server
```
出現以下代表啟動成功
```bash
8652:C 22 Jul 17:16:59.587 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.1 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 8652
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
8652:M 22 Jul 17:16:59.594 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
8652:M 22 Jul 17:16:59.594 # Server started, Redis version 3.2.1
8652:M 22 Jul 17:16:59.594 # 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.
8652:M 22 Jul 17:16:59.594 * The server is now ready to accept connections on port 6379
```
##2.1.2 鏈接redis服務器
新開一個窗口,或者redis-server后臺啟動。
通過
```bash
$ redis-cli
```
得到
```bash
127.0.0.1:6379>
```
```bash
127.0.0.1:6379> ping
PONG
```
代表redis服務器已經正常安裝并且可以使用了。
- 概要
- 1 分布式存儲fastDFS
- 1.1 fastDFS 通用介紹
- 1.2 fastDFS安裝和使用
- 1.3 基于fastDFS實現分布式
- 2 緩存數據庫redis快速搭建
- 2.1 環境安裝
- 2.2 redis數據類型
- 2.3 redis訂閱發布模式
- 2.4 redis事務
- 2.5 redis備份
- 3 redis詳細攻略
- 3.1 redis簡介
- 3.2 redis使用場景
- 3.3 redis基本操作
- 3.4 redis數據類型
- 3.4.1 字符串
- 3.4.2 HASH-字典
- 3.4.3 List-列表
- 3.4.4 Set-集合
- 3.4.5 Sorted Set-有序集合
- 3.4.6 訂閱-發布
- 3.4.7 事務
- 3.5 redis配置文件
- 3.6 持久化
- 3.7 redis性能測試
- 3.8 redis-C-API
- 3.9 redis-C++-API
- 3.10 總結與建議
- 4 memcache緩存數據庫
- 4.1 什么是memcached
- 4.2 memcached的特征
- 4.3 memcached的內存管理
- 4.4 如何使用memcached
- 4.5 memcached參數詳解
- 4.6 memcached安裝
- 4.7 memcached-C客戶端
- 4.8 memcached-C++客戶端
- 5 Nginx
- 6 FastCGI
- 6.1 CGI
- 6.2 FastCGI
- 6.3 Nginx與FastCGI
- 7 Nginx上部署fastDFS
- 8 項目概要
- 8.1 上傳文件功能
- 8.2 主界面顯示與下載文件功能
- 8.3 注冊功能
- 8.4 登陸功能
- 8.5 文件分類功能
- 8.6 個人網盤功能
- 8.8 秒傳功能