2014-03-28 23:34:13 +01:00
|
|
|
---
|
|
|
|
title: "Swift"
|
|
|
|
description: "Swift"
|
2014-04-26 18:43:41 +02:00
|
|
|
date: "2014-04-26"
|
2014-03-28 23:34:13 +01:00
|
|
|
---
|
|
|
|
|
2014-07-17 21:03:11 +02:00
|
|
|
<i class="fa fa-space-shuttle"></i>Swift
|
|
|
|
----------------------------------------
|
|
|
|
|
2017-08-10 22:38:45 +02:00
|
|
|
Swift refers to [Openstack Object Storage](https://docs.openstack.org/swift/latest/).
|
2014-03-28 23:34:13 +01:00
|
|
|
Commercial implementations of that being:
|
|
|
|
|
2017-03-29 14:38:34 +02:00
|
|
|
* [Rackspace Cloud Files](https://www.rackspace.com/cloud/files/)
|
|
|
|
* [Memset Memstore](https://www.memset.com/cloud/storage/)
|
2017-09-25 18:55:19 +02:00
|
|
|
* [OVH Object Storage](https://www.ovh.co.uk/public-cloud/storage/object-storage/)
|
|
|
|
* [Oracle Cloud Storage](https://cloud.oracle.com/storage-opc)
|
2014-03-28 23:34:13 +01:00
|
|
|
|
2014-07-17 21:03:11 +02:00
|
|
|
Paths are specified as `remote:container` (or `remote:` for the `lsd`
|
|
|
|
command.) You may put subdirectories in too, eg `remote:container/path/to/dir`.
|
2014-03-28 23:34:13 +01:00
|
|
|
|
|
|
|
Here is an example of making a swift configuration. First run
|
|
|
|
|
|
|
|
rclone config
|
|
|
|
|
|
|
|
This will guide you through an interactive setup process.
|
|
|
|
|
|
|
|
```
|
|
|
|
No remotes found - make a new one
|
|
|
|
n) New remote
|
2016-02-21 14:39:04 +01:00
|
|
|
s) Set configuration password
|
2017-08-10 22:38:45 +02:00
|
|
|
q) Quit config
|
|
|
|
n/s/q> n
|
2014-03-28 23:34:13 +01:00
|
|
|
name> remote
|
2016-02-21 14:39:04 +01:00
|
|
|
Type of storage to configure.
|
|
|
|
Choose a number from below, or type in your own value
|
2016-07-11 13:42:44 +02:00
|
|
|
1 / Amazon Drive
|
2016-02-21 14:39:04 +01:00
|
|
|
\ "amazon cloud drive"
|
2017-01-09 06:09:19 +01:00
|
|
|
2 / Amazon S3 (also Dreamhost, Ceph, Minio)
|
2016-02-21 14:39:04 +01:00
|
|
|
\ "s3"
|
|
|
|
3 / Backblaze B2
|
|
|
|
\ "b2"
|
2017-08-10 22:38:45 +02:00
|
|
|
4 / Box
|
|
|
|
\ "box"
|
|
|
|
5 / Dropbox
|
2016-02-21 14:39:04 +01:00
|
|
|
\ "dropbox"
|
2017-08-10 22:38:45 +02:00
|
|
|
6 / Encrypt/Decrypt a remote
|
2017-01-09 06:09:19 +01:00
|
|
|
\ "crypt"
|
2017-08-10 22:38:45 +02:00
|
|
|
7 / FTP Connection
|
|
|
|
\ "ftp"
|
|
|
|
8 / Google Cloud Storage (this is not Google Drive)
|
2016-02-21 14:39:04 +01:00
|
|
|
\ "google cloud storage"
|
2017-08-10 22:38:45 +02:00
|
|
|
9 / Google Drive
|
2016-02-21 14:39:04 +01:00
|
|
|
\ "drive"
|
2017-08-10 22:38:45 +02:00
|
|
|
10 / Hubic
|
2016-02-21 14:39:04 +01:00
|
|
|
\ "hubic"
|
2017-08-10 22:38:45 +02:00
|
|
|
11 / Local Disk
|
2016-02-21 14:39:04 +01:00
|
|
|
\ "local"
|
2017-08-10 22:38:45 +02:00
|
|
|
12 / Microsoft Azure Blob Storage
|
|
|
|
\ "azureblob"
|
|
|
|
13 / Microsoft OneDrive
|
2016-02-21 14:39:04 +01:00
|
|
|
\ "onedrive"
|
2017-08-10 22:38:45 +02:00
|
|
|
14 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
|
2016-02-21 14:39:04 +01:00
|
|
|
\ "swift"
|
2017-08-10 22:38:45 +02:00
|
|
|
15 / QingClound Object Storage
|
|
|
|
\ "qingstor"
|
|
|
|
16 / SSH/SFTP Connection
|
2017-03-05 11:14:57 +01:00
|
|
|
\ "sftp"
|
2017-08-10 22:38:45 +02:00
|
|
|
17 / Yandex Disk
|
2016-02-21 14:39:04 +01:00
|
|
|
\ "yandex"
|
2017-08-10 22:38:45 +02:00
|
|
|
18 / http Connection
|
|
|
|
\ "http"
|
|
|
|
Storage> swift
|
|
|
|
Get swift credentials from environment variables in standard OpenStack form.
|
|
|
|
Choose a number from below, or type in your own value
|
|
|
|
1 / Enter swift credentials in the next step
|
|
|
|
\ "false"
|
|
|
|
2 / Get swift credentials from environment vars. Leave other fields blank if using this.
|
|
|
|
\ "true"
|
|
|
|
env_auth> 1
|
2014-03-28 23:34:13 +01:00
|
|
|
User name to log in.
|
|
|
|
user> user_name
|
|
|
|
API key or password.
|
|
|
|
key> password_or_api_key
|
|
|
|
Authentication URL for server.
|
|
|
|
Choose a number from below, or type in your own value
|
2016-02-21 14:39:04 +01:00
|
|
|
1 / Rackspace US
|
|
|
|
\ "https://auth.api.rackspacecloud.com/v1.0"
|
|
|
|
2 / Rackspace UK
|
|
|
|
\ "https://lon.auth.api.rackspacecloud.com/v1.0"
|
|
|
|
3 / Rackspace v2
|
|
|
|
\ "https://identity.api.rackspacecloud.com/v2.0"
|
|
|
|
4 / Memset Memstore UK
|
|
|
|
\ "https://auth.storage.memset.com/v1.0"
|
|
|
|
5 / Memset Memstore UK v2
|
|
|
|
\ "https://auth.storage.memset.com/v2.0"
|
|
|
|
6 / OVH
|
|
|
|
\ "https://auth.cloud.ovh.net/v2.0"
|
2014-03-28 23:34:13 +01:00
|
|
|
auth> 1
|
2016-04-21 01:00:49 +02:00
|
|
|
User domain - optional (v3 auth)
|
|
|
|
domain> Default
|
2017-01-09 06:09:19 +01:00
|
|
|
Tenant name - optional for v1 auth, required otherwise
|
|
|
|
tenant> tenant_name
|
2016-07-05 18:34:22 +02:00
|
|
|
Tenant domain - optional (v3 auth)
|
|
|
|
tenant_domain>
|
2016-02-21 14:39:04 +01:00
|
|
|
Region name - optional
|
2017-01-09 06:09:19 +01:00
|
|
|
region>
|
2016-02-02 20:45:05 +01:00
|
|
|
Storage URL - optional
|
2017-01-09 06:09:19 +01:00
|
|
|
storage_url>
|
2016-06-03 18:52:02 +02:00
|
|
|
AuthVersion - optional - set to (1,2,3) if your auth URL has no version
|
2017-01-09 06:09:19 +01:00
|
|
|
auth_version>
|
2017-08-10 22:38:45 +02:00
|
|
|
Endpoint type to choose from the service catalogue
|
|
|
|
Choose a number from below, or type in your own value
|
|
|
|
1 / Public (default, choose this if not sure)
|
|
|
|
\ "public"
|
|
|
|
2 / Internal (use internal service net)
|
|
|
|
\ "internal"
|
|
|
|
3 / Admin
|
|
|
|
\ "admin"
|
|
|
|
endpoint_type>
|
2017-01-09 06:09:19 +01:00
|
|
|
Remote config
|
2014-03-28 23:34:13 +01:00
|
|
|
--------------------
|
|
|
|
[remote]
|
2017-08-10 22:38:45 +02:00
|
|
|
env_auth = false
|
2014-03-28 23:34:13 +01:00
|
|
|
user = user_name
|
|
|
|
key = password_or_api_key
|
|
|
|
auth = https://auth.api.rackspacecloud.com/v1.0
|
2017-01-09 06:09:19 +01:00
|
|
|
domain = Default
|
|
|
|
tenant =
|
|
|
|
tenant_domain =
|
|
|
|
region =
|
|
|
|
storage_url =
|
|
|
|
auth_version =
|
2017-08-10 22:38:45 +02:00
|
|
|
endpoint_type =
|
2014-03-28 23:34:13 +01:00
|
|
|
--------------------
|
|
|
|
y) Yes this is OK
|
|
|
|
e) Edit this remote
|
|
|
|
d) Delete this remote
|
|
|
|
y/e/d> y
|
|
|
|
```
|
|
|
|
|
|
|
|
This remote is called `remote` and can now be used like this
|
|
|
|
|
|
|
|
See all containers
|
|
|
|
|
|
|
|
rclone lsd remote:
|
|
|
|
|
|
|
|
Make a new container
|
|
|
|
|
|
|
|
rclone mkdir remote:container
|
|
|
|
|
|
|
|
List the contents of a container
|
|
|
|
|
|
|
|
rclone ls remote:container
|
|
|
|
|
|
|
|
Sync `/home/local/directory` to the remote container, deleting any
|
|
|
|
excess files in the container.
|
|
|
|
|
|
|
|
rclone sync /home/local/directory remote:container
|
|
|
|
|
2016-09-19 17:36:36 +02:00
|
|
|
### Configuration from an Openstack credentials file ###
|
|
|
|
|
|
|
|
An Opentstack credentials file typically looks something something
|
|
|
|
like this (without the comments)
|
|
|
|
|
|
|
|
```
|
|
|
|
export OS_AUTH_URL=https://a.provider.net/v2.0
|
|
|
|
export OS_TENANT_ID=ffffffffffffffffffffffffffffffff
|
|
|
|
export OS_TENANT_NAME="1234567890123456"
|
|
|
|
export OS_USERNAME="123abc567xy"
|
|
|
|
echo "Please enter your OpenStack Password: "
|
|
|
|
read -sr OS_PASSWORD_INPUT
|
|
|
|
export OS_PASSWORD=$OS_PASSWORD_INPUT
|
|
|
|
export OS_REGION_NAME="SBG1"
|
|
|
|
if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi
|
|
|
|
```
|
|
|
|
|
|
|
|
The config file needs to look something like this where `$OS_USERNAME`
|
|
|
|
represents the value of the `OS_USERNAME` variable - `123abc567xy` in
|
|
|
|
the example above.
|
|
|
|
|
|
|
|
```
|
|
|
|
[remote]
|
|
|
|
type = swift
|
|
|
|
user = $OS_USERNAME
|
|
|
|
key = $OS_PASSWORD
|
|
|
|
auth = $OS_AUTH_URL
|
|
|
|
tenant = $OS_TENANT_NAME
|
|
|
|
```
|
|
|
|
|
|
|
|
Note that you may (or may not) need to set `region` too - try without first.
|
|
|
|
|
2017-08-10 22:38:45 +02:00
|
|
|
### Configuration from the environment ###
|
|
|
|
|
|
|
|
If you prefer you can configure rclone to use swift using a standard
|
|
|
|
set of OpenStack environment variables.
|
|
|
|
|
|
|
|
When you run through the config, make sure you choose `true` for
|
|
|
|
`env_auth` and leave everything else blank.
|
|
|
|
|
|
|
|
rclone will then set any empty config parameters from the enviroment
|
|
|
|
using standard OpenStack environment variables. There is [a list of
|
|
|
|
the
|
|
|
|
variables](https://godoc.org/github.com/ncw/swift#Connection.ApplyEnvironment)
|
|
|
|
in the docs for the swift library.
|
|
|
|
|
|
|
|
#### Using rclone without a config file ####
|
|
|
|
|
|
|
|
You can use rclone with swift without a config file, if desired, like
|
|
|
|
this:
|
|
|
|
|
|
|
|
```
|
|
|
|
source openstack-credentials-file
|
|
|
|
export RCLONE_CONFIG_MYREMOTE_TYPE=swift
|
|
|
|
export RCLONE_CONFIG_MYREMOTE_ENV_AUTH=true
|
|
|
|
rclone lsd myremote:
|
|
|
|
```
|
|
|
|
|
2017-06-06 17:40:00 +02:00
|
|
|
### --fast-list ###
|
|
|
|
|
|
|
|
This remote supports `--fast-list` which allows you to use fewer
|
|
|
|
transactions in exchange for more memory. See the [rclone
|
|
|
|
docs](/docs/#fast-list) for more details.
|
|
|
|
|
2015-11-14 12:38:35 +01:00
|
|
|
### Specific options ###
|
|
|
|
|
|
|
|
Here are the command line options specific to this cloud storage
|
|
|
|
system.
|
|
|
|
|
|
|
|
#### --swift-chunk-size=SIZE ####
|
|
|
|
|
|
|
|
Above this size files will be chunked into a _segments container. The
|
|
|
|
default for this is 5GB which is its maximum value.
|
2017-01-09 06:09:19 +01:00
|
|
|
|
2015-06-06 11:05:21 +02:00
|
|
|
### Modified time ###
|
2014-03-28 23:34:13 +01:00
|
|
|
|
|
|
|
The modified time is stored as metadata on the object as
|
|
|
|
`X-Object-Meta-Mtime` as floating point since the epoch accurate to 1
|
|
|
|
ns.
|
|
|
|
|
|
|
|
This is a defacto standard (used in the official python-swiftclient
|
|
|
|
amongst others) for storing the modification time for an object.
|
2016-03-16 18:39:44 +01:00
|
|
|
|
|
|
|
### Limitations ###
|
|
|
|
|
|
|
|
The Swift API doesn't return a correct MD5SUM for segmented files
|
|
|
|
(Dynamic or Static Large Objects) so rclone won't check or use the
|
|
|
|
MD5SUM for these.
|
2016-05-02 13:34:15 +02:00
|
|
|
|
2016-05-06 15:09:12 +02:00
|
|
|
### Troubleshooting ###
|
2016-05-02 13:34:15 +02:00
|
|
|
|
|
|
|
#### Rclone gives Failed to create file system for "remote:": Bad Request ####
|
|
|
|
|
|
|
|
Due to an oddity of the underlying swift library, it gives a "Bad
|
|
|
|
Request" error rather than a more sensible error when the
|
|
|
|
authentication fails for Swift.
|
|
|
|
|
|
|
|
So this most likely means your username / password is wrong. You can
|
|
|
|
investigate further with the `--dump-bodies` flag.
|
|
|
|
|
2016-09-19 17:36:36 +02:00
|
|
|
This may also be caused by specifying the region when you shouldn't
|
|
|
|
have (eg OVH).
|
|
|
|
|
2016-05-02 13:34:15 +02:00
|
|
|
#### Rclone gives Failed to create file system: Response didn't have storage storage url and auth token ####
|
|
|
|
|
|
|
|
This is most likely caused by forgetting to specify your tenant when
|
|
|
|
setting up a swift remote.
|