wget https://cloud.github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gznginx
執行:c++
./configure --prefix=/usrgit
make github
make installweb
wget https://codeload.github.com/happyfish100/libfastcommon/zip/masterapp
執行:測試
unzip master.zipthis
./make.sh.net
./make.sh install插件
wget https://github.com/happyfish100/fastdfs/archive/master.zip -O fastdfs-master.zip
執行:
./make.sh
./make.sh install
cd /etc/fdfs/
複製,而後配置:
cp client.conf.sample client.conf
cp tracker.conf.sample tracker.conf
cp storage.conf.sample storage.conf
注意:同一個組內的不一樣的storage的配置要相同(方便同步文件)
配置storage屬於哪一個group:
group_name=group1 (由於如今先只是配一個組,因此這裏就爲group1)
配置base_path:
原來 base_path=/data0/fastdfs-data 這裏須要改成本身的文件路徑,
如:base_path=/data0/fastdfs-data (這裏的文件目錄若是沒有,要本身新建,
否則會報錯)
配置store_path0:
這裏 store_path0=/data0/fastdfs-data 也要改成本身的文件路徑
如: store_path0=/data0/fastdfs-data (建議與bast_path同樣)
配置tracker_server:
還有:tracker_server要改成本身的trakcer_server的ip
如:tracker_server=172.16.36.245:22122
(如有特殊要求可查看文檔根據實際狀況配置)
配置base_path:
原來 base_path=/data0/fastdfs-data 這裏須要改成本身的文件路徑,
如:base_path=/data0/fastdfs-data (這裏的文件目錄若是沒有,要本身新建,
否則會報錯)
(如有特殊要求可查看文檔根據實際狀況配置)
配置base_path:
原來 base_path=/data0/fastdfs-data這裏須要改成本身的文件路徑,
如:base_path=/data0/fastdfs-data (這裏的文件目錄若是沒有,要本身新建,
否則會報錯)
配置tracker_server:
還有:tracker_server要改成本身的trakcer_server的ip
如:tracker_server=172.16.36.245:22122
(如有特殊要求可查看文檔根據實際狀況配置)
啓動tracker server
/usr/bin/fdfs_trackerd/etc/fdfs/tracker.conf restart
(備註:中止tracker server /usr/bin/stop.sh /usr/bin/fdfs_trackerd
重啓 tracker server /usr/bin/restart.sh /usr/bin/fdfs_trackered )
啓動storage server
/usr/bin/fdfs_storaged/etc/fdfs/storage.conf restart
(備註:中止storage server /usr/bin/stop.sh /usr/bin/fdfs_storaged
重啓storage server /usr/bin/restart.sh /usr/bin/fdfs_storaged
查看集羣狀況:
在任意一臺storage(tracker也能夠 ) /usr/bin/fdfs_monitor /etc/fdfs/storage.conf
)
上傳文件測試:
/usr/bin/fdfs_test /etc/fdfs/client.conf upload tff.jpeg
須要先將官網下載的源碼進行編譯,編譯依賴gcc環境,若是沒有gcc環境,須要安裝gcc,須要執行的命令:yum install gcc-c++
wget http://nginx.org/download/nginx-1.12.1.tar.gz
安裝SSL功能須要的openssl庫插件
wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz
./config
make
make install
wget http://www.zlib.net/zlib-1.2.11.tar.gz
./configure
make
make install
Wget https://ftp.pcre.org/pub/pcre/pcre-8.00.tar.gz
./configure
make
make install
進入到nginx目錄
./configure
make
makeinstall,
安裝成功以後,默認會在/usr/local 下建立nginx 目錄
安裝nginx
wget http://nginx.org/download/nginx-1.12.1.tar.gz
tar zxvf nginx-1.12.1.tar.gz
Cd nginx-1.12.1
./configure
Make
Make install
驗證安裝: ps -ef | grep nginx
啓動nginx: /usr/local/nginx/sbin/nginx
在網頁中輸入IP地址訪問,如出現Welcome to nginx! 說明安裝成功
中止nginx, /usr/local/nginx/sbin/nginx -s stop ,準備安裝插件
準備插件fastdfs-nginx-module, 並配置mod_fastdfs.conf
wget https://github.com/happyfish100/fastdfs-nginx-module/archive/master.zip -O fastdfs-nginx-module_master.zip
unzip fastdfs-nginx-module_master.zip
複製配置文件
Cp fvastdfs-nginx-module_master/src/mod_fastdfs.conf /etc/fdfs
Cp FastDFS/conf/http.conf /etc/fdfs
Cp FastDFS/conf/mime.conf /etc/fdfs
配置mod_fastdfs.conf
1.更改tracker_server的IP如:tracker_server=172.16.36.245:22122(能夠配置多個)
2.更改store_path0這個要與storaged的配置一致,如: store_path0=/data0/fastdfs
Cd nginx-1.12.1
./configure --add-module=/data0/fastdfs-nginx-module-master/src/ --prefix=/usr/local/nginx
make
make install
進入到/usr/local/nginx/conf/nginx.conf下
location /group1/M00{
root /data0/fastdfs/data;
ngx_fastdfs_module;
}
命令:ln -s /data0/fastdfs-data/data/ /data0/fastdfs-data/data/M00
/usr/local/nginx/sbin/nginx -s stop
/usr/local/nginx/sbin/nginx
lsof -i :port,使用lsof -i :port就能看見所指定端口運行的程序,同時還有當前鏈接。
中止fastdfs服務
/usr/bin/stop.sh /usr/bin/fdfs_trackerd
/usr/bin/stop.sh /usr/bin/fdfs_storaged
開啓fastdfs服務
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
檢查服務
/usr/bin/fdfs_monitor /etc/fdfs/storage.conf
ps -ef | grep fdfs? 查看nginx
ps -aux | grep fdfs
netstat -anp | grep fdfs
lsof -i :port,使用lsof -i :port就能看見所指定端口運行的程序,同時還有當前鏈接
中止nginx服務
/usr/local/nginx/sbin/nginx -s stop
啓動nginx服務
/usr/local/nginx/sbin/nginx
上傳
fdfs_test /etc/fdfs/client.conf upload ./
Storage版本不一致初步是能夠集羣的
168 : M00/00/00/CtP9qFl4aL6ALXdwARpsHw0AOZs960_big.mp4
169 : M00/00/00/CtP9qFl4as-AUaQhARpsHw0AOZs224_big.mp4
http://blog.csdn.net/xyang81/article/details/52928230 集羣參考
tracker.conf
# the tracker server port
port=22122
# HTTP port on this tracker server
http.server_port=8080
storage.conf
# the storage server port
port=23000
# the port of the web server on this storage server
http.server_port=8888
client.conf
#HTTP settings
http.tracker_server_port=80