Advertisement
Guest User

Untitled

a guest
Sep 16th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.57 KB | None | 0 0
  1. # s3qlを使用して、ConoHaのUbuntu VMにObject Storageをマウントする手順
  2.  
  3. ---
  4.  
  5. <br>
  6. <br>
  7. <br>
  8. <br>
  9. <br>
  10.  
  11. ## 環境
  12.  
  13. ```bash
  14. ~$ cat /etc/os-release
  15. ```
  16.  
  17. > NAME="Debian GNU/Linux"
  18. >
  19. > VERSION_ID="8"
  20.  
  21. ---
  22.  
  23. <br>
  24. <br>
  25. <br>
  26. <br>
  27. <br>
  28.  
  29. ## 手順
  30.  
  31. ```bash
  32. ~$ sudo apt-get install python-openstackclient s3ql ubuntu-cloud-keyring
  33. ~$ mkdir -p ~/mnt/s3ql
  34. ~$ mkdir ~/.s3ql && install -b -m 600 /dev/null ~/.s3ql/authinfo2
  35. ~$ nano ~/.s3ql/authinfo2
  36. ```
  37.  
  38. ### ~/.s3ql/authinfo2
  39.  
  40. ```
  41. [swift]
  42. backend-login: gnct********:gncu********
  43. backend-password: PASSWORD
  44. storage-url: swiftks://identity.REGION.conoha.io/REGION:CONTAINER
  45. ```
  46.  
  47. * PASSWORD
  48. * REGION ...今回は「tyo1」
  49. * CONTAINER ...予めCUIクライアントで作成しておいたコンテナの名前
  50.  
  51. ```bash
  52. ~$ mkfs.s3ql --plain --authfile ~/.s3ql/authinfo2 --debug swiftks://identity.REGION.conoha.io/REGION:CONTAINER
  53. ```
  54.  
  55. > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.backends.common.get_ssl_context: Reading default CA certificates.
  56. >
  57. > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.backends.swift._do_request: _do_request(): start with parameters ('GET', '/', None, {'limit': 1}, None, None)
  58. >
  59. > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.backends.swift._do_request: _do_request(): no active connection, calling _get_conn()
  60. >
  61. > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.backends.swiftks._get_conn: _get_conn(): start
  62. >
  63. >
  64. >
  65. > ...
  66. >
  67. >
  68. >
  69. > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.backends.swift._do_request_inner: writing body data
  70. >
  71. > YYYY-MM-DD hh:mm:ss.000 ##### MainThread s3ql.mkfs.main: Wrote ### bytes of compressed metadata.
  72.  
  73. ```bash
  74. ~$ mount.s3ql --allow-other swiftks://identity.REGION.conoha.io/REGION:CONTAINER ~/mnt/s3ql
  75. ```
  76.  
  77. > Using # upload threads.
  78. >
  79. > Autodetected ##### file descriptors available for cache entries
  80. >
  81. > Using cached metadata.
  82. >
  83. > Setting cache size to #### MB
  84. >
  85. > Mounting filesystem...
  86. >
  87. > fusermount: user has no write access to mountpoint /home/USERNAME/mnt/s3ql
  88. >
  89. > fuse_mount failed
  90.  
  91. ```bash
  92. ~$ sudo chown USERNAME:GROUPNAME ~/mnt/s3ql
  93. ~$ mount.s3ql --allow-other swiftks://identity.REGION.conoha.io/REGION:CONTAINER ~/mnt/s3ql
  94. ```
  95.  
  96. > Using # upload threads.
  97. >
  98. > Autodetected ##### file descriptors available for cache entries
  99. >
  100. > Using cached metadata.
  101. >
  102. > Setting cache size to #### MB
  103. >
  104. > Mounting filesystem...
  105. >
  106. > fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf
  107. >
  108. > fuse_mount failed
  109.  
  110. ```bash
  111. ~$ sudo nano /etc/fuse.conf
  112. ```
  113.  
  114. ### /etc/fuse.conf
  115.  
  116. ```
  117. # /etc/fuse.conf - Configuration file for Filesystem in Userspace (FUSE)
  118.  
  119. # Set the maximum number of FUSE mounts allowed to non-root users.
  120. # The default is 1000.
  121. #mount_max = 1000
  122.  
  123. # Allow non-root users to specify the allow_other or allow_root mount options.
  124. #user_allow_other
  125. user_allow_other
  126. ```
  127.  
  128. ```bash
  129. ~$ mount.s3ql --allow-other swiftks://identity.REGION.conoha.io/REGION:CONTAINER ~/mnt/s3ql
  130. ```
  131.  
  132. > Using # upload threads.
  133. >
  134. > Autodetected ##### file descriptors available for cache entries
  135. >
  136. > Using cached metadata.
  137. >
  138. > Setting cache size to #### MB
  139. >
  140. > Mounting filesystem...
  141.  
  142. ```bash
  143. ~$ ls ~/mnt/s3ql
  144. ```
  145.  
  146. > lost+found
  147.  
  148. ```bash
  149. ~$ df -h
  150. ```
  151.  
  152. > Filesystem Size Used Avail Use% Mounted on
  153. >
  154. > /dev/vda1 ###G ###G ###G ##% /
  155. >
  156. >
  157. >
  158. > ...
  159. >
  160. >
  161. >
  162. > swiftks://identity.REGION.conoha.io/REGION:CONTAINER 1.0T 0 1.0T 0% /home/USERNAME/mnt/s3ql
  163.  
  164. ```bash
  165. ~$ sudo nano /etc/init.d/s3ql
  166. ```
  167.  
  168. ### /etc/init.d/s3ql
  169.  
  170. ```bash
  171. #!/bin/bash
  172. #
  173. # description: S3QL Auto Mount
  174. #
  175. # Source function library.
  176. . /etc/init.d/functions
  177. #
  178. AUTHFILE="/home/USERNAME/.s3ql/authinfo2"
  179. BUCKET="swiftks://identity.REGION.conoha.io/REGION:CONTAINER"
  180. MOUNTPOINT="/home/USERNAME/mnt/s3ql"
  181. OPTIONS="--allow-other"
  182. start() {
  183. echo -n $"Mounting S3QL: "
  184. mount | grep $MOUNTPOINT > /dev/null
  185. if [ $? -eq 0 ];then
  186. echo $"Cannot mount $MOUNTPOINT."
  187. echo
  188. exit 1
  189. fi
  190. echo
  191. fsck.s3ql --batch $BUCKET
  192. mount.s3ql $OPTIONS $BUCKET $MOUNTPOINT
  193. RETVAL=$?
  194. [ $RETVAL -eq 0 ] && success || failure
  195. echo
  196. }
  197. stop() {
  198. echo -n $"Unmounting S3QL: "
  199. mount | grep $MOUNTPOINT > /dev/null
  200. if [ $? -ne 0 ];then
  201. echo
  202. exit 1
  203. fi
  204. umount.s3ql $MOUNTPOINT && success || failure
  205. echo
  206. }
  207. case "$1" in
  208. start)
  209. start
  210. ;;
  211. stop)
  212. stop
  213. ;;
  214. *)
  215. echo "Usage: `basename $0` {start|stop}"
  216. exit 1
  217. ;;
  218. esac
  219.  
  220. ```
  221.  
  222. ```bash
  223. ~$ sudo chmod 755 /etc/init.d/s3ql
  224. ~$ sudo /etc/init.d/s3ql start
  225. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement