图书馆管理系统 (3) — 储存照片的 MinIO

图书馆系统可以儲存书和读者的照片吗?

可以的,我们用一个叫做 MinIO 對象儲存 ( Object Storage,台湾称为物件型儲存 ) 的软件储存,不同于之前的版本,我们把照片放在关联性资料库(Relational Database System, 如 mysql, postgresql, oracle 等)内,但关联性资料库并不适合储存照片 ( 现代的资料库如 mssql, oracle 已经解决这问题,但是我们没钱买这么贵的系统 )。

什么是對象儲存呢?

简单说就是像 Google Drive 这样的东西。想多了解可以看看以下视频:

What is Object Storage – Whiteboard Session

或者一些简单介绍 : 何謂物件型儲存

网上的资料很多,随便找都可以找到一大堆。

那为什么选用 MinioIO?

因为它免费、简单、好用,用 golang 语言写的,快!

如果想安装小绿洲图书馆管理系统,但是我们不需要照片!

当然也可以 ! 东西也简单多了。

如果想储存照片,你需要到 MinIO 的网站下载它的软件,它有文档, 安装程序 也是很简单,

object storage.jpg

下载了 minio.exe 后,放到你要的地方 (例如 E:\minio , 图片则放在 E:\minio\data) ,键入

D:\minio> minio.exe server E:\minio\data

如在我的电脑里的情况是:

minio server.jpg

程式开跑后就会看到,

run
(图 3) Access Key 和 Secret Key 可以在这里找到

恭喜你,你成功安装了MinIO server !

然后你可以在

再开一个 Browser, 键入 http://localhost:9000 , 你就会来到以下这页,

login.jpg

键入 Access Key 和 Secret Key (参考图 3)则可进入MiniIO 的 图形用户界面,

5

那 MinIO server 又是如何的跟小绿洲图书馆系统有关系呢?

关系的设定就在小绿洲源码内的一个文件 application.properties 内,

aa.jpg

只要设定好,在 E:\minio\data 内开4个 folder:

biblio, biblio-thumbnail,patron,patron-thumbnail,再把图片放到 “biblio-thumbnail” (读者的照片则放到 “patron-thumbnail” 内),那系统内你就可以看见图片,(patron 和 biblio folder 呢?你可以放高精密的图片,这对你的系统的显示没有影响,只是一个备份)

ada.jpg

要不然则看不见,

no image.jpg

系统内书的图片对应的是以 MinioIO 内图片的档名 ( 通常会用 ISBN 做档名 ) 对书目(Bibliography) 的 “Image Id” ,读者的图片则以 IC No. 对应, 要不然就不能显示!

imageId.jpg

mapping.jpg

选择这个MiniIO object storage 是有用意的,它将是我们以后发展数字图书馆 (Digital Library) 的基础 —— 底层资料库!

将 MinIO server 设定成一个 服务(Service)

我们不希望每一次都要手动用 cmd 开启 MinIO service, 能不能简单一点,每一次开机的时候自动开启呢?可以的,把它设成一个服务(Service) 即可,方法如下(这里的例子是 Windows 10),

winsw is a wrapper to run any executable as an Windows service.

  1. 下载 WinSW.NET4.exe
  2. Rename the WinSW.NET4.exe to minio-service.exe , then put “minio-service.exe” into the same folder as minio.exe.
  3. Create a xml file minio-service.xml insert the configuration below,  then put “minio-service.xml” into the same folder as minio.exe.
  4. Open a cmd as Administrator and execute minio-service.exe install

minio-service.xml

<service>
  <id>MinIO</id>
  <name>MinIO</name>
  <description>MinIO is a high performance object storage server</description>
  <executable>minio.exe</executable>
  <arguments>server E:\minio\data</arguments>
  <logmode>rotate</logmode>
</service>

打开一个 cmd (as Administrator), change directory to E:\minio (我的电脑,放minio.exe 的地方,你的则不同,在于你要把 minio.exe 放哪里),之后在文件夹(folder) “minio” 执行 “minio-service.exe install” 即可。

cmd.jpg

cmd2.jpg

如果你做的对,你把Service 找出来后,你将会看到 MinIO 在服务了,以后开机关机都不用烦了,它会自动开启!

service0.jpg

service2.jpg

那要关闭它如何呢?双击上面的MinIO service,开启底下窗口,“Stop” , 重开则 “Start” , 如果想改变开机是“自动” 或“手动”开启,则用 “Startup type”,

service1.jpg

 

 

 

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

您正在使用您的 WordPress.com 账号评论。 注销 /  更改 )

Facebook photo

您正在使用您的 Facebook 账号评论。 注销 /  更改 )

Connecting to %s