In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces you how to use libs3 for simple ceph radosgw testing and use, the content is very detailed, interested friends can refer to, hope to be helpful to you.
1. Introduction
Generally speaking, it is recommended to use the s3cmd tool for experience and testing of ceph object storage, but I need to provide the sdk package of libs3 Candle +, so I focus on libs3 and test it with libs3 commands, and the effect is similar to that of s3cmd. The command parameters are slightly different. For in-depth understanding, please read the source code, this article provides entry-level instructions.
two。 Compile and install 2.1 source code download
Download path of github libs3 source code
Please use git clone to download the source code from the server.
2.2 Source Code compilation and installation
The directory after downloading the source code is as follows:
# ll-htotal 136Kdrwxr-xr-x 2 root root 4.0K Jan 8 13:59 archlinuxdrwxr-xr-x 7 root root 4.0K Jan 8 13:59 build-rw-r--r-- 1 root root 653 Jan 5 14:57 ChangeLog-rw-r--r-- 1 root root 7.5K Jan 5 14:57 COPYINGdrwxr-xr-x 2 root root 4.0K Jan 8 13:59 debian-rw-r--r-- 1 root root 35K Jan 5 14:57 doxyfile-rw-r--r- -1 root root 14K Jan 5 14:57 GNUmakefile-rw-r--r-- 1 root root 9.7K Jan 5 14:57 GNUmakefile.mingw-rw-r--r-- 1 root root 9.9K Jan 5 14:57 GNUmakefile.osxdrwxr-xr-x 3 root root 4.0K Jan 8 13:59 inc-rw-r--r-- 1 root root 2.4K Jan 5 14:57 INSTALL-rw-r--r-- 1 root root 2.2K Jan 5 14:57 libs3.spec-rw- LICENSEdrwxr-xr-x 2 root root 4.0K Jan 8 13:59 mswin-rw-r--r-- 1 root root 126 Jan 5 14:57 READMEdrwxr-xr-x 2 root root 4.0K Feb 19 11:10 srcdrwxr-xr-x 2 root root 4.0K Jan 8 13:59 test-rw-r--r-- 1 root root 3.0K Jan 5 14:57 TODO
Brief description: inc header file src implementation file build is used to store compiled libraries and executable files
Execute the command make install to compile and install
# make install/usr/bin/s3: Installing executable/usr/lib/libs3.so.2.0: Installing shared library/usr/lib/libs3.so.2: Linking shared library/usr/lib/libs3.so: Linking shared library/usr/lib/libs3.a: Installing static library/usr/include/libs3.h: Installing header
It is important to note that when using the S3 command, you need to set parameters first:
Export S3 access key ID = "JD1*TCI4" export S3 security access key = "88sAejI*F4oHTLnqD" export S3 access host = "183.*" 3. Use
Object storage mainly has the following key operations: list all users' bucket
List the objects under a bucket
Create bucket
Delete bucket upload objects to a bucket Delete an object in a bucket download an object in a bucket
Here is an explanation of each of these operations:
3.1 list all bucket information under the current user # S3-u list Bucket Created -big_rd_test_bucket 2016-02-04T06:18:04Zmytest 2016-03-18T01:24:53Znew_bucket1 2016-03-15T05:05:35Zrd_test_bucket_fifty _ mb 2016-03-17T22:56:56Zwr_new_test_bucket_fifty 2016-03-18T01:10:00Zwr_test_bucket_fifty_mb 2016-03-18T00:30:38Z3.2 lists the object information under bucket # S3-u list new_bucket1 Key Last Modified Size-16 2016-03-15T05:11:08Z 3496ADBlockSetup.zip 2016-03-17T18:21:04Z 4.55MZoneData 2016-03-17T23:20:51Z 564Meclipse-java-mars-R-win32-x86_64.zip 2016-03-18T00:23:25Z 163Mnginx-1.6.3 .tar.gz 2016-03-17T23:17:24Z 786Kvirtual machine.big.rar 2016-03-18T01:12:36Z 3.86Gvirtual machine.rar 2016-03-18T00:31:29Z 1.93G3.3 create bucket# S3-u create xuwenqiangBucket successfully created.# S3-u list Bucket Created-wr_test_bucket_fifty_mb 2016-03-18T00:30:38Zwrite_test_bucket1 2016-03-20T18:23:53Zxuwenqiang 2016-03-21T04:30:06Z
As can be seen from the list command, the BUCKET xuwenqiang was created successfully.
Delete bucket# S3-u delete xuwenqiang# S3-u list Bucket Created -wr_new_test_bucket_fifty 2016-03-18T01:10:00Zwr_test_bucket_fifty_mb 2016-03-18T00:30:38Zwrite_test_bucket1 2016-03-20T18:23:53Z
Through the command, you can find that BUCKET xuwenqiang no longer exists
3.5 upload file # S3-u put new_bucket1/newkey1 filename=CephS3.o111392 bytes remaining (12% complete)... 95008 bytes remaining (25% complete)... 78624 bytes remaining (38% complete)... 62240 bytes remaining (51% complete)... 45856 bytes remaining (64% complete)... 29472 bytes remaining (76% complete)... 13088 bytes remaining (89% complete)... 3.6 Delete an object in BUCKET # S3-u list new_bucket1 Key Last Modified Size-1 2016-03-21T00:34:46Z 1.00G10 2016-03-20T18:29:10Z 50M11 2016-03-20T18:29:28Z 50M12 2016-03-20T18:29:31Z 50M# S3-u delete write_new_bucket1/1# S3-u list new_bucket1 Key Last Modified Size-- -- 10 2016-03-20T18:29:10Z 50M11 2016-03-20T18:29:28Z 50M12 2016-03-20T18:29:31Z 50M13 2016-03-20T18:29:28Z 50M14 2016-03-20T18:29:29Z 50M15 2016-03-20T18:29:30Z 50M16 2016-03-20T18:29:30Z 50M3.7 download an object in BUCKET
This example downloads a file with an ID of 10 from BUCKET new_bucket1 to the local file, named currenttest
# S3-u get new_bucket1/10 filename=currenttest# ll-htotal 3.8G. Currenttest RW Mar-1 root root 19K Feb 6 16:42 CephS3Test-WS.cpp-rw-r--r-- 1 root root 50m Mar 21 20:36 currenttest.
# 4 Appendix
Please set the environment variable before using it
If you are using the http protocol, please bring the-u option
I have made a simple version of SDK based on Libs3. The main interface is the above operations, but you can convert the operation commands into interfaces.
On how to use libs3 for simple ceph radosgw testing and use to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.