标签:grep 存储 inpu top image track 下载安装 依赖包 去掉
centos整个搭建所需环境资源及用途如下:
名称 IP地址 应用
tracker01 192.168.132.154 FastDFS,libfastcommon,nginx
tracker02 192.168.132.159 FastDFS,libfastcommon,nginx
storage01 192.168.132.160 FastDFS,libfastcommon,nginx,fastdfs-nginx-module
storage02 192.168.132.161 FastDFS,libfastcommon,nginx,fastdfs-nginx-module
client 192.168.132.162
安装和配置文件下载地址
链接:https://pan.baidu.com/s/1LcV9-aHekmG6iXAG5J9PYA
提取码:zvta
1. 下载安装包。保存 路径:/home/xiaozw/soft/download/
创建目录:
所有安装包
mkdir -p /opt/fastdfs
数据存储位置
mkdir -p /data/fastdfs
2. 安装libfastcommon-1.0.43.tar.gz和fastdfs-6.06.tar.gz
tar -zxvf libfastcommon-1.0.43.tar.gz
cd libfastcommon-1.0.39/
./make.sh
./make.sh install
tar -zxvf fastdfs-6.06.tar.gz
cd fastdfs-6.06/
./make.sh
./make.sh install
3. 配置tracker服务器。
#配置文件准备
#tracker节点
cp /etc/fdfs/tracker.conf.sample /etc/fdfs/tracker.conf
vim /etc/fdfs/tracker.conf
base_path=/home/xiaozw/soft/java/fastdfs/tracker
#创建目录
mkdir -p /home/xiaozw/soft/java/fastdfs/tracker
#防火墙中打开tracker服务器端口( 默认为 22122)
vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22122 -j ACCEPT
4. 配置storage服务器:
克隆trackter作为storage。
#tracker节点
cp /etc/fdfs/storage.conf.sample /etc/fdfs/storage.conf
修改storage.conf配置:
base_path = /home/xiaozw/soft/java/fastdfs/storage
store_path0 = /home/xiaozw/soft/java/fastdfs/storage
# tracker服务器IP和端口
tracker_server=192.168.132.154:22122
# tracker服务器IP和端口
tracker_server=192.168.132.156:22122
创建目录:mkdir -p /home/xiaozw/soft/java/fastdfs/storage
启动,停止tracker命令
/home/xiaozw/soft/java/fastdfs-6.06/tracker/fdfs_trackerd
/home/xiaozw/soft/java/fastdfs-6.06/tracker/stop.sh
/home/xiaozw/soft/java/fastdfs-6.06/tracker/restart.sh
/home/xiaozw/soft/java/fastdfs-6.06/init.d/fdfs_trackerd
启动tracker(192.168.132.154,192.168.132.156)
cd /etc/init.d/
启动
service fdfs_trackerd start
停止
service fdfs_trackerd stop
查看日志:
tail -f -n300 /home/xiaozw/soft/java/fastdfs/tracker/logs/trackerd.log
tail -f -n300 /home/xiaozw/soft/java/fastdfs/storage/logs/storaged.log
#查看是否启动
netstat -unltp|grep fdfs
5. 克隆tracker服务器,作为client服务器。
#client节点
cp /etc/fdfs/client.conf.sample /etc/fdfs/client.conf
base_path = /home/xiaozw/soft/java/fastdfs/tracker
tracker_server=192.168.132.154:22122
tracker_server=192.168.132.159:22122
上传图片:
/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /home/xiaozw/soft/download/1.jpg
6. 在storage服务器上安装nginx module。
进入安装包路径:
cd /home/xiaozw/soft/download
tar -zxvf fastdfs-nginx-module-1.22.tar.gz -C /home/xiaozw/soft/java/fastdfs/
#进入目录
cd /home/xiaozw/soft/java/fastdfs/fastdfs-nginx-module-1.22/src/
#修改配置文件路径去掉local
vim config
7. 安装nginx依赖包
安装nginx依赖包
把下面四条命令执行一遍。非root用户,需要切换sudo
sudo yum install pcre
sudo yum install pcre-devel
sudo yum install zlib
sudo yum install zlib-devel
#解压nginx
cd /home/xiaozw/soft/download
tar -zxvf nginx-1.19.0.tar.gz -C /home/xiaozw/soft/java/
进入目录
cd /home/xiaozw/soft/java/nginx-1.19.0
#检查
./configure --add-module=/home/xiaozw/soft/java/fastdfs/fastdfs-nginx-module-1.22/src
#
编译安装,如果没有权限,需要切换root,再安装(su - root)。
make && make install
#进入fastdfs nginx module目录
cd /home/xiaozw/soft/java/fastdfs/fastdfs-nginx-module-1.22/src
#复制配置文件。
cp mod_fastdfs.conf /etc/fdfs/
#修改配置文件
vim /etc/fdfs/mod_fastdfs.conf
connect_timeout=10
tracker_server=192.168.132.154:22122
tracker_server=192.168.132.156:22122
url_have_group_name=true
store_path0=/home/xiaozw/soft/java/fastdfs/storage
group_name=group1
group_count=1
[group1]
group_name=group1
storage_server_port=23000
store_path_count=1
store_path0=/home/xiaozw/soft/java/fastdfs/storage
8. http.conf和mime.types两个文件复制到/etc/fdfs/目录下
#进入目录
cd /home/xiaozw/soft/java/fastdfs-6.06/conf
#复制http.conf和mime.types,2个文件。
cp http.conf mime.types /etc/fdfs/
#创建软链接
ln -s /home/xiaozw/soft/java/fastdfs/storage/data/ /home/xiaozw/soft/java/fastdfs/storage/data/M00
#修改nginx配置,端口(9080)和路径。
cd /usr/local/nginx/conf/
sudo vim /usr/local/nginx/conf/nginx.conf
location ~/group([0-9])/M00 {
ngx_fastdfs_module;
}
启动nginx
sudo /usr/local/nginx/sbin/nginx
查看nginx日志:
tail -f -n300 /usr/local/nginx/logs/error.log
nginx重启,先杀死线程。然后启动。
ps -ef|grep nginx
kill -9 线程号
9. tracker节点安装nginx
tar -zxvf ngx_cache_purge-2.3.tar.gz -C /home/xiaozw/soft/java/fastdfs/
安装依赖包,
进入nginx目录:
安装cache
#解压安装nginx,安装目录/usr/local
cd /home/xiaozw/soft/download
tar -zxvf nginx-1.19.0.tar.gz -C /usr/local/
#添加cache模块
./configure --add-module=/home/xiaozw/soft/java/fastdfs/ngx_cache_purge-2.3
make && make install
#修改配置文件
cd /usr/local/nginx/conf/
vim nginx.conf
修改后配置文件nginx.conf在附件中。
启动nginx
/usr/local/nginx/sbin/nginx
查看nginx
ps -ef | grep nginx
#创建缓存路径
mkdir -p /home/xiaozw/soft/java/fastdfs/cache/nginx/proxy_cache/tmp
页面访问:http://192.168.132.159:8000/group1/M00/00/00/wKiEoF7zVRyAV0l7AABmC8cVuIw445.jpg
遇到问题。nginx404无法访问。
http://192.168.132.161:9080/group1/M00/00/00/wKiEoF7cujiAQ6lNAABmC8cVuIw463.jpg
Nginx的权限
更改nginx.conf配置文件
在配置文件第一行#user nobody;下面添加一行user root;
关闭服务再重新开启。
参考文档:https://www.cnblogs.com/zengpeng/p/11557887.html
标签:grep 存储 inpu top image track 下载安装 依赖包 去掉
原文地址:https://www.cnblogs.com/xiaozw/p/13121546.html