2
0

More than 3 years have passed since last update.

「さくらのVPS」のサーバーで「さくらのクラウド」のオブジェクトストレージをマウントしてみる

Last updated at Posted at 2021-09-07

はじめに

動画を大量に扱うサービスを開発していて、サーバの容量が足りなくなった時にどうしようかと考えていて、色々と検討した末にオブジェクトストレージを使用することにしたので、オブジェクトストレージをマウントする手順をメモしておく。

開発中のサービスは以下のようなもの。
https://streaming.blueomega.jp

ちなみに、OSはUbuntu20.xを利用。

インストール

$ sudo apt install -y s3fs awscli
$ wget https://github.com/kahing/goofys/releases/latest/download/goofys
$ chmod a+x goofys
$ sudo mv goofys /usr/local/bin/

設定

$ aws configure
AWS Access Key ID [None]: [パーミッションのアクセスキーID]
AWS Secret Access Key [None]: [パーミッションのシークレットアクセスキー]
Default region name [None]: jp-north-1
Default output format [None]: 何も入力せずにENTER

ファイルの一覧が取得できるか確認する。

$ aws --endpoint-url=https://s3.isk01.sakurastorage.jp s3 ls s3://[バケット名]/ --summarize --recursive

マウントさせてみる

$ /usr/local/bin/goofys --endpoint=https://s3.isk01.sakurastorage.jp [バケット名] [マウントポイント]

アンマウント。

$ fusermount -u /home/tmp/

マウントしたディレクトリのアクセス権を変更できるように設定を変更。

$ sudo nano /etc/fuse.conf 

以下の#を削除

#user_allow_other

起動時にマウントされるよう設定

crontabで設定

$ crontab -e

以下のコマンドを追記

@reboot /usr/local/bin/goofys --endpoint=https://s3.isk01.sakurastorage.jp --file-mode=0666 --dir-mode=0777 -o allow_other [バケット名] [マウントポイント]

できた!

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0