十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
小编给大家分享一下gdb如何调试ceph的radosgw,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!
成都创新互联公司成立于2013年,是专业互联网技术服务公司,拥有项目网站建设、成都网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元细河做网站,已为上家服务,为细河各地企业和个人服务,联系电话:18982081108
#gdb调试 rgw
修改gdb配置,设置为保存历史命令,p变量美化输出等
[root@ceph04 src]# cat ~/.gdbinit set history save on set print pretty on set pagination off set confirm off
切换到ceph04(10.254.3.81)的/home/yuliyang/ceph/src [root@ceph04 src]# pwd /home/yuliyang/ceph/src 使用vstart方式启动一个集群
./vstart.sh -d -n -X -r --short
创建admin用户
./radosgw-admin user create --uid=admin --display-name=admin --access-key=admin --secret=admin
rgw在8000端口 ps查看进程号
[root@ceph04 src]# ps aux|grep ceph root 10486 1.5 0.1 404376 201076 pts/2 Sl 11:40 1:22 ./ceph-mon -i a -c /home/yuliyang/ceph/src/ceph.conf root 10501 0.9 0.1 413592 202224 pts/2 Sl 11:40 0:54 ./ceph-mon -i b -c /home/yuliyang/ceph/src/ceph.conf root 10520 0.9 0.1 413592 201968 pts/2 Sl 11:40 0:51 ./ceph-mon -i c -c /home/yuliyang/ceph/src/ceph.conf root 10854 0.6 0.1 899744 226972 ? Ssl 11:40 0:35 ./ceph-osd -i 0 -c /home/yuliyang/ceph/src/ceph.conf root 11067 0.6 0.1 899748 226280 ? Ssl 11:40 0:34 ./ceph-osd -i 1 -c /home/yuliyang/ceph/src/ceph.conf root 11304 0.5 0.1 898720 222624 ? Ssl 11:40 0:31 ./ceph-osd -i 2 -c /home/yuliyang/ceph/src/ceph.conf root 11634 0.0 0.1 351560 157888 ? Ssl 11:40 0:01 ./ceph-mds -i a -c /home/yuliyang/ceph/src/ceph.conf root 11723 0.0 0.1 383336 164808 ? Ssl 11:40 0:03 ./ceph-mds -i b -c /home/yuliyang/ceph/src/ceph.conf root 11826 0.0 0.1 351556 158000 ? Ssl 11:40 0:01 ./ceph-mds -i c -c /home/yuliyang/ceph/src/ceph.conf root 12282 0.1 0.1 12470764 209416 ? Ssl 11:40 0:05 /home/yuliyangceph/src/.libs/lt-radosgw -c /home/yuliyang/ceph/src/ceph.conf --log-file=/home/yuliyang/ceph/src/out/rgw.log --debug-rgw=20 --debug-ms=1 root 22717 0.0 0.0 112648 952 pts/2 S+ 13:11 0:00 grep --color=auto ceph
attach进程
gdb attach 12282
打断点
(gdb) b process_request Breakpoint 1 at 0x7f465253ea20: file rgw/rgw_process.cc, line 37. (gdb) b rgw/rgw_process.cc:38 Breakpoint 2 at 0x7f465253ea2f: file rgw/rgw_process.cc, line 38. (gdb) b rgw/rgw_process.cc:39 Breakpoint 3 at 0x7f465253ea39: file rgw/rgw_process.cc, line 39.
运行
(gdb) c Continuing. [New Thread 0x7f462c7f8700 (LWP 23422)] [Thread 0x7f463c1ae700 (LWP 21983) exited] [Thread 0x7f463c5b2700 (LWP 21980) exited] [New Thread 0x7f465c472700 (LWP 23425)]
卡住在此。。。 执行创建100个桶,间隔1000s
for i in `seq 1 100`;do s3cmd -c yuliyang.s3cfg mb s3://test-$i ;sleep 1000 ;done;
在断点处停住
(gdb) c Continuing. [New Thread 0x7f462c7f8700 (LWP 23422)] [Thread 0x7f463c1ae700 (LWP 21983) exited] [Thread 0x7f463c5b2700 (LWP 21980) exited] [New Thread 0x7f465c472700 (LWP 23425)] [Switching to Thread 0x7f453affd700 (LWP 12363)] Breakpoint 1, process_request (store=0x7f465dd42840, rest=0x7ffd760c17e0, req=0x7f453affa800, client_io=0x7f453affa940, olog=0x0) at rgw/rgw_process.cc:37 37 { (gdb)
ctr x a 打开tui 发现停在断点处
n下一步,继续若干n后
查看userinfo
(gdb) p userinfo $2 = { auid = 0, user_id = { tenant = "", id = "" }, display_name = "", user_email = "", access_keys = std::map with 0 elements, swift_keys = std::map with 0 elements, subusers = std::map with 0 elements, suspended = 0 '\000', max_buckets = 1000, op_mask = 7, caps = { caps = std::map with 0 elements }, system = 0 '\000', default_placement = "", placement_tags = empty std::list, bucket_quota = { max_size_kb = -1, max_objects = -1, enabled = false, max_size_soft_threshold = -1, max_objs_soft_threshold = -1 }, temp_url_keys = std::map with 0 elements, user_quota = { max_size_kb = -1, max_objects = -1, enabled = false, max_size_soft_threshold = -1, max_objs_soft_threshold = -1 } }
list查看当前断点处周围的代码
(gdb) list 56 s->obj_ctx = &rados_ctx; 57 58 s->req_id = store->unique_id(req->id); 59 s->trans_id = store->unique_trans_id(req->id); 60 s->host_id = store->host_id; 61 62 req->log_format(s, "initializing for trans_id = %s", s->trans_id.c_str()); 63 64 RGWOp* op = NULL; 65 int init_error = 0;
继续n执行,查看*s变量
(gdb) p *s $3 = { cct = 0x7f465dcc5e10, cio = 0x0, req = 0x6, op = OP_UNKNOWN, op_type = RGW_OP_UNKNOWN, content_started = false, format = 0, formatter = 0x0, decoded_uri = "", relative_uri = "", length = 0x0, content_length = 0, generic_attrs = std::map with 0 elements, err = { http_ret = 200, ret = 0, s3_code = "", message = "" }, expect_cont = false, header_ended = false, obj_size = 0, enable_ops_log = false, enable_usage_log = false, defer_to_bucket_acls = 0 '\000', perm_mask = 0, header_time = { tv = { tv_sec = 0, tv_nsec = 0 } }, account_name = "", bucket_tenant = "", bucket_name = "", bucket = { tenant = "", name = "", data_pool = "", data_extra_pool = "", index_pool = "", marker = "", bucket_id = "", oid = "" }, object = { name = "", instance = "" }, src_tenant_name = "", src_bucket_name = "", src_object = { name = "", instance = "" }, bucket_owner = { id = { tenant = "", id = "" }, display_name = "" }, owner = { id = { tenant = "", id = "" }, display_name = "" }, zonegroup_name = "", zonegroup_endpoint = "", bucket_instance_id = "", bucket_instance_shard_id = -1, redirect = "", bucket_info = { bucket = { tenant = "", name = "", data_pool = "", data_extra_pool = "", index_pool = "", marker = "", bucket_id = "", oid = "" }, owner = { tenant = "", id = "" }, flags = 0, zonegroup = "", creation_time = { __d = { __r = 0 } }, placement_rule = "", has_instance_obj = false, objv_tracker = { read_version = { ver = 0, tag = "" }, write_version = { ver = 0, tag = "" } }, ep_objv = { ver = 0, tag = "" }, quota = { max_size_kb = -1, max_objects = -1, enabled = false, max_size_soft_threshold = -1, max_objs_soft_threshold = -1 }, num_shards = 0, bucket_index_shard_hash_type = 0 '\000', static NUM_SHARDS_BLIND_BUCKET = 4294967295, requester_pays = false, has_website = false, website_conf = { redirect_all = { protocol = "", hostname = "", http_redirect_code = 0 }, index_doc_suffix = "", error_doc = "", routing_rules = { rules = empty std::list } }, index_type = (unknown: 805334416), swift_versioning = false, swift_ver_location = "" }, bucket_attrs = std::map with 0 elements, bucket_exists = false, has_bad_meta = false, user = 0x7f453affa060, bucket_acl = 0x0, object_acl = 0x0, system_request = false, aws4_auth_needs_complete = false, aws4_auth = 0x0, canned_acl = "", has_acl_header = false, http_auth = 0x0, local_source = false, prot_flags = 0, os_auth_token = 0x0, swift_user = "", swift_groups = "", content_disp = { override = "", fallback = "" }, host_id = "", info = { env = 0x7f453affa950, args = { str = "", empty_str = "", val_map = std::map with 0 elements, sys_val_map = std::map with 0 elements, sub_resources = std::map with 0 elements, has_resp_modifier = false, admin_subresource_added = false }, x_meta_map = std::map with 0 elements, host = "127.0.0.1", method = 0x7f4530017e38 "PUT", script_uri = "/test-1/", 请求创建的桶名字 request_uri = "/test-1/", request_uri_aws4 = "", effective_uri = "", request_params = "", domain = "" }, init_state = { url_bucket = "", src_bucket = "" }, time = { tv = { tv_sec = 1470979550, tv_nsec = 592751627 } }, obj_ctx = 0x0, dialect = "", req_id = "", trans_id = "" }
查看结构体*s的其他信息
(gdb) p (*s).req_id $4 = "8e78e271-aa38-4121-bfc5-c9a74b816fc5.4115.9" (gdb) p (*s).trans_id $5 = "tx", '0', "9-0057ad5e60-1013-default" (gdb) p (*s).host_id $6 = ""
继续n,直到get_handler函数,按s进入函数
因为是put类型
直接break退出 查看op类型是create_bucket
查看当前线程
(gdb) thread
[Current thread is 106 (Thread 0x7f4538ff9700 (LWP 12367))]
q退出
看完了这篇文章,相信你对“gdb如何调试ceph的radosgw”有了一定的了解,如果想了解更多相关知识,欢迎关注创新互联行业资讯频道,感谢各位的阅读!