软件存储网关
Software storage gateway
我有一个包含大约 2 TB 数据的文件服务器,并且每周以 50 000 files/40 gb 的速度增长。
大部分文件只用了一个星期或最多一个月就没有被访问过。
文件服务器为几个网络服务器提供文件共享服务。网页通过共享处理文件的上传和删除。
我们不想再继续扩展本地文件服务器。并且正在寻找基于云的混合存储。
我们真的不想重建任何 c# 应用程序或购买简单存储的硬件。
我们正在寻找的是一种将本地驱动器上的所有新文件复制到云端的解决方案。删除一个月未访问的本地文件。如果用户想要一个在本地删除的文件,它首先从云端下载,然后我们就可以使用它。这应该自动发生。
我更喜欢在 Azure 中使用 blob 存储,因为我们已经在那里提供了一些服务。
关于如何执行此操作的任何提示?
Azure blob 存储可以解决问题。 Blob 存储适用于文本、二进制文件、文档、媒体文件等。This tutorial on blobs 应该可以从 Azure 端为您提供所需的一切。在当前的文件服务器上,您只需要创建一个服务或作业来使用教程中的代码上传所有新文件。这是您可以优化的快速方法,此外您还需要编写逻辑来获取新文件(我假设这对您来说不是问题):
// retreive all the new files
List<System.IO.File> files = GetAllNewFiles();
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
// Retrieve reference to a blob named "myblob".
CloudBlockBlob blockBlob = container.GetBlockBlobReference("myblob");
foreach (System.IO.File file in files)
{
// Create or overwrite the "myblob" blob with contents from a local file.
using (var fileStream = file.OpenRead(@"path\myfile"))
{
blockBlob.UploadFromStream(fileStream);
}
}
此外,如果您不想将文件永久保存在云端,您可以使用 Azure Scheduler 到 运行 daily/weekly/monthly/whatever 并删除所有未保存的文件已在 X 天内从您的本地文件服务器请求。
我有一个包含大约 2 TB 数据的文件服务器,并且每周以 50 000 files/40 gb 的速度增长。
大部分文件只用了一个星期或最多一个月就没有被访问过。
文件服务器为几个网络服务器提供文件共享服务。网页通过共享处理文件的上传和删除。
我们不想再继续扩展本地文件服务器。并且正在寻找基于云的混合存储。
我们真的不想重建任何 c# 应用程序或购买简单存储的硬件。
我们正在寻找的是一种将本地驱动器上的所有新文件复制到云端的解决方案。删除一个月未访问的本地文件。如果用户想要一个在本地删除的文件,它首先从云端下载,然后我们就可以使用它。这应该自动发生。
我更喜欢在 Azure 中使用 blob 存储,因为我们已经在那里提供了一些服务。
关于如何执行此操作的任何提示?
Azure blob 存储可以解决问题。 Blob 存储适用于文本、二进制文件、文档、媒体文件等。This tutorial on blobs 应该可以从 Azure 端为您提供所需的一切。在当前的文件服务器上,您只需要创建一个服务或作业来使用教程中的代码上传所有新文件。这是您可以优化的快速方法,此外您还需要编写逻辑来获取新文件(我假设这对您来说不是问题):
// retreive all the new files
List<System.IO.File> files = GetAllNewFiles();
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
// Retrieve reference to a blob named "myblob".
CloudBlockBlob blockBlob = container.GetBlockBlobReference("myblob");
foreach (System.IO.File file in files)
{
// Create or overwrite the "myblob" blob with contents from a local file.
using (var fileStream = file.OpenRead(@"path\myfile"))
{
blockBlob.UploadFromStream(fileStream);
}
}
此外,如果您不想将文件永久保存在云端,您可以使用 Azure Scheduler 到 运行 daily/weekly/monthly/whatever 并删除所有未保存的文件已在 X 天内从您的本地文件服务器请求。