Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # s3qlを使用して、ConoHaのUbuntu VMにObject Storageをマウントする手順
- ---
- <br>
- <br>
- <br>
- <br>
- <br>
- ## 環境
- ```bash
- ~$ cat /etc/os-release
- ```
- > NAME="Debian GNU/Linux"
- >
- > VERSION_ID="8"
- ---
- <br>
- <br>
- <br>
- <br>
- <br>
- ## 手順
- ```bash
- ~$ sudo apt-get install python-openstackclient s3ql ubuntu-cloud-keyring
- ~$ mkdir -p ~/mnt/s3ql
- ~$ mkdir ~/.s3ql && install -b -m 600 /dev/null ~/.s3ql/authinfo2
- ~$ nano ~/.s3ql/authinfo2
- ```
- ### ~/.s3ql/authinfo2
- ```
- [swift]
- backend-login: gnct********:gncu********
- backend-password: PASSWORD
- storage-url: swiftks://identity.REGION.conoha.io/REGION:CONTAINER
- ```
- * PASSWORD
- * REGION ...今回は「tyo1」
- * CONTAINER ...予めCUIクライアントで作成しておいたコンテナの名前
- ```bash
- ~$ mkfs.s3ql --plain --authfile ~/.s3ql/authinfo2 --debug swiftks://identity.REGION.conoha.io/REGION:CONTAINER
- ```
- > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.backends.common.get_ssl_context: Reading default CA certificates.
- >
- > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.backends.swift._do_request: _do_request(): start with parameters ('GET', '/', None, {'limit': 1}, None, None)
- >
- > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.backends.swift._do_request: _do_request(): no active connection, calling _get_conn()
- >
- > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.backends.swiftks._get_conn: _get_conn(): start
- >
- >
- >
- > ...
- >
- >
- >
- > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.backends.swift._do_request_inner: writing body data
- >
- > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.mkfs.main: Wrote ### bytes of compressed metadata.
- ```bash
- ~$ mount.s3ql --allow-other swiftks://identity.REGION.conoha.io/REGION:CONTAINER ~/mnt/s3ql
- ```
- > Using # upload threads.
- >
- > Autodetected ##### file descriptors available for cache entries
- >
- > Using cached metadata.
- >
- > Setting cache size to #### MB
- >
- > Mounting filesystem...
- >
- > fusermount: user has no write access to mountpoint /home/USERNAME/mnt/s3ql
- >
- > fuse_mount failed
- ```bash
- ~$ sudo chown USERNAME:GROUPNAME ~/mnt/s3ql
- ~$ mount.s3ql --allow-other swiftks://identity.REGION.conoha.io/REGION:CONTAINER ~/mnt/s3ql
- ```
- > Using # upload threads.
- >
- > Autodetected ##### file descriptors available for cache entries
- >
- > Using cached metadata.
- >
- > Setting cache size to #### MB
- >
- > Mounting filesystem...
- >
- > fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf
- >
- > fuse_mount failed
- ```bash
- ~$ sudo nano /etc/fuse.conf
- ```
- ### /etc/fuse.conf
- ```
- # /etc/fuse.conf - Configuration file for Filesystem in Userspace (FUSE)
- # Set the maximum number of FUSE mounts allowed to non-root users.
- # The default is 1000.
- #mount_max = 1000
- # Allow non-root users to specify the allow_other or allow_root mount options.
- #user_allow_other
- user_allow_other
- ```
- ```bash
- ~$ mount.s3ql --allow-other swiftks://identity.REGION.conoha.io/REGION:CONTAINER ~/mnt/s3ql
- ```
- > Using # upload threads.
- >
- > Autodetected ##### file descriptors available for cache entries
- >
- > Using cached metadata.
- >
- > Setting cache size to #### MB
- >
- > Mounting filesystem...
- ```bash
- ~$ ls ~/mnt/s3ql
- ```
- > lost+found
- ```bash
- ~$ df -h
- ```
- > Filesystem Size Used Avail Use% Mounted on
- >
- > /dev/vda1 ###G ###G ###G ##% /
- >
- >
- >
- > ...
- >
- >
- >
- > swiftks://identity.REGION.conoha.io/REGION:CONTAINER 1.0T 0 1.0T 0% /home/USERNAME/mnt/s3ql
- ```bash
- ~$ sudo nano /etc/init.d/s3ql
- ```
- ### /etc/init.d/s3ql
- ```bash
- #!/bin/bash
- #
- # description: S3QL Auto Mount
- #
- # Source function library.
- . /etc/init.d/functions
- #
- AUTHFILE="/home/USERNAME/.s3ql/authinfo2"
- BUCKET="swiftks://identity.REGION.conoha.io/REGION:CONTAINER"
- MOUNTPOINT="/home/USERNAME/mnt/s3ql"
- OPTIONS="--allow-other"
- start() {
- echo -n $"Mounting S3QL: "
- mount | grep $MOUNTPOINT > /dev/null
- if [ $? -eq 0 ];then
- echo $"Cannot mount $MOUNTPOINT."
- echo
- exit 1
- fi
- echo
- fsck.s3ql --batch $BUCKET
- mount.s3ql $OPTIONS $BUCKET $MOUNTPOINT
- RETVAL=$?
- [ $RETVAL -eq 0 ] && success || failure
- echo
- }
- stop() {
- echo -n $"Unmounting S3QL: "
- mount | grep $MOUNTPOINT > /dev/null
- if [ $? -ne 0 ];then
- echo
- exit 1
- fi
- umount.s3ql $MOUNTPOINT && success || failure
- echo
- }
- case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- *)
- echo "Usage: `basename $0` {start|stop}"
- exit 1
- ;;
- esac
- ```
- ```bash
- ~$ sudo chmod 755 /etc/init.d/s3ql
- ~$ sudo /etc/init.d/s3ql start
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement