概述
一、安装准备:
yum -y install gcc-c++
yum -y install libevent
安装包:libfastcommon_v1.07.tar.gz、FastDFS_v5.05.tar.gz、fastdfs-nginx-module_v1.16.tar.gz
http://sourceforge.net/projects/fastdfs/files/
二、安装libfastcommon
cd /usr/local
tar -zxvf libfastcommon_v1.07.tar.gz
cd libfastcommon-1.0.7
./make.sh
./make.sh install
cp /usr/lib64/libfastcommon.so /usr/lib
三、安装FastDFS
tar -zxvf FastDFS_v5.05.tar.gz
cd FastDFS
./make.sh
./make.sh install
cd conf
cp * /etc/fdfs
1、编辑/etc/fdfs/tracker.conf
vim /etc/fdfs/tracker.conf
base_path=/usr/local/fastdfs/FastDFS/tracker
2、启动tracker
/usr/bin/fdfs_trackerd /etc/fdfs/tracker.conf
3、配置storage节点
vi /etc/fdfs/storage.conf
base_path=/usr/local/fastdfs/FastDFS/storage
store_path0=/usr/local/fastdfs/FastDFS/storage
tracker_server = 192.168.100.151:22122
4、启动storage节点
/usr/bin/fdfs_storaged /etc/fdfs/storage.conf
5、配置客户端
cd /usr/local/src/FastDFS/client
cp libfdfsclient.so /usr/lib
6、测试上传
/usr/bin/fdfs_test /etc/fdfs/client.conf upload xxx.png
四、安装nginx
yum install -y gcc-c++ (已安装)
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
1、解压fastdfs-nginx-module_v1.16.tar.gz
cd /usr/local/fastdfs
tar -zxf fastdfs-nginx-module_v1.16.tar.gz
2、修改fastdfs-nginx-module/src/config配置文件
把CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"
修改为:CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
把CORE_LIBS="$CORE_LIBS -L/usr/local/lib -lfastcommon -lfdfsclient"
修改为:CORE_LIBS="$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient"
实际就是把路径中的local这一层删除掉
3、复制fastdfs-nginx-module/src/mod_fastdfs.conf 到/etc/fdfs目录下并编辑
tracker_server=192.168.100.151:22122
url_have_group_name = true
storage_server_port=23000
group_name=group1
store_path0=/usr/local/FastDFS/storage
五、安装nginx
cd /usr/local/src
tar -zxf nginx-1.8.0.tar.gz
cd nginx-1.8.0
./configure --add-module=/usr/local/src/fastdfs-nginx-module/src/
make
make install
六、配置nginx
server{
listen 80;
server_name localhost;
location /group1/M00/{
ngx_fastdfs_module;
}
}
七、简单使用
导入依赖
<!-- https://mvnrepository.com/artifact/com.github.tobato/fastdfs-client -->
<dependency>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>1.26.1-RELEASE</version>
</dependency>
需要在主启动类中添加
@Import(FdfsClientConfig.class)
@Autowired
private FastFileStorageClient client;
@RequestMapping("upload")
@ResponseBody
public void upload(){
File file = new File("C:/Users/86152/Desktop/五十音图.png");
try {
StorePath storePath = client.uploadImageAndCrtThumbImage(new FileInputStream(file),file.length(),"png",null);
System.out.println(storePath.getGroup());
System.out.println(storePath.getPath());
System.out.println(storePath.getFullPath());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
最后
以上就是忐忑保温杯为你收集整理的fastdfs安装配置在idea的简单使用一、安装准备:二、安装libfastcommon三、安装FastDFS四、安装nginx五、安装nginx六、配置nginx七、简单使用的全部内容,希望文章能够帮你解决fastdfs安装配置在idea的简单使用一、安装准备:二、安装libfastcommon三、安装FastDFS四、安装nginx五、安装nginx六、配置nginx七、简单使用所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复