The Aliyun OSS (Object Storage Service) is a storage server for objects that can be used to speed up applications by making static Web sites or storing large numbers of images. The purpose of my use of the Aliyun OSS is to mount OSS to the Linux system via the intranet and store the database and the backup of the website program on the very good Aliyun oss.
Create Access Key
Purchase OSS Resource Kit
Create bucket
Install Ossfs
Here is a brief introduction to installing OSSFS and the way to mount OSS under the Linux system.
Environment
CentOS6.5 64-bit
Install Oosfs
# wget ps://github.com/aliyun/ossfs/releases/download/v1.79.9/ossfs_1.79.9_centos6.5_x86_64.rpm ' >https:// github.com/aliyun/ossfs/releases/download/v1.79.9/ossfs_1.79.9_centos6.5_x86_64.rpm
# yum Localinstall ossfs_1.79.9_centos6.5_x86_64.rpm-y
Configure/ETC/PASSWD-OSSFS
# echo My-bucket:my-access-key-id:my-access-key-secret >/etc/passwd-ossfs
# chmod 640/ETC/PASSWD-OSSFS
My-buckent the My-access-key-id and my-access-key-secret that are generated when an access key is created for the bucketname created by the OSS.
Set up automatic mount
# echo ' ossfs#bucketname mountdirectory fuse _netdev,url=http://ecs visit Intranet endpoint,allow_other 0 0 ' >>/etc/fstab
Bucketname:oss's Bucketname
Mountdiretory: Locally mounted OSS directory name
ECS visited intranet endpoint: reference to Aliyun official website
For example, the bucketname of East China 1 is bk-storade, and when mounted to the local/mnt/backup directory, the contents added to/etc/fstab are as follows.
Ossfs#bk-storage/mnt/backup Fuse _NETDE
V,url=http://oss-cn-hangzhou-internal.aliyuncs.com,allow_other 0 0
Confirm whether the OSS can be mounted.
# mount-a
# df-h
FileSystem Size Used Avail use% mounted on
/DEV/XVDA1 40G 5.3G 32G 15%/
Tmpfs 1.9G 0 1.9G 0%/dev/shm
Ossfs 256T 0 256T 0%/mnt/backup
The current 40GB OSS resource package, 6-month cost of 5 yuan, and access through the intranet is free. Compared to the purchase of a dedicated backup server, the price is really good.
Common errors
View the contents of the/etc/fatab when the Mount-a command appears with the following error.
Ossfs:check OSS Service failed. Run with-f option for more details.
View the contents of/etc/passwd-ossfs or/etc/fstab when the following error occurs.
Ossfs:could not establish security credentials, check documentation.
Generally, access key and Bucketname are not compliant.