FastDFS文件服务器服务器实现双机热备(2)


####centos install
yum -y install gcc g++ gcc-c++ autoconf automake make unzip
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
mkdir -p /usr/local/nginx/conf                    mkdir -p /usr/local/nginx/conf/vhost
mkdir -p /usr/local/nginx/logs                    mkdir -p /usr/local/nginx/cache/body
mkdir -p /usr/local/nginx/cache/fastcgi      mkdir -p /usr/local/nginx/cache/uwsgi
mkdir -p /usr/local/nginx/cache/scgi          mkdir -p /usr/local/nginx/cache/proxy
 3、配置安装
  cd  /usr/src/nginx
  tar zxvf nginx-1.6.2.tar.gz
  tar zxvf fastdfs-nginx-module_v1.16.tar.gz
 unzip ngx-cache-purge-master.zip
 unzip echo-nginx-module-master.zip
 unzip nginx-upstream-fair-master.zip
  cd nginx-1.6.2
./configure --prefix=/usr/local/nginx \
--user=nginx \
--group=nginx \
--conf-path=/usr/local/nginx/conf/nginx.conf \
--error-log-path=/usr/local/nginx/logs/error.log \
--http-log-path=/usr/local/nginx/logs/access.log \
--lock-path=/usr/local/nginx/logs/nginx.lock \
--pid-path=/usr/local/nginx/logs/nginx.pid \
--http-client-body-temp-path=/usr/local/nginx/cache/body \
--http-fastcgi-temp-path=/usr/local/nginx/cache/fastcgi \
--http-uwsgi-temp-path=/usr/local/nginx/cache/uwsgi \
--http-scgi-temp-path=/usr/local/nginx/cache/scgi \
--http-proxy-temp-path=/usr/local/nginx/cache/proxy \
--with-pcre-jit \
--with-http_random_index_module \
--with-file-aio \
--with-debug \
--with-http_addition_module \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_sub_module \
--with-poll_module \
--with-http_ssl_module \
--add-module=/usr/src/nginx/echo-nginx-module-master \
--add-module=/usr/src/nginx/nginx-upstream-fair-master \
--add-module=/usr/src/nginx/ngx_cache_purge-master \
--add-module=/usr/src/nginx/fastdfs-nginx-module/src
make


make install

*************************** 配置nginx mod_fastdfs.conf***************************
/etc/fdfs/mod_fastdfs.conf 中必须要有 #include http.conf    注意不是注释 如果是注释是:      ##include http.conf
cp /usr/src/nginx/fastdfs-nginx-module/src/mod_fastdfs.conf    /etc/fdfs/    #复制配置文件到/etc/fdfs/ 
cp /etc/fdfs/mod_fastdfs.conf  /etc/fdfs/mod_fastdfs.conf-bak                        #备份初始配置文件
mkdir -p /www/logs
vi /etc/fdfs/mod_fastdfs.conf
  base_path=/www/logs  #the base path to store log files 存放日志文件
  store_path0=/www/geebook_storage  # must same as storage.conf 
  url_have_group_name = ture
  tracker_server=192.168.10.157:22122
  tracker_server=192.168.10.158:22122
  #include http.conf
*************************** 配置nginx.conf***************************
cp    /usr/local/nginx/conf/nginx.conf    /usr/local/nginx/conf/nginx.conf-bak    #备份配置文件

八、测试fastDFS主从服务器双机热备是否成功
1、分别进入fastDFS主从服务器启动各服务
#trackerd
/usr/local/bin/stop.sh  /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
/usr/local/bin/restart.sh  /usr/local/bin/fdfs_trackerd /etc/fdfs/tracker.conf
tail -f  /www/geebook_storage/logs/*.log   
#storaged
/usr/local/bin/stop.sh  /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf

/usr/local/bin/restart.sh  /usr/local/bin/fdfs_storaged /etc/fdfs/storage.conf
tail -f  /www/geebook_tracker/logs/*.log   
#nginx
chown -R nginx.nginx /usr/local/nginx/logs/
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
tail -f  /usr/local/nginx/logs/*.log   

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/f98bb9e90417cc08f7bdf47de5c6c02f.html