维护
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
具体过程
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#mkdir -p /var/log/tengine #touch /var/log/tengine/mod.log #chmod 777 /var/log/tengine/mod.log yum - y install gcc gcc - c + + gd gd - devel lua - devel lrzsz
cd / opt / src /
tar xvzf libunwind - 1.1 .tar.gz
cd libunwind - 1.1
LAGS = - fPIC . / configure - - prefix = / usr / local
make LAGS = - fPIC
make LAGS = - fPIC install
cd / opt / src /
tar xvzf gperftools - 2.0 .tar.gz
cd gperftools - 2.0
. / configure - - prefix = / usr / local
make && make install cd / opt / src /
tar xvzf openssl - 1.0 . 2.tar .gz
mv openssl - 1.0 . 2h openssl - 1.0 . 2
cd openssl - 1.0 . 2
. / config shared - - 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
mkdir - p / var / log / tengine
touch / var / log / tengine / error.log
useradd nginx mkdir - p / data / nginx_temp / nginx_temp
mkdir - p / home / tengine
touch / home / tengine / mod.log
chmod 777 / home / tengine / mod.log
cd / opt / src
unzip GraphicsMagick - 1.3 . 26
cd GraphicsMagick - 1.3 . 26
chmod + x configure
. / configure - - enable - shared - - prefix = / usr / local / graphicsmagick
make make install cd / opt / src /
for i in `ls - l|grep ^d|awk '{print $NF}' `;do chmod + x $i / configure;done
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
make / usr / local / tengine / sbin / nginx - c / usr / local / tengine / conf / nginx.conf - t
/ usr / local / tengine / sbin / nginx - c / usr / local / tengine / conf / nginx.conf
|
本文转自 liqius 51CTO博客,原文链接:http://blog.51cto.com/szgb17/1957150,如需转载请自行联系原作者