ebook img

OpenStack Swift: Using, Administering, and Developing for Swift Object Storage PDF

336 Pages·2014·9.46 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview OpenStack Swift: Using, Administering, and Developing for Swift Object Storage

www.it-ebooks.info www.it-ebooks.info OpenStack Swift Joe Arnold and members of the SwiftStack team www.it-ebooks.info OpenStack Swift by Joe Arnold and members of the SwiftStack team Copyright © 2015 SwiftStack, Inc.. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://safaribooksonline.com). For more information, contact our corporate/ institutional sales department: 800-998-9938 or [email protected]. Editor: Andy Oram Indexer: Judy McConville Production Editor: Nicole Shelby Cover Designer: Ellie Volckhausen Copyeditor: Charles Roumeliotis Interior Designer: David Futato Proofreader: Carla Thornton Illustrator: Rebecca Demarest October 2014: First Edition Revision History for the First Edition: 2014-10-08: First release See http://oreilly.com/catalog/errata.csp?isbn=9781491900826 for release details. The O’Reilly logo is a registered trademark of O’Reilly Media, Inc. OpenStack Swift, the cover image, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While the publisher and the authors have used good faith efforts to ensure that the information and in‐ structions contained in this work are accurate, the publisher and the authors disclaim all responsibility for errors or omissions, including without limitation responsibility for damages resulting from the use of or reliance on this work. Use of the information and instructions contained in this work is at your own risk. If any code samples or other technology this work contains or describes is subject to open source licenses or the intellectual property rights of others, it is your responsibility to ensure that your use thereof complies with such licenses and/or rights. ISBN: 978-1-491-90082-6 [LSI] www.it-ebooks.info www.it-ebooks.info Creating and Updating the Rings 37 Creating or Updating Builder Files 37 Rebalancing the Rings 38 Inside the Rings 38 Conclusion 39 4. Swift Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Talking to the Cluster: The Swift API 41 Sending a Request 42 Storage URL 42 Authentication 43 HTTP Verbs 43 Authorization and Taking Action 44 Getting a Response 44 Communication Tools 45 Command-Line Interfaces 46 Custom Client Applications 48 Example Scenarios 49 Conclusion 50 Part II. Application Design with Swift 5. Overview of the Swift API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 What Is an API, Anyway? 53 The CAP Theorem 54 Swift’s Sweet Spot: High Availability, Redundancy, and Throughput 55 Swift API: Background 56 Review of the Hypertext Transfer Protocol (HTTP) 57 Representational State Transfer (REST) 59 Swift, HTTP, and REST 60 Using the Swift API 61 About Your Swift Cluster 61 Authentication 62 Retrieving Data 63 Storing Data 65 Deleting Data 66 Updating Metadata 67 Conclusion 67 6. Swift Client Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 Client Libraries 69 iv | Table of Contents www.it-ebooks.info The Authentication Exchange 70 Storage Requests: Basic Usage 71 Client Libraries in Other Languages 74 Ruby 74 PHP 74 Java 75 Storage Requests: Advanced Usage 75 Additional Considerations When Using Python 76 Conclusion 77 7. Advanced API Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Large Objects 79 Object Versioning 81 Object Expiration 81 Temporary URL Middleware (TempURL) 82 Form Post Middleware 82 Custom Metadata 83 PUTting and POSTing Metadata 84 Cross-Origin Resource Sharing (CORS) 84 Swift Cluster Info 85 Range Requests 86 Domain Remap Middleware 86 Static Web Hosting 87 Content-Type Header 88 Bulk Operations Middleware 88 Code Samples 89 Static Large Objects 89 Dynamic Large Objects 90 Object Versioning 91 TempURL (Time-Limited URLs) 92 Form Post 93 Cross-Origin Resource Sharing 94 Custom Metadata 95 Swift Cluster Info 95 Range Requests 96 Domain Remapping 97 Static Web Hosting 98 Content-Type 99 Bulk Upload 99 Bulk Delete 99 Conclusion 100 Table of Contents | v www.it-ebooks.info 8. Developing Swift Middleware. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 Introduction to WSGI 101 Programming WSGI 103 Streaming and Making Modifications to Data 105 Configuring Middleware Through Paste 106 How to Write Swift Middleware 109 Inside Out 110 Some Simple Examples 111 Doing More in Middleware 112 A Look Back and a Look Forward 117 Conclusion 118 Part III. Installing Swift 9. Installing OpenStack Swift from Source. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Downloading OpenStack Swift 121 Dependencies 122 Installing the Swift CLI (python-swiftclient) 122 Installing Swift 122 Copying in Swift Configuration Files 123 Configuring Swift 123 Adding Drives to Swift 123 Storage Policies 127 Creating the Ring Builder Files 129 Adding Devices to the Builder Files 134 Adding Drives 136 Building the Rings 136 Configuring Swift Logging 137 Creating the Log Configuration File 137 Restarting Rsyslog to Begin Swift Logging 138 Configuring a Proxy Server 138 Setting the Hash Path Prefix and Suffix 138 Starting the Proxy Server 139 Setting up TempAuth Authentication and Authorization with Swift 139 Starting memcached 139 Adding Users to proxy-server.conf 140 Starting the Servers and Restarting the Proxy 140 Account Authentication 141 Verifying Account Access 142 Creating a Container 143 Uploading an Object 144 vi | Table of Contents www.it-ebooks.info Starting the Consistency Processes 144 Configuring rsync 145 Starting the Remaining Consistency Processes 146 Conclusion 146 10. Installing SwiftStack. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 SwiftStack Controller and Node Overview 147 SwiftStack Controller 147 SwiftStack Node 149 Creating a Swift Cluster Using SwiftStack 150 Creating a SwiftStack Controller User 151 Installing the SwiftStack Node Software 151 Claiming a New Node 152 Creating a Cluster 152 Ingesting a Node 153 Enabling a SwiftStack Node 154 Provisioning a SwiftStack Node 154 Adding Swift Users 155 SwiftStack Middleware 156 Deploying to Cluster 156 Creating a Container and Uploading an Object via Web Console 157 Conclusion 158 Part IV. Planning a Swift Deployment 11. Hardware for Swift. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Node Hardware Specifications 162 CPU 162 RAM 165 Drives 167 Cluster Networking 168 Network Cards 169 Outward-Facing Network 170 Cluster-Facing Network 170 Replication Network 171 Out-of-Band Management 171 Other Networking Connections 171 Conclusion 171 12. Planning a Swift Deployment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 Your Use Case 173 Table of Contents | vii www.it-ebooks.info System Design 175 How Many Nodes? 175 Tiering Node Services 180 Defining Your Cluster Space 180 Node Naming Conventions 182 Authentication and Authorization 183 Networking 184 Outward-Facing Network 185 Cluster-Facing Network 186 Sample Deployments 188 Small Cluster: Several Nodes 189 Medium-Size Cluster: Multi-Rack 189 Large Cluster: Multi-Region 189 Conclusion 190 13. Authentication and Authorization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191 Authentication 191 How Authentication Works 192 Authentication Request 194 Authentication Handling 197 Authentication Response 199 Using the Auth Token in Storage Requests 201 Authorization 201 Authorization Examples 201 How Authorization Works 202 Storage Request Processing 205 Token Verification and Authorization Information Lookup 206 Authorization Callback and Response 206 Authorization and Access Levels 207 Account-Level Access Control 208 Read-Only Access 209 Read-Write Access 209 Admin Access 209 JSON for Account Access Control 209 Container-Level Access Control 210 Container ACL Examples 211 Swift Authentication Systems 212 Keystone 212 TempAuth 212 SWAuth 213 SwiftStack Authentication Systems 214 SwiftStack Auth 214 viii | Table of Contents www.it-ebooks.info

Description:
Get up and running with OpenStack Swift, the free, open source solution for deploying high-performance object storage clusters at scale. In this practical guide, Joe Arnold, co-founder and CEO of SwiftStack, brings you up-to-speed on the basic concepts of object storage and walks you through what yo
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.