Oracle Cloud China

Oracle Cloud对象存储是什么

Oracle 云基础设施 (OCI) 对象存储支持您使用原生格式,安全存储所有类型的数据。得益于内置冗余,OCI 对象存储非常适合构建具有高度可扩展性和灵活性的现代应用,通常用于整合多个数据源以进行分析、备份或归档。

Free Tier 用户有免费额度,具体可见文档

挂载方式

Oracle Cloud 对象存储的挂载方式较其他 S3 存储来说比较复杂,这里仅列举站长所使用的挂载方式

用Alist来挂载

这里有站长已经配置好的存储桶,感兴趣的可以体验一下

Oracle | Microcharon Download Center

获取存储桶Bucket名称空间

如图所示,在所创建的存储桶详细信息可见

Oracle Object Storage Bucket

查询所在区域的Endpoint

见参考资料一栏

获取访问密钥及客户密钥

我的概要信息-->客户密钥

生成后妥善保存客户密钥,因为只显示一次。退出客户密钥显示界面后可见访问密钥

配置Alist

以 Alist V3 为例,Driver 选择 S3,Bucket 处填写存储桶的名称空间,Endpoint 处再加上存储桶名称的路径,如图中所示的 /bucket-20221228-1218,Access key id 处填写访问密钥,Secret access key 处填写客户密钥,其他配置选项不讲

Alist S3 Config

用Rclone来挂载

Oracle Object Storage(对象存储)兼容 Amazon S3,下述选项中选择 5(Amazon S3 Compliant Storage)或 34(Oracle Cloud Infrastructure Object Storage)皆可,下面以选项 34 为例,Rclone v1.60 版本的新特性(1.60 后才有的新选项),部分说明不全的地方请另行参考下方的参考资料一栏

获取存储桶Bucket名称空间

如上 Alist 配置方法一栏中有写

查询所在区域的Endpoint

见参考资料一栏,一般来说在配置 Rclone 一步时直接留空就行

获取API密钥及配置文件

右上角查看当前用户的概要信息:我的概要信息-->API 密钥

或者:域-->(Default 域)-->用户-->[用户名]-->API 密钥

生成 API 密钥对并下载私有密钥,其他选项可以忽略

得到默认配置文件如下所示,记得修改 key_file 路径为 ~/.oci/admin_key.pem,生成 admin_key.pem 密钥文件和 config 配置文件,如下图

[DEFAULT]
user=ocid1.user.oc1..<unique_ID>
fingerprint=<your_fingerprint>
tenancy=ocid1.tenancy.oc1..<unique_ID>
region=eu-milan-1
key_file=<path to your private keyfile> # TODO

Config On Remote

获取对象存储Compartment OCID

身份-->区间-->区间详细信息 (ManagedCompartmentForPaaS)

[scode type="red" size=""]注意在此选项中不是复制存储桶 bucket 的 OCID![/scode]

Get Compartment OCID

配置Rclone

与 Rclone 官网配置方法不同的是,Option Provider 的这一处站长选择了 1,即自动获取 env 环境变量默认的配置路径 ~/.oci/config,选择选项 2 或是其他选项请参考官网 doc 文档,这里不另行描述

root@localhost:~# rclone config 
Current remotes:

Name                 Type
====                 ====
mega                 mega
onedrive             onedrive

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n

Enter name for new remote.
name> oracle

Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
 1 / 1Fichier
   \ (fichier)
 2 / Akamai NetStorage
   \ (netstorage)
 3 / Alias for an existing remote
   \ (alias)
 4 / Amazon Drive
   \ (amazon cloud drive)
 5 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, Digital Ocean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS, Qiniu and Wasabi
   \ (s3)
 6 / Backblaze B2
   \ (b2)
 7 / Better checksums for other remotes
   \ (hasher)
 8 / Box
   \ (box)
 9 / Cache a remote
   \ (cache)
10 / Citrix Sharefile
   \ (sharefile)
11 / Combine several remotes into one
   \ (combine)
12 / Compress a remote
   \ (compress)
13 / Dropbox
   \ (dropbox)
14 / Encrypt/Decrypt a remote
   \ (crypt)
15 / Enterprise File Fabric
   \ (filefabric)
16 / FTP
   \ (ftp)
17 / Google Cloud Storage (this is not Google Drive)
   \ (google cloud storage)
18 / Google Drive
   \ (drive)
19 / Google Photos
   \ (google photos)
20 / HTTP
   \ (http)
21 / Hadoop distributed file system
   \ (hdfs)
22 / HiDrive
   \ (hidrive)
23 / In memory object storage system.
   \ (memory)
24 / Internet Archive
   \ (internetarchive)
25 / Jottacloud
   \ (jottacloud)
26 / Koofr, Digi Storage and other Koofr-compatible storage providers
   \ (koofr)
27 / Local Disk
   \ (local)
28 / Mail.ru Cloud
   \ (mailru)
29 / Mega
   \ (mega)
30 / Microsoft Azure Blob Storage
   \ (azureblob)
31 / Microsoft OneDrive
   \ (onedrive)
32 / OpenDrive
   \ (opendrive)
33 / OpenStack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
   \ (swift)
34 / Oracle Cloud Infrastructure Object Storage
   \ (oracleobjectstorage)
35 / Pcloud
   \ (pcloud)
36 / Put.io
   \ (putio)
37 / QingCloud Object Storage
   \ (qingstor)
38 / SMB / CIFS
   \ (smb)
39 / SSH/SFTP
   \ (sftp)
40 / Sia Decentralized Cloud
   \ (sia)
41 / Storj Decentralized Cloud Storage
   \ (storj)
42 / Sugarsync
   \ (sugarsync)
43 / Transparently chunk/split large files
   \ (chunker)
44 / Union merges the contents of several upstream fs
   \ (union)
45 / Uptobox
   \ (uptobox)
46 / WebDAV
   \ (webdav)
47 / Yandex Disk
   \ (yandex)
48 / Zoho
   \ (zoho)
49 / premiumize.me
   \ (premiumizeme)
50 / seafile
   \ (seafile)
Storage> 34

Option provider.
Choose your Auth Provider
Choose a number from below, or type in your own string value.
Press Enter for the default (env_auth).
 1 / automatically pickup the credentials from runtime(env), first one to provide auth wins
   \ (env_auth)
   / use an OCI user and an API key for authentication.
 2 | you’ll need to put in a config file your tenancy OCID, user OCID, region, the path, fingerprint to an API key.
   | https://docs.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm
   \ (user_principal_auth)
   / use instance principals to authorize an instance to make API calls. 
 3 | each instance has its own identity, and authenticates using the certificates that are read from instance metadata. 
   | https://docs.oracle.com/en-us/iaas/Content/Identity/Tasks/callingservicesfrominstances.htm
   \ (instance_principal_auth)
 4 / use resource principals to make API calls
   \ (resource_principal_auth)
 5 / no credentials needed, this is typically for reading public buckets
   \ (no_auth)
provider> 1

Option namespace.
Object storage namespace
Enter a value.
namespace> axoobzrat47p

Option compartment.
Object storage compartment OCID
Enter a value.
compartment> ocid1.compartment.oc1..<unique_ID>

Option region.
Object storage Region
Enter a value.
region> eu-milan-1

Option endpoint.
Endpoint for Object storage API.
Leave blank to use the default endpoint for the region.
Enter a value. Press Enter to leave empty.
endpoint> 

Edit advanced config?
y) Yes
n) No (default)
y/n> n

Configuration complete.
Options:
- type: oracleobjectstorage
- namespace: axoobzrat47p
- compartment: ocid1.compartment.oc1..<unique_ID>
- region: eu-milan-1
Keep this "oracle" remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

Current remotes:

Name                 Type
====                 ====
mega                 mega
onedrive             onedrive
oracle               oracleobjectstorage

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q
root@localhost:~# rclone ls oracle:bucket-20221228-1218
    45089 1006.png
    50136 1007.png
root@localhost:~# 

其他

Oracle 的对象存储 URL 路径过长,而且无 CDN 加速分发。姑且想了一下,可以用反代或是 301 Redirect 或是 CNAME? 的方法来缩短 URL 路径并提速,大家若是有兴趣可以试试

参考资料

Oracle Object Storage (rclone.org)

Oracle Cloud Infrastructure API Reference and Endpoints

Managing User Credentials (oracle.com)

SDK and CLI Configuration File (oracle.com)

API Errors (oracle.com)

标签: none

添加新评论