标签:fastdfs
参考
http://sofar.blog.51cto.com/353572/1656160
http://tongcheng.blog.51cto.com/6214144/1851176
https://wenku.baidu.com/view/0a5d735728ea81c759f57859.html
http://wangfeng7399.blog.51cto.com/3518031/1711589
FastDFS安装教程 http://blog.csdn.net/mingyu1016/article/details/54411321?_t=t
维护
http://blog.csdn.net/vbaspdelphi/article/category/6479651
机器
172.1.1.1 tracker
172.1.1.2 storage
172.1.1..3 storage
每一个都要配置一个nginx
1.tracker
先部署tenginx,参考 nginx改tengine,gitlab重装操作步骤
yum -y install gcc gcc-c++ gd gd-devel lua-devel
cd libunwind-1.1
LAGS=-fPIC ./configure --prefix=/usr/local
make LAGS=-fPIC
make LAGS=-fPIC install
cd gperftools-2.0
./configure --prefix=/usr/local
make && make install
ln -s /usr/local/lib/libunwind.so /lib64/libunwind.so.8
ln -s /usr/local/lib/libprofiler.so.0 /lib64
说明:
如果需要--with-http_lua_module --add-module=/opt/src/fastdfs-nginx-module/src
其实tracker可以不需要这个/opt/src/fastdfs-nginx-module/src模块的,lua需要
而storage需要fastdfs-nginx-module,可以不需要lua
cd /opt/src/fastdfs-nginx-module/src
cat config
ngx_addon_name=ngx_http_fastdfs_module
HTTP_MODULES="$HTTP_MODULES ngx_http_fastdfs_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_fastdfs_module.c"
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient"
CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64 -DFDFS_OUTPUT_CHUNK_SIZE=‘256*1024‘ -DFDFS_MOD_CONF_FILENAME=‘\"/etc/fdfs/mod_fastdfs.conf\"‘"
1.先安装fastdfs
cd libfastcommon-1.0.7;./make.sh && ./make.sh install
cd FastDFS;./make.sh && ./make.sh install (FastDFS_v5.05.tar.gz)
如果不需要fastdfs-nginx-module模块,mime.types,http.conf,mod_fastdfs.conf可以不需要。
2.安装nginx
cd /opt/src/tengine-2.1.2
./configure --prefix=/usr/local/tengine --conf-path=/usr/local/tengine/conf/nginx.conf --pid-path=/var/log/tengine/tengine.pid --error-log-path=/var/log/tengine/error.log --without-http_memcached_module --user=nginx --group=nginx --with-poll_module --with-syslog --with-http_image_filter_module --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-openssl=/opt/src/openssl-1.0.2 --with-openssl-opt=-fPIC --with-zlib=/opt/src/zlib-1.2.8 --with-pcre=/opt/src/pcre-8.35 --with-http_stub_status_module --with-http_sub_module --add-module=/opt/src/nginx-accesskey-2.0.3 --add-module=/opt/src/ngx-fancyindex/ --with-http_realip_module --with-http_sysguard_module --with-http_trim_filter_module=shared --with-http_rewrite_module=shared --with-http_access_module=shared --with-google_perftools_module --with-http_limit_conn_module=shared --with-http_limit_req_module=shared --with-http_upstream_ip_hash_module=shared --with-http_upstream_least_conn_module=shared --with-http_upstream_session_sticky_module=shared --with-google_perftools_module --with-http_upstream_check_module --with-http_concat_module=shared --with-http_lua_module --add-module=/opt/src/nginx_tcp_proxy_module --add-module=/opt/src/ngx_cache_purge-2.2 --add-module=/opt/src/fastdfs-nginx-module/src
3.tracker
sed -i ‘s%/usr/local/bin%/usr/bin%g‘ fdfs_trackerd /etc/inti.d/fdfs_trackerd start
4.nginx配置
cat fdfs_group1.conf
upstream fdfs_group1 {
consistent_hash $request_uri;
server 172.1.1.2:8080 id=100 weight=10;
server 172.1.1.3:8080 id=100 weight=10;
#server 10.0.12.143:8080 id=101 weight=10;
session_sticky;
check interval=3000 rise=2 fall=5 timeout=1000 type=tcp;
}
server {
listen 8999;
server_name 172.1.1.1;
location /group1/M00 {
proxy_next_upstream http_502 http_504 error timeout invalid_header;
proxy_cache cache_one;
proxy_cache_valid 200 304 1h;
proxy_cache_valid 301 302 30m;
proxy_cache_valid any 1m;
proxy_cache_key $host$uri$is_args$args;
add_header eleme ‘$upstream_cache_status from $host‘;
proxy_pass http://fdfs_group1;
expires 1d;
}
location ~ /purge(/.*) {
allow 127.0.0.1;
allow 10.0.0.0/8;
allow 172.0.0.0/8;
deny all;
proxy_cache_purge cache_one $host$1$is_args$args;
}
location ~ health_status {
check_status;
allow 127.0.0.1;
allow 10.0.0.0/8;
allow 172.0.0.0/8;
deny all;
}
}
2.storage安装
只有nginx配置不同
server {
listen 8080;
server_name 172.1.1.2;
location / {
root html;
index index.html index.htm;
}
location ~/group[1-3]/M00 {
root /data/fastdfs/data;
ngx_fastdfs_module;
}
}
3.其他port和ip的修改不说了。
4.说几个注意事项
nginx滑动升级
cd /opt/src/tengine-2.1.2
cp -rfp objs/nginx /usr/local/tengine/sbin/nginx
kill -USR2 1927
kill -WINCH 1927
vim 修改/etc/fdfs/mod_fastdfs.conf 保存退出
url_have_group_name = true(配置多个tracker时,应该将此项设置为true)
#include http.conf
mkdir -p /var/log/tengine
touch /var/log/tengine/error.log
useradd nginx
mkdir -p /data/nginx_temp/nginx_temp
注意点 load ngx_http_lua_module.so; tracker
本文出自 “要有梦想,万一实现了呢” 博客,请务必保留此出处http://szgb17.blog.51cto.com/340201/1957150
tenginx+ImageMagick+Lua+FastDfs
标签:fastdfs
原文地址:http://szgb17.blog.51cto.com/340201/1957150