维护
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)
<a href="https://s5.51cto.com/wyfs02/M00/9E/BF/wKioL1mVZoGw_TLgAAAX80T8X4M858.png-wh_500x0-wm_3-wmp_4-s_2231597847.png" target="_blank"></a>
如果不需要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;
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滑动升级
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
具体过程
<code>#mkdir -p /var/log/tengine</code>
<code>#touch /var/log/tengine/mod.log</code>
<code>#chmod 777 /var/log/tengine/mod.log</code>
<code>yum </code><code>-</code><code>y install gcc gcc</code><code>-</code><code>c</code><code>+</code><code>+</code> <code>gd gd</code><code>-</code><code>devel lua</code><code>-</code><code>devel lrzsz</code>
<code>cd </code><code>/</code><code>opt</code><code>/</code><code>src</code><code>/</code>
<code>tar xvzf libunwind</code><code>-</code><code>1.1</code><code>.tar.gz</code>
<code>cd libunwind</code><code>-</code><code>1.1</code>
<code>LAGS</code><code>=</code><code>-</code><code>fPIC .</code><code>/</code><code>configure </code><code>-</code><code>-</code><code>prefix</code><code>=</code><code>/</code><code>usr</code><code>/</code><code>local</code>
<code>make LAGS</code><code>=</code><code>-</code><code>fPIC</code>
<code>make LAGS</code><code>=</code><code>-</code><code>fPIC install</code>
<code>tar xvzf gperftools</code><code>-</code><code>2.0</code><code>.tar.gz</code>
<code>cd gperftools</code><code>-</code><code>2.0</code>
<code>.</code><code>/</code><code>configure </code><code>-</code><code>-</code><code>prefix</code><code>=</code><code>/</code><code>usr</code><code>/</code><code>local</code>
<code>make && make install</code>
<code>tar xvzf openssl</code><code>-</code><code>1.0</code><code>.</code><code>2.tar</code><code>.gz</code>
<code>mv openssl</code><code>-</code><code>1.0</code><code>.</code><code>2h</code> <code>openssl</code><code>-</code><code>1.0</code><code>.</code><code>2</code>
<code>cd openssl</code><code>-</code><code>1.0</code><code>.</code><code>2</code>
<code>.</code><code>/</code><code>config shared </code><code>-</code><code>-</code><code>prefix</code><code>=</code><code>/</code><code>usr</code><code>/</code><code>local</code>
<code>ln </code><code>-</code><code>s </code><code>/</code><code>usr</code><code>/</code><code>local</code><code>/</code><code>lib</code><code>/</code><code>libunwind.so </code><code>/</code><code>lib64</code><code>/</code><code>libunwind.so.</code><code>8</code>
<code>ln </code><code>-</code><code>s </code><code>/</code><code>usr</code><code>/</code><code>local</code><code>/</code><code>lib</code><code>/</code><code>libprofiler.so.</code><code>0</code> <code>/</code><code>lib64</code>
<code>mkdir </code><code>-</code><code>p </code><code>/</code><code>var</code><code>/</code><code>log</code><code>/</code><code>tengine</code>
<code>touch </code><code>/</code><code>var</code><code>/</code><code>log</code><code>/</code><code>tengine</code><code>/</code><code>error.log</code>
<code>useradd nginx</code>
<code>mkdir </code><code>-</code><code>p </code><code>/</code><code>data</code><code>/</code><code>nginx_temp</code><code>/</code><code>nginx_temp</code>
<code>mkdir </code><code>-</code><code>p </code><code>/</code><code>home</code><code>/</code><code>tengine</code>
<code>touch </code><code>/</code><code>home</code><code>/</code><code>tengine</code><code>/</code><code>mod.log</code>
<code>chmod </code><code>777</code> <code>/</code><code>home</code><code>/</code><code>tengine</code><code>/</code><code>mod.log</code>
<code>cd </code><code>/</code><code>opt</code><code>/</code><code>src</code>
<code>unzip GraphicsMagick</code><code>-</code><code>1.3</code><code>.</code><code>26</code>
<code>cd GraphicsMagick</code><code>-</code><code>1.3</code><code>.</code><code>26</code>
<code>chmod </code><code>+</code><code>x configure</code>
<code>.</code><code>/</code><code>configure </code><code>-</code><code>-</code><code>enable</code><code>-</code><code>shared </code><code>-</code><code>-</code><code>prefix</code><code>=</code><code>/</code><code>usr</code><code>/</code><code>local</code><code>/</code><code>graphicsmagick</code>
<code>make</code>
<code>make install</code>
<code>for</code> <code>i </code><code>in</code> <code>`ls </code><code>-</code><code>l|grep ^d|awk </code><code>'{print $NF}'</code><code>`;do chmod </code><code>+</code><code>x $i</code><code>/</code><code>configure;done</code>
<code>cd </code><code>/</code><code>opt</code><code>/</code><code>src</code><code>/</code><code>tengine</code><code>-</code><code>2.1</code><code>.</code><code>2</code>
<code>.</code><code>/</code><code>configure </code><code>-</code><code>-</code><code>prefix</code><code>=</code><code>/</code><code>usr</code><code>/</code><code>local</code><code>/</code><code>tengine </code><code>-</code><code>-</code><code>conf</code><code>-</code><code>path</code><code>=</code><code>/</code><code>usr</code><code>/</code><code>local</code><code>/</code><code>tengine</code><code>/</code><code>conf</code><code>/</code><code>nginx.conf </code><code>-</code><code>-</code><code>pid</code><code>-</code><code>path</code><code>=</code><code>/</code><code>var</code><code>/</code><code>log</code><code>/</code><code>tengine</code><code>/</code><code>tengine.pid </code><code>-</code><code>-</code><code>error</code><code>-</code><code>log</code><code>-</code><code>path</code><code>=</code><code>/</code><code>var</code><code>/</code><code>log</code><code>/</code><code>tengine</code><code>/</code><code>error.log </code><code>-</code><code>-</code><code>without</code><code>-</code><code>http_memcached_module </code><code>-</code><code>-</code><code>user</code><code>=</code><code>nginx </code><code>-</code><code>-</code><code>group</code><code>=</code><code>nginx </code><code>-</code><code>-</code><code>with</code><code>-</code><code>poll_module </code><code>-</code><code>-</code><code>with</code><code>-</code><code>syslog </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_image_filter_module </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_stub_status_module </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_ssl_module </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_gzip_static_module </code><code>-</code><code>-</code><code>with</code><code>-</code><code>openssl</code><code>=</code><code>/</code><code>opt</code><code>/</code><code>src</code><code>/</code><code>openssl</code><code>-</code><code>1.0</code><code>.</code><code>2</code> <code>-</code><code>-</code><code>with</code><code>-</code><code>openssl</code><code>-</code><code>opt</code><code>=</code><code>-</code><code>fPIC </code><code>-</code><code>-</code><code>with</code><code>-</code><code>zlib</code><code>=</code><code>/</code><code>opt</code><code>/</code><code>src</code><code>/</code><code>zlib</code><code>-</code><code>1.2</code><code>.</code><code>8</code> <code>-</code><code>-</code><code>with</code><code>-</code><code>pcre</code><code>=</code><code>/</code><code>opt</code><code>/</code><code>src</code><code>/</code><code>pcre</code><code>-</code><code>8.35</code> <code>-</code><code>-</code><code>with</code><code>-</code><code>http_stub_status_module </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_sub_module </code><code>-</code><code>-</code><code>add</code><code>-</code><code>module</code><code>=</code><code>/</code><code>opt</code><code>/</code><code>src</code><code>/</code><code>nginx</code><code>-</code><code>accesskey</code><code>-</code><code>2.0</code><code>.</code><code>3</code> <code>-</code><code>-</code><code>add</code><code>-</code><code>module</code><code>=</code><code>/</code><code>opt</code><code>/</code><code>src</code><code>/</code><code>ngx</code><code>-</code><code>fancyindex</code><code>/</code> <code>-</code><code>-</code><code>with</code><code>-</code><code>http_realip_module </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_sysguard_module </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_trim_filter_module</code><code>=</code><code>shared </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_rewrite_module</code><code>=</code><code>shared </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_access_module</code><code>=</code><code>shared </code><code>-</code><code>-</code><code>with</code><code>-</code><code>google_perftools_module </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_limit_conn_module</code><code>=</code><code>shared </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_limit_req_module</code><code>=</code><code>shared </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_upstream_ip_hash_module</code><code>=</code><code>shared </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_upstream_least_conn_module</code><code>=</code><code>shared </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_upstream_session_sticky_module</code><code>=</code><code>shared </code><code>-</code><code>-</code><code>with</code><code>-</code><code>google_perftools_module </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_upstream_check_module </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_concat_module</code><code>=</code><code>shared </code><code>-</code><code>-</code><code>with</code><code>-</code><code>http_lua_module </code><code>-</code><code>-</code><code>add</code><code>-</code><code>module</code><code>=</code><code>/</code><code>opt</code><code>/</code><code>src</code><code>/</code><code>nginx_tcp_proxy_module </code><code>-</code><code>-</code><code>add</code><code>-</code><code>module</code><code>=</code><code>/</code><code>opt</code><code>/</code><code>src</code><code>/</code><code>ngx_cache_purge</code><code>-</code><code>2.2</code> <code>-</code><code>-</code><code>add</code><code>-</code><code>module</code><code>=</code><code>/</code><code>opt</code><code>/</code><code>src</code><code>/</code><code>fastdfs</code><code>-</code><code>nginx</code><code>-</code><code>module</code><code>/</code><code>src</code>
<code>/</code><code>usr</code><code>/</code><code>local</code><code>/</code><code>tengine</code><code>/</code><code>sbin</code><code>/</code><code>nginx </code><code>-</code><code>c </code><code>/</code><code>usr</code><code>/</code><code>local</code><code>/</code><code>tengine</code><code>/</code><code>conf</code><code>/</code><code>nginx.conf </code><code>-</code><code>t</code>
<code>/</code><code>usr</code><code>/</code><code>local</code><code>/</code><code>tengine</code><code>/</code><code>sbin</code><code>/</code><code>nginx </code><code>-</code><code>c </code><code>/</code><code>usr</code><code>/</code><code>local</code><code>/</code><code>tengine</code><code>/</code><code>conf</code><code>/</code><code>nginx.conf</code>
本文转自 liqius 51CTO博客,原文链接:http://blog.51cto.com/szgb17/1957150,如需转载请自行联系原作者