找到端口所在进程端口:netstat -ano| findstr 10001
删除进程: taskkill /f /pid 16340
接下来进入正题:
安装FastDFS
结果:
配置nginx
由于docker容器中已经集成了Nginx,我们只需要修改docker中的nginx配置,进入storage的容器内部:
docker exec -it -storage /bin/bash
找到nginx(无需配置均可):cd etc/nginx,里面的配置文件nginx.conf文件:
注意nginx的监听端口是8080
文件上传微服务
1.FastDFS文件上传微服务配置客户端配置文件:fdfs_client.conf
#fastDFS的客户端访问配置文件
connect_timeout=60
network_timeout=60
charset=UTF-8
#Tracker的Http请求端口
http.tracker_http_port=8080
tracker_server=101.200.240.33:22122
2.application.yml
spring:
application:
name: topgame-service-file
servlet:
multipart:
max-file-size: 10MB
max-request-size: 10MB
server:
port: 10004
eureka:
client:
service-url:
defaultZone: http://127.0.0.1:7001/eureka/
instance:
prefer-ip-address: true
feign:
hystrix:
enabled: true
3.pom.xml
<dependencies>
<dependency>
<groupId>net.oschina.zcx7878</groupId>
<artifactId>fastdfs-client-java</artifactId>
<version>1.27.0.0</version>
</dependency>
<dependency>
<groupId>com.topgame</groupId>
<artifactId>topgame-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
4.启动类
@EnableEurekaClient
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
// 需要关闭数据库的自动配置
public class FileMain1004 {
public static void main(String[] args) {
SpringApplication.run(FileMain1004.class,args);
}
}