Lab 2.4 - Ceph Operational (Object Storage)
Preparation
Before you begin, run the nusatl login command to login your account. Credentials for login is same with your registered credentials in this platform (ADINUSA).
student@ceph1:~$ nusactl login
After login, run the nusactl start cpadm-002-4 command. This command runs the start script and pre-configures your lab environment.
student@ceph1:~$ nusactl start cpadm-002-4
Instruction
Note: Execute on pod-<username>-ceph1 node.
1. Login to ceph-adm user, and create realm.
su - ceph-adm
sudo radosgw-admin realm create --rgw-realm=myorg --default
2. Create zone grup.
sudo radosgw-admin zonegroup create --rgw-zonegroup=jkt --master --default
3. Create zone.
sudo radosgw-admin zone create --rgw-zonegroup=jkt --rgw-zone=id-jkt-1 --master --default
4. Commit realm.
sudo radosgw-admin period update --rgw-realm=myorg --commit
5. Create Radosgateway.
# Update the number of RGW instances for the given zone
sudo ceph orch apply rgw jkt --realm=myorg --zone=id-jkt-1 --port=8080 --placement="1 pod-<username>-ceph1"
6. Watch orch ls until not shown unknown.
# List services
sudo watch "ceph orch ls | grep jkt"
7. Install awscli.
# awscli provides commands for interacting with AWS services. With minimal configuration.
sudo apt install -y awscli
8. List user.
sudo radosgw-admin user list
9. Create user.
# Users should be created on the Ceph object storage backend. This will generate the S3 API credentials.
sudo radosgw-admin user create --uid=user0 --display-name=user0
10. Save the key from output when creating user.
"keys": [
{
"user": "user0",
"access_key": "I2BS5OV91EXHEQ9HJ81F",
"secret_key": "HesLszdZB1v3aDEYwzd1PtHHdesBMGIZq0GlRVt6"
}
11. Verify user.
sudo radosgw-admin user list
12. Configure aws client user.
# Before you start using the AWS CLI tools to interact with AWS services,
# you need to configure them by running the aws configure command.
sudo aws configure --profile=user0
AWS Access Key ID [None]: I2BS5OV91EXHEQ9HJ81F
AWS Secret Access Key [None]: HesLszdZB1v3aDEYwzd1PtHHdesBMGIZq0GlRVt6
Default region name [None]: id-jkt-1
Default output format [None]: json
13. Create bucket.
# Note: A bucket is a container for objects. When the object is in the bucket, you can open it, download it, and move it.
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3api create-bucket --bucket bucket0
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3api create-bucket --bucket bucket1
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3api create-bucket --bucket bucket2
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3 ls
14. List bucket.
# Create a files for upload to bucket
echo "file0" > file0.txt
echo "file1" > file1.txt
echo "file2" > file2.txt
# Upload your files as objects in your bucket
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3 cp file0.txt s3://bucket0
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3 cp file1.txt s3://bucket1
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3 cp file2.txt s3://bucket2
# List objects within a bucket
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3 ls s3://bucket0
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3 ls s3://bucket1
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3 ls s3://bucket2
15. Delete file.
rm file0.txt file1.txt file2.txt
ls
16. Download an object in a bucket.
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3 cp s3://bucket0/file0.txt .
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3 cp s3://bucket1/file1.txt .
sudo aws --profile user0 --endpoint-url http://pod-<username>-ceph1:8080/ s3 cp s3://bucket2/file2.txt .
ls file*