TFS--淘宝文件系统Nginx模块安装篇

1.安装yajl

yajl是一个开源的JSON库

请到这里下载: http://lloyd.github.io/yajl/

yum install cmake -y

tar xvf lloyd-yajl-2.0.1-0-gf4b2b1a.tar.gz

cd lloyd-yajl-f4b2b1a/

./configure

make && make install

 

2.安装nginx/tengine

a) 安装pcre

wget http://sourceforge.net/projects/pcre/files/pcre/8.30/pcre-8.30.tar.gz/download

tar xvf pcre-8.30.tar.gz

cd pcre-8.30

./configure --prefix=/usr/local/pcre

make

make install

b)安装nginx/tengine

wget http://tengine.taobao.org/download/tengine-1.3.0.tar.gz

下载nginx-tfs模块:https://github.com/alibaba/nginx-tfs

unzip nginx-tfs-master.zip

tar xvf tengine-1.3.0.tar.gz

cd tengine-1.3.0

./configure --prefix=/usr/local/tengine --add-module=/root/nginx-tfs-master/ --with-pcre=/root/pcre-8.30/

make

make install

c)配置nginx

具体配置细节参看这里:https://github.com/alibaba/nginx-tfs/blob/master/ReadMe.markdown

vim /usr/local/tengine/conf/nginx.conf

添加以下内容:

http {
tfs_upstream tfs_ns {
server 10.0.0.62:8108;
type ns;
#rcs_zone name=tfs1 size=128M;
#rcs_interface eth0;
#rcs_heartbeat lock_file=/logs/lk.file interval=10s;
}

tfs_body_buffer_size 2m;
tfs_send_timeout 3s;
tfs_connect_timeout 3s;
tfs_read_timeout 3s;

server {
listen 7500;
server_name 192.168.10.218;
client_max_body_size 4096m;

tfs_keepalive max_cached=50 bucket_count=10;
tfs_log "pipe:/usr/sbin/cronolog -p 30min /usr/local/tengine/logs/cronolog/%Y/%m/%Y-%m-%d-%H-%M-tfs_access.log";

location / {
tfs_pass tfs://tfs_ns;
}
}
}

启动nginx

e) API接口测试

细节参看这里:https://github.com/alibaba/nginx-tfs/blob/master/TFS_RESTful_API.markdown

模拟POST上传一个图片:

curl --data-binary @/root/1000.jpg http://192.168.10.218:7500/v1/tfs?suffix=.jpg\&simple_name=0

返回信息:

{
"TFS_FILE_NAME": "T1iRJTByJT1RXrhCrK"
}

打开浏览器浏览:

20130417172259

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值