Mongo服务器二进制文件修复,Mongodb-File-Server
MongoDB File Server(基于 MongoDB 的文件服務(wù)器)
MongoDB File Server is a file server system based on MongoDB. MongoDB File Server is committed to the storage of small files, such as pictures in the blog, ordinary documents and so on.
It's using some very popular technology like:
MongoDB 3.6.4
Spring Boot 2.0.3.RELEASE
Spring Data MongoDB 2.0.8.RELEASE
Spring 5.0.7.RELEASE
Thymeleaf 3.0.9.RELEASE
Thymeleaf Layout Dialect 2.2.0
Embedded MongoDB 2.0.2
Gradle 4.5.1
基于 MongoDB 的文件服務(wù)器。MongoDB File Server 致力于小型文件的存儲(chǔ),比如博客中圖片、普通文檔等。由于MongoDB 支持多種數(shù)據(jù)格式的存儲(chǔ),對(duì)于二進(jìn)制的存儲(chǔ)自然也是不話下,所以可以很方便的用于存儲(chǔ)文件。由于 MongoDB 的 BSON 文檔對(duì)于數(shù)據(jù)量大小的限制(每個(gè)文檔不超過(guò)16M),所以本文件服務(wù)器主要針對(duì)的是小型文件的存儲(chǔ)。對(duì)于大型文件的存儲(chǔ)(比如超過(guò)16M),MongoDB 官方已經(jīng)提供了成熟的產(chǎn)品 GridFS,讀者朋友可以自行了解。
本文不會(huì)對(duì) MongoDB 的概念、基本用法做過(guò)多的介紹,有興趣的朋友可自行查閱其他文獻(xiàn),比如,筆者所著的《分布式系統(tǒng)常用技術(shù)及案例分析》一書(shū),對(duì) MongoDB 方面也有所著墨。
Features 特性
Easy to use.(易于使用)
RESTful API.
Chinese characters friendly.(中文友好)
...
APIs
Here are useful APIs.
GET /files/{pageIndex}/{pageSize} : Paging query file list.(分頁(yè)查詢文件列表)
GET /files/{id} : Download file.(下載某個(gè)文件)
GET /view/{id} : View file online.(在線預(yù)覽某個(gè)文件。比如,顯示圖片)
POST /upload : Upload file.(上傳文件)
DELETE /{id} : Delete file.(刪除文件)
How to (如何使用)
It's so easy to start up the MongoDB File Server with 2 steps.
只需要兩步。
1. Get source(獲取源碼)
$git clone https://github.com/waylau/mongodb-file-server.git
2. Run(運(yùn)行)
$gradlew bootRun
then, you can visit the application at http://localhost:8081.
Configuration (配置)
The default configuration is (默認(rèn)配置如下) :
server.address=localhost
server.port=8081
# Thymeleaf
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.cache=false
spring.thymeleaf.mode=HTML5
# limit upload file size
spring.servlet.multipart.max-file-size=1024KB
spring.servlet.multipart.max-request-size=1024KB
spring.http.multipart.max-file-size and spring.http.multipart.max-request-size limit upload file never larger than 1MB.
NOTE: default configuration will use a embedded Mongo, that means data will never persist when the MongoDB File Server restart.
You can set spring.data.mongodb.uri property to configure additional settings such as the replica set.(支持配置獨(dú)立運(yùn)行的 MongoDB 的連接方式):
spring.data.mongodb.uri=mongodb://user:secret@mongo1.example.com:12345,mongo2.example.com:23456/test
If you want to use a stanlne MongoDB server, comment out Embedded MongoDB dependencies in build.gradle file.(如果需要使用獨(dú)立運(yùn)行的 MongoDB,就把下面的依賴注釋掉):
dependencies {
...
// compile('de.flapdoodle.embed:de.flapdoodle.embed.mongo')
...
}
Detail (詳細(xì)設(shè)計(jì)說(shuō)明)
Host(托管)
Contact 聯(lián)系作者
Donate 捐贈(zèng)
Support me!
感謝您對(duì)老衛(wèi)開(kāi)源工作的支持!
捐贈(zèng)所得所有款項(xiàng)將用于開(kāi)源事業(yè)!
總結(jié)
以上是生活随笔為你收集整理的Mongo服务器二进制文件修复,Mongodb-File-Server的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 厨房油污怎么处理干净呢?
- 下一篇: web服务器是如何维护,我们如何维护We