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 RadosGW Framework in ceph

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Editor to share with you the example analysis of the RadosGW framework in ceph. I hope you will get something after reading this article. Let's discuss it together.

RadosGW analysis.

First, the main () function parsing of RadosGW.

The main () function of RadosGW is located in rgw_main.cc, which is the entry function of RadosGW. Here, we mainly analyze the content related to RadosGW and omit the content of WebServer as much as possible.

The main () function is parsed as follows:

1. The front-end WebServers is supported by default according to gallows confession-> rgw_frontends. Currently, the default supported front-end WebServer includes fastcgi and civetweb. For each supported front end, there is a RGWFrontendConfig class corresponding to it. Finally, the name of WebServer and the corresponding RGWFrontendConfig class are set to the fe_map collection.

2. Call the global_init () function to initialize

3. Call the rgw_tool_init () function to read the data in the file specified by gencrypted confession-> rgw_mime_type_file and initialize the

4. Call curl_global_init () function to initialize libcurl, from which we can see that rgw uses curl for network data transmission.

5. Call FCGX_Init () to initialize WebServer

6. Call the RGWStoreManager::get_storage () function to initialize the librados object, that is, all future operations on the Ceph cluster have to go through the librados object.

7. Call rgw_rest_init () to initialize the rest part

8. Call the rgw_user_init () function to initialize the user-related class RGWUserMetadataHandler in radosgw, and register the class in store- > meta_mgr

9. Call the rgw_buckt_init () function to initialize the classes RGWBucketMetadataHandler and RGWBucketInstanceMetadataHandler about bucket in radosgw, and register these two classes in store- > meta_mgr

10. For S3-compatible API, use the RGWRESTMgr_S3 class as the default handling class for the rest interface in radosgw

11. For operations that support admin, register the administrator to operate the corresponding class RGWRESTMgr_Usage/RGWRESTMgr_User/RGWRESTMgr_Bucket/RGWRESTMgr_Metadata/RGWRESTMgr_Log/RGWRESTMgr_Opstate/RGWRESTMgr_ReplicaLog/RGWRESTMgr_Config/RGWRESTMgr_Realm

12. Register the signal processing function to process signals such as SIGUP/SIGTERM

Initialize front-end WebServer and run front-end WebServer

14. Call the wait_shutdown () function to wait for the radosgw process to finish execution

The actual Web request processing is inside the rgw_process.cc::process_request () function, which handles data read and write requests at the front end of the Web.

Second, the analysis process of process_request () function.

Int process_request (RGWRados* store, RGWREST* rest, RGWRequest* req, RGWStreamIO* client_io, OpsLogSocket* olog)

Parameter description:

Store: the return value of RGWStoreManager::get_storage () called in the main () function in rgw_main.cc

Rest: the return value of calling rest.register_default_mgr (new RGWRESTMgr_S3 ()) in the main () function in rgw_main.cc, that is, rest is an instance of class RGWRESTMgr_S3

Processing flow:

1) rest- > get_handler (): get the RGWHandler_REST class instance, including: RGWHandler_REST_Service_S3/RGWHandler_REST_Bucket_S3/RGWHandler_REST_Obj_S3

2) handler- > get_op (): get the corresponding operation processing class according to the op of request, such as GET/PUT/DELETE/POST, etc.

3) handler- > authorize (): perform authentication operation. The specific calling process is as follows:

Handler- > authorize ()

| | _ RGWHandler_REST_S3::authorize () |

| | _ RGW_Auth_S3::authorize () |

| | _ _ RGW_Auth_S3::authorize_v4 () / RGW_Auth_S3::authorize_v2 () / |

According to whether the request header of the client contains the contents of http_auth and http_auth, it is determined to use S3v4 or S3v2 for authentication

4) handler- > postauth_init (): check the validity of bucket and object names.

Handler- > postauth_init ()

| | _ _ rgw_parse_url_bucket () resolves tenant name and bucket name |

| | _ _ validate_tenant_name () verifies the validity of the tenant name |

| | _ _ validate_s3_bucket_name () verifies the validity of the S3bucket name |

| | _ _ validate_object_name () verifies the validity of object names |

5) handler- > init_permissions (): read and create bucket validity check information.

Handler- > init_permissions ()

| | _ rgw_build_bucket_policies () |

| | _ _ initialize req_state- > bucket_acl is a RGWAccessControlPolicy_S3 instance |

| | _ _ RGWRados::get_bucket_info () / RGWRados::get_bucket_instance_info () gets bucket info information |

| | _ _ read_policy () reads ACL information of bucket, attribute information of bucket, etc. |

| | _ _ RGWRados::get_zonegroup () reads the zone information of bucket |

6) handler- > retarget () relocates and calculates the storage object, which is valid for some ways of website access.

7) handler- > read_permissions () get the ACL information of bucket and object

8) op- > init_processing ()

Op- > init_processing ()

| | _ RGWOp::init_processing () |

| | _ RGWOp::init_quota () |

| | _ _ get bucket_quota |

| | _ _ get user_quota |

9) op- > verify_op_mask ()

Op- > verify_op_mask ()

| | _ _ RGWOp::verify_op_mask () checks whether the op_mask of the operation is consistent with the op_mask of the user |

10) op- > verify_permission ()

Op- > verify_permission ()

| | _ _ call the verify_permission () function corresponding to the RGWOpsubclass, and it is up to the RGWOpsubclass to determine whether the permission is satisfied |

11) op- > verify_params ()

Op- > verify_params ()

| | _ _ RGWPutObj_ObjStore::verify_params () / RGWPostObj_ObjStore::verify_params () checks whether the size of the uploaded data exceeds the value of gupload confession-> rgw_max_put_ size |

12) op- > pre_exec ()

Op- > pre_exec ()

| | _ _ calls the pre_exec () function corresponding to the RGWOpsubclass, which is handled by the RGWOpsubclass |

13) op- > execute ()

Op- > execute ()

| | _ _ calls the execute () function corresponding to the RGWOpsubclass, which is handled by the RGWOpsubclass |

14) op- > complete ()

Op- > complete ()

| | _ RGWOp::complete () |

| | _ _ calls the send_response () function corresponding to the RGWOpsubclass, which is handled by the RGWOpsubclass |

Therefore, when actually handling object storage requests, the main functions that need to be handled by the RGWOp subclass include:

1) RGWOp::verify_permission ()

2) RGWOp::pre_exec ()

3) RGWOp::execute ()

4) RGWOp::send_response ()

After reading this article, I believe you have some understanding of "sample Analysis of RadosGW Framework in ceph". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

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