All Projects β†’ twonote β†’ Radosgw Admin4j

twonote / Radosgw Admin4j

Licence: apache-2.0
A Ceph Object Storage Admin SDK / Client Library for Java ✨🍰✨

Programming Languages

java
68154 projects - #9 most used programming language
swift
15916 projects

Projects that are alternatives of or similar to Radosgw Admin4j

Mc
MinIO Client is a replacement for ls, cp, mkdir, diff and rsync commands for filesystems and object storage.
Stars: ✭ 1,962 (+3824%)
Mutual labels:  s3, aws-s3, storage
Rome
Carthage cache for S3, Minio, Ceph, Google Storage, Artifactory and many others
Stars: ✭ 724 (+1348%)
Mutual labels:  s3, aws-s3, ceph
esop
Cloud-enabled backup and restore tool for Apache Cassandra
Stars: ✭ 40 (-20%)
Mutual labels:  storage, s3, ceph
Akubra
Simple solution to keep a independent S3 storages in sync
Stars: ✭ 79 (+58%)
Mutual labels:  s3, storage, ceph
awesome-storage
A curated list of storage open source tools. Backups, redundancy, sharing, distribution, encryption, etc.
Stars: ✭ 324 (+548%)
Mutual labels:  storage, s3, ceph
BlobHelper
BlobHelper is a common, consistent storage interface for Microsoft Azure, Amazon S3, Komodo, Kvpbase, and local filesystem written in C#.
Stars: ✭ 23 (-54%)
Mutual labels:  storage, aws-s3, s3
benji
πŸ“ This library is a Scala reactive DSL for object storage (e.g. S3/Amazon, S3/CEPH, Google Cloud Storage).
Stars: ✭ 18 (-64%)
Mutual labels:  storage, s3, ceph
Discharge
⚑️ A simple, easy way to deploy static websites to Amazon S3.
Stars: ✭ 483 (+866%)
Mutual labels:  s3, aws-s3
S3 Sync Action
πŸ”„ GitHub Action to sync a directory with a remote S3 bucket 🧺
Stars: ✭ 497 (+894%)
Mutual labels:  s3, aws-s3
S3fs Fuse
FUSE-based file system backed by Amazon S3
Stars: ✭ 5,733 (+11366%)
Mutual labels:  s3, aws-s3
Api
SODA API is an open source implementation of SODA API Standards for Data and Storage Management.
Stars: ✭ 795 (+1490%)
Mutual labels:  storage, ceph
Cortx
CORTX Community Object Storage is 100% open source object storage uniquely optimized for mass capacity storage devices.
Stars: ✭ 426 (+752%)
Mutual labels:  s3, storage
Mort
Storage and image processing server written in Go
Stars: ✭ 420 (+740%)
Mutual labels:  s3, storage
S5cmd
Parallel S3 and local filesystem execution tool.
Stars: ✭ 565 (+1030%)
Mutual labels:  s3, storage
Storage
πŸ’Ώ Storage abstractions with implementations for .NET/.NET Standard
Stars: ✭ 380 (+660%)
Mutual labels:  aws-s3, storage
Infinit
The Infinit policy-based software-defined storage platform.
Stars: ✭ 363 (+626%)
Mutual labels:  s3, storage
Minio
High Performance, Kubernetes Native Object Storage
Stars: ✭ 30,698 (+61296%)
Mutual labels:  s3, storage
S3 Permission Checker
Check read, write permissions on S3 buckets in your account
Stars: ✭ 18 (-64%)
Mutual labels:  s3, aws-s3
Awslib scala
An idiomatic Scala wrapper around the AWS Java SDK
Stars: ✭ 20 (-60%)
Mutual labels:  s3, aws-s3
Touchdown
Cloud service orchestration framework for python
Stars: ✭ 10 (-80%)
Mutual labels:  aws-s3, devops

Build Status License Javadocs

About

radosgw-admin4j is a Ceph object storage admin client that allows provisioning and control of a Ceph object storage deployment. Features include user/subuser management, quota management, usage report, bucket/object management, etc.

Highlight

  • Fully support all operations includes subuser, quota and more in the latest Ceph version.
  • An easier way to manage radosgw. Avoid troubles when working with radosgw admin APIs, especially that docs are a bit confusing and inconsistent with the codebase.
  • Quality and compatibility - Continuous Integration and tests against Ceph LTS versions (Nautilus/Octopus currently.)
  • Contributor friendly - typical contribution process, no weird policies, all contributions are welcome!

Start using

Add dependency

You can obtain radosgw-admim4j from Maven Central using the following identifier:

Configuration

RgwAdmin RGW_ADMIN =
              new RgwAdminBuilder()
                  .accessKey("administrator access key")
                  .secretKey("administrator secret key")
                  .endpoint("radosgw admin endpoint, e.g., http://127.0.0.1:8080/admin")
                  .build();

Usage example

We support all types of operation includes User, Subuser, Key, Bucket, Capability, Quota and Usage. Please check all available operations in Javadocs

User management

// List user in the system
List<User> users = RGW_ADMIN.listUserInfo();

// Create user
RGW_ADMIN.createUser(userId);

// Get user information and show keys
User user = RGW_ADMIN.getUserInfo(userId).get();
user.getS3Credentials().stream().peek(System.out::println);

// Create subuser
SubUser subUser = RGW_ADMIN.createSubUser(userId, "subUserId", SubUser.Permission.FULL, CredentialType.SWIFT);

// Suspend a user
RGW_ADMIN.suspendUser(userId, true);

// Remove a user
RGW_ADMIN.removeUser(userId);

Quota management

// Allow the user owns more buckets
RGW_ADMIN.modifyUser(userId, ImmutableMap.of("max-buckets", String.valueOf(Integer.MAX_VALUE)));

// Set the quota that causes the user can have at most one thousand objects, and the maximal usage is 1 GiB
RGW_ADMIN.setUserQuota(userId, 1000, 1048576);

Bucket management

// Transfer the bucket owner from the user just created to the administrator
BucketInfo bucketInfo = RGW_ADMIN.getBucketInfo(bucketName).get();
RGW_ADMIN.linkBucket(bucketName, bucketInfo.getId(), adminUserId);

// Remove a bucket
RGW_ADMIN.removeBucket(bucketName);

Usage report

// Retrieve and show the usage report for a given user
UsageInfo userUsage = RGW_ADMIN.getUserUsage(userId).get();
userUsage.getSummary().stream().peek(System.out::println);

One more thing: Radosgw setup

To kick-off, you need one ready to use radosgw instance and one radosgw account with proper admin capabilities. Follow the guide below to have a radowgw setup then you can fire the example code.

β€œI do not have a radosgw setup currently”

You could refer to the Ceph official manual to set up a Ceph cluster with radosgw quickly. It is not a piece of cake if you do not familiar with Ceph. Things will be easier if you have docker in your environment. To set up a standalone instance with an admin account powered by the Ceph daemon image, follow the instructions below:

$ docker run -d -p 80:8080 -v /etc/ceph/:/etc/ceph/ -e CEPH_DEMO_UID=qqq -e CEPH_DEMO_ACCESS_KEY=qqq -e CEPH_DEMO_SECRET_KEY=qqq -e NETWORK_AUTO_DETECT=4 --name rgw ceph/daemon:v5.0.4-stable-5.0-octopus-centos-8 demo 

Note that port 80 should be available.

It takes about two minutes to initialize the Ceph cluster. Check the setup succeeded by the following command:

$ timeout 120 bash -c "until docker logs rgw &> rgw.log && grep SUCCESS rgw.log; do sleep 1; done"

Once the above procedure is done, you can now run radosgw-admin4j tests without any config on the client-side, since the default config is meet the case. Run tests by:

$ git clone https://github.com/twonote/radosgw-admin4j.git
$ cd radosgw-admin4j
$ mvn test

β€œI already have a radosgw instance on hand”

First, you need an admin account. If you not yet have it, create the account with the following command:

$ radosgw-admin user create --uid=qqq --display-name="qqq" --access-key=qqq --secret-key=qqq
$ radosgw-admin --id admin caps add --caps="buckets=*;users=*;usage=*;metadata=*" --uid=qqq

Second, enter the key pair (qqq,qqq) and add your radosgw endpoint to the config file

Note that radosgw does not enable usage log in default. If you need the feature (or run test cases), be sure that you enable the usage log in Ceph config file. Example ceph.conf:

...
[client.radosgw.gateway]
rgw enable usage log = true
rgw usage log tick interval = 1
rgw usage log flush threshold = 1
rgw usage max shards = 32
rgw usage max user shards = 1
...

That's all!

Contributing

All contributions are welcome. Our code style is Google java style and we use google-java-format to do code formatting. Nothing else special.

Legal

Copyright 2017-2021 twonote & The "radosgw-admin4j" contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].