找到端口所在進程端口: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);
}
}