跳到主要内容
博客开发人员工具使用Object Storage 作为Nextcloud

使用对象存储作为 Nextcloud 的主要存储

使用对象存储作为 Nextcloud 的主要存储

这篇文章最初发表在我们的 社区作者:Mike Fischler,Linode客户支持专家。

您可以使用 LinodeObject Storage 作为您的 Nextcloud如果您不熟悉Nextcloud ,它是一个开源的生产力和存储管理平台,类似于 Google Drive、OneDrive 和 Dropbox 等闭源服务)。然后,您就可以使用Nextcloud丰富的应用程序库为不同的团队设置群文件夹,为单个用户分配带宽限制等。

使用这种安全的替代方法与 LinodeObject Storage 进行交互,无需担心访问控制列表、存储桶策略或命令行。在我们开始之前,需要注意的是,当你使用对象存储作为主存储时,没有任何元数据(名称、目录结构等)会存储在存储桶中。元数据只会存储在数据库中,而存储桶只会通过唯一标识符来保存文件内容,因此从Nextcloud 以外无法访问保存在对象存储桶中的任何内容。

首先,为这个项目专门创建一套访问密钥和一个对象存储桶。虽然不是必须的,但如果出现任何安全问题,你可以灵活地撤销密钥和删除存储桶而不影响其他项目。关于这些步骤的帮助,请参考下面的链接。

拥有一个可以指向该Nextcloud 部署的域名也会有帮助。我们的Nextcloud "一键式 "应用程序可以自动配置DNS记录,所以你所需要做的就是确保你的域名能够指向Linode名称服务器。如果需要,你可以在下面找到它们的列表。请记住,名称服务器的变化可能需要48小时来传播。

ns1.linode.com
ns2.linode.com
ns3.linode.com
ns4.linode.com
ns5.linode.com

调出Nextcloud OCA的配套指南,并跟着走,直到你到达 "部署后开始 "部分。当你到达这一点时,试着加载该指南中显示的Nextcloud 设置页面。如果你能看到那个页面,说明安装成功了。我们还没有准备好完成安装过程,所以你可以暂时关闭那个屏幕。在这一点上填写会引起很多问题,所以先不要完成。

接下来,打开一个与Linode的SSH会话,然后cd到/var/www/nextcloud/config目录。在该目录下创建一个名为storage.config.php的文件,并粘贴下面的例子。记住要填入适当的字段。

<?php
$CONFIG = array(
    'objectstore' => array(
        'class' => '\\OC\\Files\\ObjectStore\\S3',
        'arguments' => array(
                'bucket'   => '<BUCKET_NAME>',
                'key'      => '<ACCESS_KEY>',
                'secret'   => '<SECRET_KEY>',
                'use_ssl'  => true,
                'hostname' => '<HOSTNAME_FOR_OBJ_REGION>',
        ),
    ),
);

一旦完成,你可以保存该文件,返回到之前的Nextcloud 设置页面,并完成设置过程。为了使这个项目发挥作用,storage.config.php文件必须在你完成设置之前存在。

如果一切运行正常,您应该可以看到Nextcloud hub 页面,如 "部署后开始使用 "部分步骤 4 所示。现在,您已经拥有了一个由 LinodeObject Storage Bucket 支持的Nextcloud 服务器。在这里,您可以开始从Nextcloud 库中安装应用程序,并调整设置以满足您的特定需求。为了让您尽快上手,我在下面列出了一些我最喜欢的应用程序。

加入Linode 社区,发表您的问题。如果你的帖子被选中出现在Linode博客上,我们将向你发送一件Linode T恤。


评论 (7)

  1. Author Photo

    the link to https://docs.nextcloud.com/server/latest/user_manual/files/quota.html is broken.

    any soft/hard file on a single file? I didn’t found it anywhere. I use nextcloud primary on Dedicated server, I have a lot of big > 5 GB

    another question, how to move my current data to Linode Object Storage? Any seamless way to do that without transferring data manually?

  2. Author Photo

    Many thanks for the detailed tips – much appreciated.

  3. Author Photo

    hi , I followed the above article and after creating the file , i get the below error

    Internal Server Error

    The server encountered an internal error and was unable to complete your request.
    Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
    More details can be found in the server log.

    What happens ?

  4. Author Photo

    This didn’t work for me.

    When creating the file storage.config.php, the path didn’t exist. I had to create the www/nextcloud/config directory first. Then the install completely ignored it and used /mnt/ncdata for its storage anyway.

留下回复

您的电子邮件地址将不会被公布。 必须填写的字段被标记为*