Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Ceph object Storage

2025-04-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the example analysis of Ceph object storage, which is very detailed and has certain reference value. Friends who are interested must finish it!

Let's talk about the deployment of the environment first. I have already deployed the ceph environment, but there is no gateway server. So let's start with the deployment of gateway

Follow the official documentation step by step (root account is used by default):

When installing apache,radosgw, I won't go into detail here, but when loading proxy_fcgi_module, there are problems related to directory errors if you follow the steps on the official website. So later I load directly in the / etc/httpd/conf/httpd.conf file, there is no need to judge the correlation, but note that the order should be placed at the end of the corresponding proxy paragraph.

LoadModule proxy_http_module modules/mod_proxy_http.soLoadModule proxy_ajp_module modules/mod_proxy_ajp.soLoadModule proxy_connect_module modules/mod_proxy_connect.soLoadModule proxy_fcgi_module modules/mod_proxy_fcgi.soLoadModule cache_module modules/mod_cache.soLoadModule suexec_module modules/mod_suexec.so

Configuration:

one。 Create a user and keyring, and execute the following command on ceph's admin machine (mon)

1. Create keyring

Ceph-authtool-- create-keyring / etc/ceph/ceph.client.radosgw.keyringchmod + r / etc/ceph/ceph.client.radosgw.keyring

two。 Create gateway user (client.radosgw) and generate key

Ceph-authtool / etc/ceph/ceph.client.radosgw.keyring-n client.radosgw.gateway-- gen-key

3.Add capabilities to the key

Ceph-authtool-n client.radosgw.gateway-- cap osd 'allow rwx'-- cap mon' allow rwx' / etc/ceph/ceph.client.radosgw.keyring

4. Add the generated key to the ceph cluster (the weird thing here is that you can't see the client.radosgw in the ceph.client.admin.keyring file)

Ceph-k / etc/ceph/ceph.client.admin.keyring auth add client.radosgw.gateway-I / etc/ceph/ceph.client.radosgw.keyring

5. Copy keyring to gateway server (deploy)

Scp / etc/ceph/ceph.client.radosgw.keyring deploy:/etc/ceph/ceph.client.radosgw.keyring

two。 I omitted the step to create the pool needed for gateway, because the test uses the default configuration, and how to set up the specific pg has not been studied. Will be automatically generated at that time.

three。 Add gateway configuration to ceph.conf, (restart ceph cluster after this step)

Add to the / etc/ceph/ceph.conf file on the admin node

[client.radosgw.gateway] host= {hostname} keyring = / etc/ceph/ceph.client.radosgw.keyringrgw socket path = "" log file = / var/log/radosgw/client.radosgw.gateway.logrgw frontends = fastcgi socket_port=9000 socket_host=0.0.0.0rgw print continue = false

two。 Distribute new ceph.conf files to all machines

Ceph-deploy-overwrite-conf config push

3. Copy ceph.client.admin.keyring file to gateway server

Scp / etc/ceph/ceph.client.admin.keyring deploy:/etc/ceph/

four。 Start the RADOSGW service

Create a directory on the gateway server (deploy)

Mkdir-p / var/lib/ceph/radosgw/ceph-radosgw.gateway

two。 Modify relevant permissions

Chown apache:apache / var/run/cephchown apache:apache / var/log/radosgw/client.radosgw.gateway.log

3. Start the service

/ etc/init.d/ceph-radosgw start

five。 Create a gateway profile (apache related)

Vi / etc/httpd/conf.d/rgw.confServerName localhostDocumentRoot / var/www/htmlErrorLog / var/log/httpd/rgw_error.logCustomLog / var/log/httpd/rgw_access.log combined# LogLevel debugRewriteEngine OnRewriteRule. *-[SetEnv proxy-nokeepalive 1ProxyPass / fcgi://localhost:9000/

Then restart the apache service

Sudo service httpd restart

six。 Create a radosgw user

Radosgw-admin user create-uid= "testuser"-display-name= "First User" radosgw-admin subuser create-uid=testuser-subuser=testuser:swift-access=fullradosgw-admin key create-subuser=testuser:swift-key-type=swift-gen-secret

The terminal will generate the following information, recording the key,secret and other related information needed to access the gateway.

{"user_id": "testuser", "display_name": "First User", "email": "," suspended ": 0," max_buckets ": 1000," auid ": 0," subusers ": [{" id ":" testuser:swift "," permissions ":" full-control "}] "keys": [{"user": "testuser:swift", "access_key": "CGZCR5W392RCBMY0DSCY", "secret_key": ""}, {"user": "testuser", "access_key": "G54W4H94RYL2GGZ96PHF", "secret_key": "kyMAW8A9MmysFz7XgUFHuAFtYcNGGQci9DCfNU1V"}] "swift_keys": [{"user": "testuser:swift", "secret_key": "5SnFvgi3VGgcuODSSez92ruB1Qx7vc8oL4GLVFas"}], "caps": [], "op_mask": "read, write, delete", "default_placement": "", placement_tags ": []," bucket_quota ": {" enabled ": false Max_size_kb:-1, max_objects:-1}, user_quota: {"enabled": false, "max_size_kb":-1, "max_objects":-1}, "temp_url_keys": []}

At this point, the configuration is complete. Next is the test interview:

First, S3 access:

Install python-boto

Yum install python-botovi s3test.pyimport botoimport boto.s3.connectionaccess_key = 'I0PJDPCIYZ665MW88W9R'secret_key =' dxaXZ8U90SXydYzyS5ivamEP20hkLSUViiaR+ZDA'conn = boto.connect_s3 (aws_access_key_id = access_key,aws_secret_access_key = secret_key,host = 'deploy',is_secure=False,calling_format = boto.s3.connection.OrdinaryCallingFormat () ) bucket = conn.create_bucket ('my-new-bucket') for bucket in conn.get_all_buckets (): print "{name}\ t {created}" .format (name = bucket.name, created = bucket.creation_date,)

Pay attention to modify access_key,secret_key,host according to your actual situation

After running, a pool of .rgw.buckets.index is generated, under which there is an object called the corresponding my-new-bucket (with a different name). You can view it with the following command

Rados lspoolsrados ls-p. Rgw.buckets.index

2.swift access

Installation:

Yum install python-setuptoolseasy_install pippip install-- upgrade setuptoolspip install-- upgrade python-swiftclientswift-A http://10.19.143.116/auth/1.0-U testuser:swift-K '244mm fz2gSqoHwR3lYtSbIyomyPHf3i7rgSJrFmax IA'list

Note that the ip should be replaced with the gateway server ip, and the subsequent key should also be replaced according to your own situation. After success, you should be able to see the bucket generated before.

My-new-bucket

The above is all the content of the article "sample Analysis of Ceph object Storage". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report