mogilefs + nginx 图片分布式存储
通过mogilefs + nginx实现图片的分布式存储和访问
分布存储代码 /** *key 存储的的访问路径 *storageClass nginx中配置 *file 需要分布式图片文件 */ import com.guba.mogilefs.PooledMogileFSImpl; pooledMogileFS.storeFile(key, storageClass, file);
pooledMogileFS 的spring配置文件
<bean id="pooledMogileFS" class="com.guba.mogilefs.PooledMogileFSImpl"> <constructor-arg index="0" value="yododo" /><!-- domain --> <constructor-arg index="1"><!-- trackers --> <list> <value>192.168.1.5:7001</value> </list> </constructor-arg> <constructor-arg index="2" value="100" /><!-- maxTrackerConnections --> <constructor-arg index="3" value="10" /><!-- maxIdleConnections --> <constructor-arg index="4" value="600000" /><!-- maxIdleTimeSecs --> </bean>
nginx配置文件
upstream mogile { server 192.168.1.5:7000 max_fails=1; server 192.168.1.5:7000 max_fails=1; } location /micro/photo/ { proxy_pass http://mogile; include proxy.conf; expires 45d; }
相关推荐
lbyd0 2020-11-17
sushuanglei 2020-11-12
憧憬 2020-08-21
YZR 2020-06-08
loviezhang 2020-05-30
wqbala 2020-05-10
wqbala 2020-02-14
ROES 2020-02-13
憧憬 2020-01-07
亦碎流年 2019-12-25
Cheetahcubs 2019-12-24
憧憬 2019-12-20
亦碎流年 2019-12-18
loviezhang 2019-12-18
zhangll00 2019-12-05
huangrunqing 2019-11-19