client guide (obscmd) - static.huaweicloud.com · 4 python installation reference ... huawei...
TRANSCRIPT
Object Storage Service
Client Guide (obscmd)
Issue 02
Date 2018-05-31
HUAWEI TECHNOLOGIES CO., LTD.
Copyright © Huawei Technologies Co., Ltd. 2018. All rights reserved.No part of this document may be reproduced or transmitted in any form or by any means without prior writtenconsent of Huawei Technologies Co., Ltd. Trademarks and Permissions
and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.All other trademarks and trade names mentioned in this document are the property of their respectiveholders. NoticeThe purchased products, services and features are stipulated by the contract made between Huawei and thecustomer. All or part of the products, services and features described in this document may not be within thepurchase scope or the usage scope. Unless otherwise specified in the contract, all statements, information,and recommendations in this document are provided "AS IS" without warranties, guarantees orrepresentations of any kind, either express or implied.
The information in this document is subject to change without notice. Every effort has been made in thepreparation of this document to ensure accuracy of the contents, but all statements, information, andrecommendations in this document do not constitute a warranty of any kind, express or implied.
Huawei Technologies Co., Ltd.Address: Huawei Industrial Base
Bantian, LonggangShenzhen 518129People's Republic of China
Website: http://www.huawei.com
Email: [email protected]
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
i
Contents
1 Overview......................................................................................................................................... 11.1 OBS................................................................................................................................................................................ 11.2 obscmd............................................................................................................................................................................1
2 Configuration................................................................................................................................. 32.1 System Requirements..................................................................................................................................................... 32.2 Registering a Cloud Service Account.............................................................................................................................32.3 Subscribing to OBS........................................................................................................................................................ 42.4 Logging In to OBS Console........................................................................................................................................... 42.5 Creating Access Keys (AK and SK)...............................................................................................................................42.6 Installing obscmd............................................................................................................................................................62.6.1 Obtaining Software Packages......................................................................................................................................62.6.2 Installing Tools............................................................................................................................................................ 62.7 Configuring Common Parameters to Interconnect with OBS........................................................................................ 6
3 Operation Guide..........................................................................................................................183.1 Uploading Local Files.................................................................................................................................................. 183.1.1 Settings...................................................................................................................................................................... 183.1.2 Running Examples.....................................................................................................................................................223.2 Downloading Files from a Bucket................................................................................................................................263.2.1 Settings...................................................................................................................................................................... 263.2.2 Running Examples.....................................................................................................................................................27
4 Python Installation Reference...................................................................................................314.1 Checking the Python Version....................................................................................................................................... 314.2 Upgrading or Installing Python.................................................................................................................................... 314.2.1 Checking Whether GCC Is Installed......................................................................................................................... 314.2.2 Upgrading or Installing OpenSSL............................................................................................................................. 324.2.3 Installing Python........................................................................................................................................................33
5 Issue Handling............................................................................................................................. 365.1 An error is reported when the obscmd tool is running on the distributed storage system............................................36
A Change History........................................................................................................................... 37
Object Storage ServiceClient Guide (obscmd) Contents
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
ii
1 Overview
1.1 OBSObject Storage Service (OBS) is a cloud storage service that provides capabilities formassive, secure, reliable, and cost-effective data storage. With OBS, you can easily create,modify, and delete buckets, as well as uploading, downloading, and deleting objects.
OBS provides super large storage capacity that can store any type of files and is suitable forwebsites, enterprises, developers, and common subscribers. As a web service, OBS providesservice interfaces over Hypertext Transfer Protocol (HTTP) and Hypertext Transfer ProtocolSecure (HTTPS). From any Internet connected computer, you can use OBS Consoleand OBSclients (such as OBS Browser and obscmd) to access OBS and manage data stored on OBSanytime, anywhere. In addition, OBS provides Representational State Transfer (REST)application programming interfaces (APIs). Therefore, you can easily manage your datastored on OBS and develop a wide range of upper-layer applications.
As a cloud service, OBS features flexible expansion and allows the infrastructure to bedeployed in multiple regions, while maintaining high reliability. Therefore, you can accessOBS in specific regions according to your service needs and experience rapid access speed atcost-effective prices.
For further details about OBS, see OBS Product Introduction.
1.2 obscmdWritten in Python, obscmd is an open-source client developed for uploading files to anddownloading files from OBS. It is applicable to Linux operating system. Compared to othersimilar tools, obscmd features the capability of processing concurrent uploading anddownloading tasks, implementing quick data transmission. Therefore, obscmd isrecommended for transferring data in large volume.
For data transfer, obscmd presents the following advantages:
l Supports multi-part uploading for single files in large size.
Object Storage ServiceClient Guide (obscmd) 1 Overview
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
1
l Supports multi-range downloading for single files in large size.
l Supports concurrent uploading or downloading of multiple files.
l Supports downloading of folders or single files from a specified bucket.
Object Storage ServiceClient Guide (obscmd) 1 Overview
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
2
2 Configuration
2.1 System Requirementsobscmd is running on Linux operating system, compatible with all Linux versions. Inaddition, the obscmd running environment depends on Python. Table 2-1 lists the versiondependency and descriptions.
Table 2-1 Python versions and descriptions
Component/Module
Requirement Description Suggestion
Python Python 2 is required, andthe version must be 2.7.9or later, for example,Python 2.7.14.
Python versionsearlier than 2.7.9 arenot compatible withHTTPS TLS1.1/1.2.
Upgrade the Pythonversion. For details,see Python Upgradeand Installation.
Pythonencryptionmodule
SSL module has beeninstalled.Run the followingcommand. If no result isdisplayed, it indicates thatthe SSL module has beeninstalled properly.python -c "import ssl"
Encrypted datatransfer over HTTPScannot beimplemented if thePython version doesnot support the SSLmodule.
For details, seePython ToolInstallationReference.
2.2 Registering a Cloud Service AccountBefore using OBS, ensure that you have a cloud service account.
Procedure
Step 1 Open a browser.
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
3
Step 2 Log in to the HUAWEI CLOUD website at http://www.huaweicloud.com/en-us/.
Step 3 Click Register.
Step 4 Complete the registration as instructed.
After the registration is completed, you will be navigated to your account information page.
----End
2.3 Subscribing to OBSYou need to recharge your account before using OBS.
Procedure
Step 1 Log in to OBS Console.
Step 2 Click Fees in the upper right corner of the page. The Billing Center page is displayed.
Step 3 Then click Top Up. The recharging window is displayed.
Step 4 Recharge the account as prompted.
Step 5 After your account is recharged successfully, close the window.
Step 6 On the homepage, click Object Storage Service to log in to OBS Console.
----End
2.4 Logging In to OBS ConsoleYou can log in to OBS Console using a web browser.
Procedure
Step 1 Log in to the HUAWEI CLOUD website at http://www.huaweicloud.com/en-us/.
Step 2 Click Management Console in the upper right corner.
Step 3 Use your account to log in to the console.
If you have not registered with the public cloud, click Register and register a public cloudservice account as instructed.
Step 4 On the homepage of the management console, choose All Services > Storage > ObjectStorage Service.
----End
2.5 Creating Access Keys (AK and SK)This section describes how to create access keys (AKs and SKs) in OBS Console. A pair ofAK and SK is used to encrypt the signature of a request, ensuring that the request is secureand integral, and that identities of the request sender and receiver are correct.
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
4
ContextAKs and SKs support the authentication mechanism of Identity and Access Management(IAM). Detailed explanations are as follows:
l An AK is an Access Key ID on OBS. One AK maps to only one user but one user canhave multiple AKs. OBS recognizes users by their AKs.
l An SK is the Secret Access Key on OBS, which is required as the key to access OBS.You can generate authentication information based on SKs and request header fields.SKs and AKs are in one-to-one mapping.
ConstraintsEach user can create up to two valid AK/SK pairs.
PrerequisitesYou have registered and activated a cloud account.
Procedure
Step 1 Log in to OBS Console.
Step 2 Click the username in the upper right corner of the page, and then choose Account.
Step 3 On the Account Info page, click Manage on the right of Security Credentials.
Step 4 Then click Add Access Key on the Access Keys tab.
Step 5 In the Add Access Key dialog box that is displayed, enter the password and its verificationcode.
NOTE
l If you have not bound an email address or mobile number, you need to enter only the password.
l If you have bound an email address and a mobile number, you can select the verification either byemail address or mobile number.
Step 6 Click OK.
Step 7 In the Download Access Key dialog box that is displayed, click OK to save the access keysto your browser's default download path.
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
5
NOTE
Keep the AK secure to prevent it from being leaked. If you click Cancel in the dialog box, the AKs will notbe downloaded, and you cannot download them later. You can re-create an AK if you need to use it.
Step 8 Open the downloaded credentials.csv file to obtain the access keys (AK and SK).
----End
2.6 Installing obscmd
2.6.1 Obtaining Software PackagesTable 2-2 lists the software packages required for installing obscmd. You can also downloadobscmd from the GitHub website.
Table 2-2 Software downloading links
Software Description Download Link
obscmd Tool package l http://static.huaweicloud.com/upload/files/obs/cmd.zip
l https://github.com/huaweicloud-obs/obscmd
Python Running environment ofPython
https://www.python.org/downloads/
2.6.2 Installing Toolsobscmd is implemented on the basis of Python, and can be directly used upon decompressionof the software package.
Procedure
Step 1 Upload the software package to the planned directory in the host used for data upload anddownload, for example, /home/tools.
Step 2 Run the following command to extract the tool to the planned directory:
unzip obscmd.zip -d /home/tools/
----End
2.7 Configuring Common Parameters to Interconnect withOBS
After obscmd is successfully installed, you need to configure parameters in obscmd tointerconnect with OBS. Only after obscmd is authenticated by OBS, you can access OBSthrough obscmd.
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
6
PrerequisitesYou have prepared resources needed for interconnection. Specifically, you have installedobscmd and obtained the access key to OBS.
Procedure
Step 1 Use user root to log in to the host where obscmd is installed.
Step 2 Run the cd command to switch to the directory where the tool is located.
Example: cd /home/tools/obscmd
Step 3 Configure the tool's running parameters by editing parameter values in the config.dat file.
Run the following command to open the obscmd configuration file and complete the basicconfiguration:
vi config.dat
Open the configuration file and enter the editing mode. Configure basic parameters as needed.Table 2-3 lists the parameters and descriptions.
Table 2-3 Common parameters
Parameter Description Mandatory/Optional
Remarks
AK Access key ID Mandatory An identifier thatconfirms the identityof a user thataccesses OBS. Oneaccess key IDbelongs to only oneuser, but one usercan have multipleaccess key IDs. OBSrecognizes users bytheir AKs.
SK Secret access key Mandatory The secret accesskey of a user toaccess OBS. Asecret access keyand a request headerform a set ofauthenticationinformation for auser. SKs and AKsare in one-to-onemapping.
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
7
Parameter Description Mandatory/Optional
Remarks
MultipartObjectSize Indicates thethreshold size of theobject that will bedivided into multipleparts for operations(byte).
Mandatory If an object size isgreater than theMultipartObject-Size, the object willbe uploaded andmerged in themultipart mode ordownloaded in therange mode.
PartSize Part size (byte) Mandatory According to OBSrequirements, thepart size ranges from5 MB to 5 GB. Thedefault size is 50MB. You canconfigure the size tothe value that caneffectively matchyour clientperformance andnetwork conditions.
Concurrency Number ofconcurrent threadsor processes
Mandatory Indicates the numberof concurrentthreads or processesthat a user canexecute. The defaultvalue is 20, meaningthat one user owns20 concurrentthreads. If thisparameter is leftblank, the value isdeemed as 1 bydefault.
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
8
Parameter Description Mandatory/Optional
Remarks
BucketNameFixed Bucket name Mandatory Name of a bucket towhich objects areuploaded, or fromwhich objects aredownloaded. Alloperations areperformed on thebucket.You need to createbuckets on OBSfirst.Example:BucketNameFixed= fixed-bucket-01
Region Region Optional Indicates the regionwhere the requestedbucket resides.If the environment isin the multi-regionmode and KMSserver-sideencryption or aspecial algorithm forauthenticationsignature is used,then you need tospecify the region.
VirtualHost Switch of the virtualhosting request
Mandatory Indicates whether touse the virtualhosting mode toissue requests. If it isenabled, ensure thatthe domain name iscorrect (the defaultvalue is true).Examplel true (enable
virtual hosting)l false (disable
virtual hosting)
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
9
Parameter Description Mandatory/Optional
Remarks
DomainName Domain name Mandatory Indicates the domainname address towhich a request issent.The configureddomain nameinformation mustmatch the regioninformation.
IsHTTPs Switch of HTTPS Mandatory Indicates whetherHTTP or HTTPSrequest is used. Thedefault value is true.Value options:l true (enable
HTTPS)l false (enable
HTTP)
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
10
Parameter Description Mandatory/Optional
Remarks
sslVersion SSL version Optional Indicates the versionID of SSL. Thisparameter takeseffect only when thevalue of IsHTTPs istrue. If IsHTTPs isleft blank,sslVersion uses thedefault valueSSLv23.Value options:l TLSv1l TLSv1_1l TLSv1_2l SSLv23l SSLv2l SSLv3
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
11
Parameter Description Mandatory/Optional
Remarks
NOTE
l TLSv1: TLS v1.0is selected.
l TLSv1_1: If theparameter is setto this value,OpenSSL version1.0.1 or later isrequired, and thePython versionmust be 2.7.9 orlater.
l TLSv1_2: themost secureprotocol availablecurrently. If theparameter is setto this value,OpenSSL version1.0.1 or later isrequired, and thePython versionmust be 2.7.9 orlater.
l SSLv23:indicates that themost secureprotocol will benegotiatedautomatically.
l SSLv2: Thisparameter isinvalid ifOPENSSL_NO_SSL2 iscontained in theOpenSSLcompilation. Thisprotocol isinsecure and isnotrecommended.
l SSLv3: Thisparameter isinvalid ifOPENSSL_NO_SSL3 iscontained in theOpenSSLcompilation. Thisprotocol isinsecure and isnotrecommended.
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
12
Parameter Description Mandatory/Optional
Remarks
SrvSideEncryptType Server-sideencryption
Optional Indicates theencryption methodused on the serverside. Leave thisparameter blank, ifyou do not need toenable server-sideencryption.The value is case-insensitive.Value options:l SSE-KMS: Uses
the keysprovided byKMS for server-side encryption.
l SSE-C: Uses thekeys and MD5values providedby customers forserver-sideencryption.
CustomerKey SSE-C encryptionkey
This parameter isrequired if SSE-Cencryption is used.
You need to providethe key used forobject encryption, ifSSE-C isconfigured.
ConnectTimeout Timeout (s) Mandatory Connection setup/request waitingtimeout interval(measured bysecond). If thetimeout interval isless than fiveseconds, the toolautomatically setsthe timeout period tofive seconds.The default value is300.
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
13
Parameter Description Mandatory/Optional
Remarks
CompareETag Verifies Etag andMD5 to check dataconsistency.
Optional Specifies whether toverify, and recordsthe local MD5 codeand the ETagreturned by theserver in the detailfile. By default, thisfunction is disabled.To achieve optimalperformance, it isrecommended thatyou disable thisfunction if the sizeof a file to beuploaded ordownloaded isgreater than 10 GB.Value options:l truel false
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
14
Parameter Description Mandatory/Optional
Remarks
RecordDetails Switch of requestinformationrecording
Mandatory Indicates where torecord result detailsof every request.If this parameter isenabled, operationdetails of everyrequest will berecorded in theresult/***_detail.csv file.Value options:l true (enable)l false (disable)NOTE
l The***_detail.csvfile is expressedin the form ofDate_Time_Operationtype_Concurrentnumber_detail.csv.
l Example:2017.12.06_16.35.22_PutObject_20_detail.csv
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
15
Parameter Description Mandatory/Optional
Remarks
BadRequestCounted Switch of invalidrequest counting
Mandatory If the value is set totrue, invalidrequests will becounted in theperformancestatistics. Therefore,deviations mayoccur on thefollowing statistics:avgLatency(average latency ofresponses to yourrequests),tps (number oftransactions persecond),sendBPS (totalbytes sent),and recvBPS (totalbytes received).
RunSeconds Running duration (s) Optional The tool exitsrunning after thespecified duration.The tool will exitupon completion ofconfigured requests,even if the specifiedduration time is notdue. If the value isset to 0, thisparameter will nottake effect. The toolexits uponcompletion ofconfigured requests.
PrintProgress Switch of real-timeresult printing
Mandatory Indicates whether toprint the result andprogress in realtime.Value options:l true (enable)l false (disable)
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
16
Parameter Description Mandatory/Optional
Remarks
CheckRoot Restricts the rightsof the operatingaccount.
Mandatory Indicates whetheronly the rootaccount is allowedto performoperations. Thedefault value isfalse.Value options:l true: Yesl false: No
----End
Object Storage ServiceClient Guide (obscmd) 2 Configuration
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
17
3 Operation Guide
3.1 Uploading Local Files
3.1.1 SettingsThe local upload function enables obscmd to read configuration items in the config.dat file tocontrol the transmission. It reads the local directory from which files are uploaded and thesize of a single file or a part.
In addition to common parameters in the config.dat file, you need to set the followingparameters according to the actual condition of the directory, from which files are uploaded,as shown in Table 3-1.
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
18
Table 3-1 Parameters related to uploading local files
Parameter Description Mandatory/Optional
Remarks
LocalPath Directory fromwhich files areuploaded
Mandatory Local folder or filepaths from whichobjects areuploaded. If specificsingle files are to beuploaded, usecommas (,) toseparate paths fromeach other. If youneed to specify afolder path, you canspecify only onepath at a time.Example:l /home/objectsl /home/dir1/1.txtl /home/
dir1/1.txt,/home/dir2/2.txt
IgnoreExist Switch of ignoringobjects that havebeen uploaded tobuckets
Mandatory Indicates whether toskip objects thathave been uploaded.Value options:l true (Do not
upload objectsthat have beenuploaded before.)
l false (Uploadobjects that havebeen uploadedbefore.)
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
19
Parameter Description Mandatory/Optional
Remarks
RemoteDir Directory in thebucket to whichobjects will beuploaded to
Optional Indicates thedirectory in thebucket to whichobjects will beuploaded to. If thisparameter is leftblank, objects areuploaded to the rootdirectory of abucket. If thespecified directorydoes not exist,obscmdautomaticallycreates the directory.Example:RemoteDir = dir/
PutWithACL Access ControlPolicyObject accesscontrol policy
Optional Specify the ACLwhen uploadingobjects. For detailsabout ACL policies,see Table 3-2. Thedefault configurationis private.Value options:l privatel public-readl public-read-
writel authenticated-
readl bucket-owner-
readl bucket-owner-
full-control
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
20
Parameter Description Mandatory/Optional
Remarks
CheckFileChanging Checks whether thelocal file is beingmodified.
Optional Checks whether thelocal file is beingmodified. Local fileswill be skipped ifthey are beingmodified. If thisparameter is leftblank, this functionis disabled bydefault.Value options:l truel false
ArchiveAfterUpload Indicates whether toarchive successfullyuploaded files.
Optional Indicates whether toarchive successfullyuploaded files. Ifthis parameter is leftblank, the functionis disabled bydefault.Value options:l truel false
ArchiveDir Archiving path This parameter ismandatory whenArchiveAfterUploadis set to true.
Specifies the dataarchive path. Thedefault path is /home/archive. If thedirectory does notexist, it will becreated during dataarchiving.Example:/home/archive
Table 3-2 Description of pre-defined permission control policies in OBS
Pre-defined Access Control Policy Description
private Indicates that the owner of a bucket or objecthas the full permissions to the bucket or object.Other users have no permission to access thebucket or object.
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
21
Pre-defined Access Control Policy Description
public-read Indicates that the owner of a bucket or objecthas the full permissions to the bucket or object.Other users including anonymous users havethe read permission.
public-read-write Indicates that the owner of a bucket or objecthas the full permissions to the bucket or object.Other users including anonymous users havethe read and write permissions.
authenticated-read Indicates that the owner of a bucket or objecthas the full permissions to the bucket or object.Other OBS authorized users have the readpermission.
bucket-owner-read Indicates that the owner of an object has thefull permissions to the object and the owner ofthe bucket where the object resides has the readpermission.
bucket-owner-full-control Indicates that the owner of an object has thefull permissions to the object and the owner ofthe bucket where the object resides has the fullpermissions to the object.
log-delivery-write Indicates that a log delivery user has the writepermission to the bucket and the readpermission to the ACP.
3.1.2 Running Examples
After the common parameters and local upload parameters are configured, you can run thepython run.py command in the installation directory of obscmd to upload local objects toOBS.
NOTE
l If the ./run.py is used, ensure that the run.py file has the execute permission. Run the chmod +x *command as user root to add the permission.
l When you run the python run.py command, obscmd checks whether the mandatory parameters areset in the configuration file. If not, obscmd prompts you to enter the parameters as temporaryparameters.
Example:
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
22
The following figure shows the running process when uploading local files.
The following figure shows the result summary after the local file upload is complete:
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
23
Table 3-3 describes the command output items.
Table 3-3 Command output items
Displayed Item Description
Operation Operation type
RunTime Running duration (expressed in the format:hh'mm'ss.milliseconds)
RunningThreads Number of threads that are running
HTTPs Indicates whether the request is sent overHTTP or HTTPS. true indicates HTTPS,and false indicates HTTP.
LongConnection Indicates whether the connection is long orshort. true indicates the long connection,and false indicates the short connection.
Threads Total number of threads that are running
Requests Number of requests that are being executed(or finally executed).
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
24
Displayed Item Description
OK Number of succeeded requests among thetotal requests that are being executed (orfinally executed).
ClientErrs Number of requests that fail to be processeddue to client errors.
ServerErrs--OuterFlowControl--InnerFlowControl
Number of requests that fail to be processeddue to server errors.External flow control error on the current(final) serverInternal flow control error on the current(final) server
OtherErrs All the currently (finally) unknown errors(no response received), such as networkfaults
ErrRate Current (final) error rate
TPS Current (final) number of transactions persecond
Last5TPS Number of transactions processed persecond in the recent five cycles. The countstarts from 0 and every addition 3-secondperiod is counted as a cycle.
AvgLatency Average response time of all successfulrequests during concurrent running of thecurrent user
latencyPercent Indicates the percentage of occupiedrequests in each time segment duringconcurrent running. The value is a characterstring.
DataSend Total number of bytes sent currently (orfinally)
DataRecv Total number of bytes received currently (orfinally). 0 indicates no response has beenreceived.
SendThroughput Total number of bytes sent currently (orfinally)
RecvThroughput Current (final) calculated transmitbandwidth
BestReq Current (final) IDs and response durationsof the top three requests with the fastestresponse time
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
25
Displayed Item Description
WorstReq Current (final) IDs and response durationsof the top three requests with the slowestresponse time
ExecutePath Directory where the running tool is located
3.2 Downloading Files from a Bucket
3.2.1 Settingsobscmd can read the config.dat file to download objects according to the configuration file.
For object downloading, in addition to common parameters in the config.dat file, you need toset the following parameters, as shown in Table 3-4.
Table 3-4 Parameters related to downloading objects from buckets
Parameter Description Mandatory/Optional
Remarks
DownloadTarget Target objectsto bedownloadedfrom thebucket
Optional If this parameter is left blank, allobjects in the bucket will bedownloaded. Specified folders andobjects will be downloaded if thisparameter is configured. You canspecify folders and files at thesame time, and use commas (,) toseparate them from each other.Example:l DownloadTarget = home/dir/
(Download a folder.)l DownloadTarget = home/obj
(Download a single object.)l DownloadTarget = home/obj*
(Download objects with theprefix obj from the homefolder.)
SavePath Local savingpath
Mandatory Local path for saving downloadedobjects. If you specify a local paththat does not exist, obscmd willautomatically create this path.
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
26
3.2.2 Running ExamplesThe following figure shows an example of downloading objects from a bucket to a localdirectory:
The following figure shows the result summary after objects are downloaded to the local path:
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
27
l Command output items
Displayed Item Description
Operation Operation type. GetObject indicatesdownloading.
RunTime Running duration of the current task(expressed in the format:hh'mm'ss.milliseconds)
RunningThreads Total number of threads that are running
HTTPs Indicates whether the request is sent overHTTP or HTTPS. true indicates HTTPS,and false indicates HTTP.
LongConnection Indicates whether the HTTP connection islong or short. true indicates the longconnection, and false indicates the shortconnection.
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
28
Displayed Item Description
Threads Total number of threads that are running
Requests Number of requests that are being executed(or finally executed).
OK Number of succeeded requests among thetotal requests that are being executed (orfinally executed).
ClientErrs Number of requests that fail to be processeddue to client errors.
ServerErrs--OuterFlowControl--InnerFlowControl
Number of requests that fail to be processeddue to server errors.External flow control error on the current(final) serverInternal flow control error on the current(final) server
OtherErrs All the currently (finally) unknown errors(no response received), such as networkfaults
ErrRate Current (final) error rate
TPS Current (final) number of transactions persecond
Last5TPS Number of transactions processed persecond in the recent five cycles. The countstarts from 0 and every addition 3-secondperiod is counted as a cycle.
AvgLatency Average response time of all successfulrequests during concurrent running of thecurrent user
latencyPercent Indicates the percentage of occupiedrequests in each time segment duringconcurrent running. The value is a characterstring.
DataSend Total number of bytes sent currently (orfinally)
DataRecv Total number of bytes received currently (orfinally). 0 indicates no response has beenreceived.
SendThroughput Total number of bytes sent currently (orfinally)
RecvThroughput Currently (finally) calculated transmitbandwidth (download bandwidth)
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
29
Displayed Item Description
BestReq Current (final) IDs and response durationsof the top three requests with the fastestresponse time
WorstReq Current (final) IDs and response durationsof the top three requests with the slowestresponse time
ExecutePath Directory where the running tool is located
Object Storage ServiceClient Guide (obscmd) 3 Operation Guide
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
30
4 Python Installation Reference
4.1 Checking the Python VersionRun the python –V command to query the current Python version.
Table 2-1 lists Python version requirements. If the version requirements are not met, upgradeor install Python according to the following sections.
4.2 Upgrading or Installing Python
4.2.1 Checking Whether GCC Is InstalledRun the gcc -v command to check whether the GCC compiler has been installed.
l If the following information is displayed in the command output, it indicates that GCC isinstalled:
Figure 4-1 Command output indicating that GCC is installed
l If the following information is displayed in the command output, it indicates that GCC isnot installed:
Object Storage ServiceClient Guide (obscmd) 4 Python Installation Reference
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
31
Figure 4-2 Command output indicating that GCC is not installed
You need to re-compile and install OpenSSL or Python. The client must support GCCcompilation.
l If the GCC is installed when Internet is connected, you can run the following commands: apt install gcc // ubuntu operating system yum install gcc //RedHat, CentOS
4.2.2 Upgrading or Installing OpenSSLTake OpenSSL 1.0.2l as an example:
Download the latest OpenSSL version at https://www.openssl.org/source/.
Upload openssl-1.0.2x.tar.gz to the client using SFTP or other protocols. (x indicates theOpenSSL version, it is recommended that you use the latest version.)
Alternatively, you can run the following commands to download the package to the local path:
wget https://www.openssl.org/source/openssl-1.0.2n.tar.gztar -xvf openssl-1.0.2n.tar.gz //Extract to current directory.cd openssl-1.0.2n //Go to the extracted directory../config -fPIC //Configure parameters.
Compile and install OpenSSL:
make && make install
Object Storage ServiceClient Guide (obscmd) 4 Python Installation Reference
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
32
Create a soft connection to verify the installation:
rm /usr/bin/opensll //Delete the previous OpenSSL path.ln -s /usr/local/ssl/bin/openssl /usr/bin/opensll //Created a new OpenSSL path.
4.2.3 Installing PythonTake Python 2.7.14 as an example:
Download the latest Python version at https://www.python.org/downloads/.
Upload Python-2.7.14.tgz to the client, decompress the package and go to the directory towhich the package is extracted.
Alternatively, you can directly download the package to the local path:
wget https://www.python.org/ftp/python/2.7.14/Python-2.7.14.tgztar -xvf Python-2.7.14.tgz (Extract to a local directory.)cd Python-2.7.14 (Go to the extracted directory.)./configure (Configure)
Compile and install Python:
make (Compile)make install (Install)
Object Storage ServiceClient Guide (obscmd) 4 Python Installation Reference
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
33
Upgrade the default Python version:
rm /usr/bin/python //Delete the link to the default Python version.ln -s /usr/local/bin/python2.7 /usr/bin/python //Created a link to the new Python version.python -v //Check whether the new Python version is installed.
Object Storage ServiceClient Guide (obscmd) 4 Python Installation Reference
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
34
NOTICEInstallation of the new Python version may cause Yum of the original Linux systemunavailable. The reason is that Yum runs on the existing Python version and does not supportthe updated Python version.The method for rectifying this issue is as follows:# Modifying the yum filevi /usr/bin/yumChange the #!/usr/bin/python in the file head to #!/usr/bin/python2.7 (The Python versionpath is the path in the actual operating system version. You can run the ll /usr/bin/pythoncommand to obtain the original version information).
Object Storage ServiceClient Guide (obscmd) 4 Python Installation Reference
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
35
5 Issue Handling
5.1 An error is reported when the obscmd tool is runningon the distributed storage system.
Symptom1. When the obscmd is installed on a distributed storage system (such as lustre or glusterfs),
the obscmd tool reports an error. The error information is as follows: Function notimplemented.
2. On the distributed file system, create tmpfile and run the following command in Python.If Function not implemented is displayed, the problem is caused by the same problem.import fcntlfd = open('tmpfile','w')fcntl.flock(fd,1)quit()
Causeslustre and glusterfs are not compatible with the fcntl.flock function. As a result, an error isreported.
SolutionDo not save the obscmd in the distributed storage system. You can save the obscmd in a localdirectory of the physical machine and then run it.
Object Storage ServiceClient Guide (obscmd) 5 Issue Handling
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
36
A Change History
Release Date What's New
2018-05-31 This issue is the second official release.This issue incorporates the following change:l Added the section "Issue Handling".
2018-01-31 This issue is the first official release.
Object Storage ServiceClient Guide (obscmd) A Change History
Issue 02 (2018-05-31) Huawei Proprietary and ConfidentialCopyright © Huawei Technologies Co., Ltd.
37