Access Files in BucketFS

You can access the buckets and the contained files from outside the cluster by using an HTTPS client such as curl. You only need to provide one of the database servers' IP addresses, the BucketFS port, the bucket name, and the required read/write passwords. You may also have to adjust your internal firewall configuration as needed.

curl

In the following examples the HTTPS client curl is used to list the existing buckets on a server, upload the files file1 and tar1.tgz into the bucket bucket1, display a list of the files in the bucket, and delete one of the files.

The relevant parameters in these examples are the database server IP address (192.168.6.75), the BucketFS port (1234), the name of the bucket (bucket1), and the r/w user passwords (readpw and writepw).

If the bucket is not public readable, you can only access it using the configured r/w passwords.

List Buckets

The following example shows how to list all existing buckets on the server.

$> curl https://r:readpw@192.168.6.75:1234
default
bucket1

Add Files to Buckets

To add files to a bucket in BucketFS, use the PUT option. The following example shows how to upload the files file1 and tar1.tgz into the bucket bucket1.

$> curl -X PUT -T file1 https://w:writepw@192.168.6.75:1234/bucket1/
$> curl -X PUT -T tar1.tgz https://w:writepw@192.168.6.75:1234/bucket1/

If you do not append a filename to the upload path, curl will write the file to the bucket/folder using the original filename. The path must then end with a trailing / (forward slash). If you want the file to be stored in the bucket under a different name, append the new filename to the path. For example:

$> curl -X PUT -T tar1.tgz https://w:writepw@192.168.6.75:1234/bucket1/my_file.tgz

View Files in Buckets

To view a list of the files in a bucket, use the curl command with the path to the bucket. For example:

$> curl https://r:readpw@192.168.6.75:1234/bucket1
file1
tar1.tgz
my_file.tgz

To view the contents of a specific file in a bucket, use the GET option.

$> curl -X GET https://w:writepw@192.168.6.75:1234/bucket1/file1

Delete Files from Buckets

To delete files from a bucket, use the DELETE option. The following example shows how to delete the file file1 from the bucket bucket1.

$> curl -X DELETE https://w:writepw@192.168.6.75:1234/bucket1/file1