简体   繁体   English

使用外部驱动器进行PHP存储

[英]Using external drive for PHP storage

I have a PHP application, running on a centos box, that stores a large amount of user-uploaded files. 我有一个在centos框上运行的PHP应用程序,用于存储大量用户上传的文件。

Right now I am storing the data in a folder /uploads, but I am running out of space on the server. 现在,我将数据存储在文件夹/ uploads中,但是服务器上的空间不足。

I have the option of adding storage drives of 100GB. 我可以选择添加100GB的存储驱动器。 For example, drives /dev/XXXX, /dev/YYYY, and /dev/ZZZZ each have 100 GB. 例如,驱动器/ dev / XXXX,/ dev / YYYY和/ dev / ZZZZ每个都有100 GB。

I would like to know the best way to store user-uploaded files across multiple drives. 我想知道跨多个驱动器存储用户上传文件的最佳方法。 Is there a Centos directive that can join drives into one available space for PHP? 是否有一个Centos指令可以将驱动器连接到一个可用的PHP空间中? Or should I just have PHP upload files to the first drive, and when fills up, have it save to the second, etc? 还是我应该让PHP将文件上传到第一个驱动器,并且在填充后将其保存到第二个驱动器,依此类推?

Thanks! 谢谢! Ben

Logical Volume Manager (LVM) is a tool to easily expand or combine multiple hard drives into a single pool of storage and makes it easy to dynamically resize and create new partitions, even without restarting the process or without removing the volume. 逻辑卷管理器(LVM)是一种工具,可以轻松地将多个硬盘驱动器扩展或组合到单个存储池中,并且即使不重新启动进程或不删除卷也可以轻松地动态调整大小和创建新分区。 You need to do following steps: 您需要执行以下步骤:

  • Installation of lvm2 . 安装lvm2
  • Make a new partition and set the type of the partition as LVM. 新建一个分区,并将分区类型设置为LVM。
  • Create physical volume 创建物理体积
  • Create Volume group (VG) 创建卷组(VG)
  • Create a Logical Volume (LV) 创建逻辑卷(LV)
  • Create a file system on the logical volume group that is just created. 在刚创建的逻辑卷组上创建文件系统。 That it is. 这是。

Here you can find complete procedure for it. 在这里您可以找到完整的过程。 For Live demo of procedure, watch here . 有关程序的实时演示,请在此处观看。

You can use LVM (Logical Volume Manager) that enables you to create a logical volume from multiple physical volumes , but i would advise against it as if a hard drive fails, the whole logical volume might be compromised. 您可以使用LVM(逻辑卷管理器) ,使您能够从多个物理卷创建逻辑卷,但是我建议您不要这样做,就好像硬盘驱动器发生故障一样,整个逻辑卷可能会受到损害。

Have a look at AWS S3 storage , it might do the job for your project. 看一下AWS S3存储 ,它可以为您的项目完成工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM