Ceph對象存儲1.概念對象存儲(Object Storage)是一種用于存儲大量非結構化數據的架構模型它使用簡單的HTTP或HTTPS協議進行文件訪問,而不是傳統的文件系統API與傳統的文件系統存儲方式不同,對象存儲不是將數據存儲在目錄或文件夾中,而是將數據存儲為獨立的數據對象,每個對象都包含數據本身、元數據(描述數據的屬性)以及唯一標識符2.Ceph對象存儲服務的搭建及使用1)啟動rgw服務ceph orch apply rgw myrgw --placement="3 ceph1 ceph2 ceph3" --port 80802)創建對象存儲的用戶radosgw-admin user create --uid=testuser --display-name="Test User" --email=test@tedu.cn --access-key=12345 --secret-key=67890radosgw-admin:這是Ceph提供的命令行工具,用于管理RADOS Gateway的配置和用戶。3)安裝awscli.noarch對象存儲的操作工具yum -y install awscli.noarch配置s3 cli工具aws configure --profile=cephAWS Access Key ID [None]: 12345 #輸入access_keyAWS Secret Access Key [None]: 67890 #輸入secret_keyDefault region name [None]: #回車Default output format [None]: #回車4)創建桶:桶為存儲的對象提供了一個全局唯一的命名空間,桶的名稱唯一,不會與其他桶中的對象沖突。aws --profile=ceph --endpoint=http://ceph1:8080 s3 mb s3://testbucket--profile=ceph:包含了訪問AWS服務所需的憑證(Access Key和Secret Key),上面指定的 --endpoint=http://ceph1:8080**:這指定了S3服務的端點(Endpoint)s3 mb s3://testbucket:s3 mb是“make bucket”的縮寫,而s3://testbucket指定了要創建的桶的名稱。5)文件上傳aws --profile=ceph --endpoint=http://ceph1:8080 --acl=public-read-write s3 cp /etc/hosts s3://testbucket/hosts.txt查看桶里面的文件aws --profile=ceph --endpoint=http://ceph1:8080 s3 ls s3://testbucket/訪問測試curl http://ceph1:8080/testbucket/hosts.txt6)文件下載wget -O zhuji.txt http://ceph1:8080/testbucket/hosts.txt訪問通過瀏覽器訪問https://192.168.88.11:8443,用戶名為admin,密碼是安裝時指定的123456
Ceph對象存儲
?? ?1.概念
?? ?對象存儲(Object Storage)是一種用于存儲大量非結構化數據的架構模型
?? ?它使用簡單的HTTP或HTTPS協議進行文件訪問,而不是傳統的文件系統API
?? ?與傳統的文件系統存儲方式不同,對象存儲不是將數據存儲在目錄或文件夾中,而是將數據存儲為獨立的數據對象,每個對象都包含數據本身、元數據(描述數據的屬性)以及唯一標識符
?? ?2.Ceph對象存儲服務的搭建及使用
?? ?
?? ??? ?1)啟動rgw服務
?? ??? ?ceph orch apply rgw myrgw --placement="3 ceph1 ceph2 ceph3" --port 8080
?? ?
?? ??? ?2)創建對象存儲的用戶
?? ??? ?radosgw-admin user create --uid=testuser --display-name="Test User" --email=test@tedu.cn --access-key=12345 --secret-key=67890
?? ??? ?radosgw-admin:這是Ceph提供的命令行工具,用于管理RADOS Gateway的配置和用戶。
?? ??? ?3)安裝awscli.noarch對象存儲的操作工具
?? ??? ??? ?yum -y install awscli.noarch
?? ??? ??? ?
?? ??? ??? ?配置s3 cli工具
?? ??? ??? ?aws configure --profile=ceph
?? ??? ??? ?AWS Access Key ID [None]: 12345 ? ? ? ? #輸入access_key
?? ??? ??? ?AWS Secret Access Key [None]: 67890 ? ? #輸入secret_key
?? ??? ??? ?Default region name [None]: #回車
?? ??? ??? ?Default output format [None]: #回車
?? ??? ?4)創建桶:桶為存儲的對象提供了一個全局唯一的命名空間,桶的名稱唯一,不會與其他桶中的對象沖突。
?? ??? ??? ?aws --profile=ceph --endpoint=http://ceph1:8080 s3 mb s3://testbucket
?? ??? ?--profile=ceph:包含了訪問AWS服務所需的憑證(Access Key和Secret Key),上面指定的?? ?
?? ??? ?--endpoint=http://ceph1:8080**:這指定了S3服務的端點(Endpoint)
?? ??? ?s3 mb s3://testbucket:s3 mb是“make bucket”的縮寫,而s3://testbucket指定了要創建的桶的名稱。
?? ??? ?5)文件上傳
?? ??? ??? ?aws --profile=ceph --endpoint=http://ceph1:8080 --acl=public-read-write s3 cp /etc/hosts s3://testbucket/hosts.txt
?? ??? ??? ?查看桶里面的文件
?? ??? ??? ?aws --profile=ceph --endpoint=http://ceph1:8080 s3 ls s3://testbucket/
?? ??? ??? ?訪問測試
?? ??? ??? ?curl http://ceph1:8080/testbucket/hosts.txt
?? ??? ?6)文件下載
?? ??? ??? ?wget -O zhuji.txt http://ceph1:8080/testbucket/hosts.txt
?? ?訪問
?? ??? ?通過瀏覽器訪問https://192.168.88.11:8443,用戶名為admin,密碼是安裝時指定的123456