OpenStack Trove Essentials - Programmer-books

Transcription

www.allitebooks.com

OpenStack Trove EssentialsBuild your own cloud based Database as a Serviceusing OpenStack TroveAlok ShrivastwaSunil SaratBIRMINGHAM - MUMBAIwww.allitebooks.com

OpenStack Trove EssentialsCopyright 2016 Packt PublishingAll rights reserved. No part of this book may be reproduced, stored in a retrievalsystem, or transmitted in any form or by any means, without the prior writtenpermission of the publisher, except in the case of brief quotations embedded incritical articles or reviews.Every effort has been made in the preparation of this book to ensure the accuracyof the information presented. However, the information contained in this book issold without warranty, either express or implied. Neither the authors, nor PacktPublishing, and its dealers and distributors will be held liable for any damagescaused or alleged to be caused directly or indirectly by this book.Packt Publishing has endeavored to provide trademark information about all of thecompanies and products mentioned in this book by the appropriate use of capitals.However, Packt Publishing cannot guarantee the accuracy of this information.First published: March 2016Production reference: 1220316Published by Packt Publishing Ltd.Livery Place35 Livery StreetBirmingham B3 2PB, UK.ISBN om

CreditsAuthorsProject CoordinatorAlok ShrivastwaIzzat ContractorSunil SaratProofreaderSafis EditingReviewerDenys MakogonIndexerCommissioning EditorHemangini BariDipika GaonkarGraphicsKirk D'PenhaAcquisition EditorRahul NairProduction CoordinatorContent Development EditorShantanu N. ZagadeViranchi ShettyCover WorkShantanu N. ZagadeTechnical EditorNirant CarvalhoCopy EditorsJonathan ToddMadhusudan Uchilwww.allitebooks.com

About the AuthorsAlok Shrivastwa is a technologist from India, currently working as the directorof cloud services for Microland Ltd. in their Center of Innovation. He has a keeninterest in all things physical and metaphysical and is an innovator at heart. Hehas worked with multiple large- and medium-sized enterprises, designing andimplementing their network security solutions, automation solutions, databases,VoIP environments, datacenter designs, public and private clouds, and integrations.He has also created several tools and intellectual properties in the field ofoperationalization of emerging technologies. He has authored a book, LearningOpenStack, with Packt Publishing, and has authored several whitepapers and blogson technology and metaphysical topics, in addition to writing poems in Hindi. Also,he has been a guest speaker for undergraduate engineering students in Chennai.You can connect with him at https://in.linkedin.com/in/alokas or followhim on Twitter at @alok as.We are like the fire at the end of the matchstick, we appear when weare needed, and once our work here is completed, we disappear intothe same nothingness we all came from. I thank that nothingnesswe all fondly call God. I thank my mother, Seema, for making mewho I am today; my lovely sisters, Kawshiki and Abhabya; mybeautiful wife, Priyanka, for tolerating the insanity; and my fatherfor supporting me throughout.I thank the reviewers who were patient in reviewing the work andshaped the flow of the book. I thank all the editors at Packt for beingextremely helpful and understanding and finally Packt Publishingfor allowing me to share whatever little I know.www.allitebooks.com

Sunil Sarat is the vice president of cloud and mobility services at Microland Ltd.,an India-based global hybrid IT infrastructure services provider.He played a key role in setting up and running the emerging technologies practice,dealing with areas such as public/private cloud (AWS and Azure, VMware vCloudSuite, Microsoft, and OpenStack), hybrid IT (VMware vRealize automation/orchestration, Chef, and Puppet), enterprise mobility (Citrix Xenmobile and VMwareAirwatch), VDI /app virtualization (VMware Horizon Suite, Citrix XenDesktop/XenApp, Microsoft RDS, and AppV), and associated transformation services.He is a technologist and a business leader with expertise in creating new practicesand service portfolios, building and managing high-performance teams, strategydefinition, technological roadmaps, and 24/7 global remote infrastructureoperations. He has varied experience in handling diverse functions such asinnovation/technology, service delivery, transition, presales/solutions,and automation.He has authored whitepapers, blogs, and articles on various technologies andservice-related areas, is a speaker at cloud-related events, and reviews technicalbooks. He has authored Learning OpenStack and reviewed Learning AirWatch andMastering VMware Horizon 6, all by Packt Publishing.He holds various industry certifications in the areas of compute, storage, andsecurity and holds an MBA in marketing.Besides technology and business, he is passionate about filmmaking and is apart-time filmmaker as well.For more information, you can visit his LinkedIn profile at https://www.linkedin.com/in/sunilsarat or follow him on Twitter at @sunilsarat.Firstly, I would like to thank the Existence for enabling me to writethis book. I would like to thank my family—my mother, Ratna; wife,Abhaya; and my twins, Advika and Agnika—for supporting methroughout. Thanks to my friends Karthieyan K., Syed, Samina, andMayank for their encouragement.I thank Microland for all the exposure and support provided, whichwas instrumental for me to write this book. My gratitude to my coauthor Alok Shrivastwa and, last but not least, to Packt Publishingfor the opportunity and guidance.www.allitebooks.com

About the ReviewerDenys Makogon is a senior Python software engineer at EPAM and works inKharkiv, Ukraine. He is a writer and developer by day and a reader by night. Hispassion is helping people bring their technical skills up to the next level along withdeveloping skills that would become key features in obtaining a story of successfor both sides—developers and customers. He is an IT "tough guy", cloud-nativeapplication developer, and has started work as a software architect in cloud-basedsolutions. He is the founder of the Project Invader open source organization, mainlyfocused on developing and designing platform and software as a service applicationsfor OpenStack. He is a contributor to the OpenStack DBaaS and the CloudValidationopen source framework. He is a founder and technical project lead of the BeeDBproject. He has worked on OpenStack Cloud Applications Development -1119194318.html).I would like to say thank you to the entire team that helped me getthe work done in time and at an appropriate level and supportedme within this project and to my family that helped me stayconcentrated on this book.www.allitebooks.com

www.PacktPub.comeBooks, discount offers, and moreDid you know that Packt offers eBook versions of every book published, with PDFand ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy.Get in touch with us at customercare@packtpub.com for more details.At www.PacktPub.com, you can also read a collection of free technical articles, signup for a range of free newsletters and receive exclusive discounts and offers on Packtbooks and ion/packtlibDo you need instant solutions to your IT questions? PacktLib is Packt's online digitalbook library. Here, you can search, access, and read Packt's entire library of books.Why subscribe? Fully searchable across every book published by Packt Copy and paste, print, and bookmark content On demand and accessible via a web browserwww.allitebooks.com

www.allitebooks.com

Table of ContentsPrefaceChapter 1: Introducing OpenStack TroveDatabase as a ServiceAdvantagesReduced database management costsFaster provisioning and standardizationEasier administrationScaling and efficiencyvii1122333TroveArchitecture45Shared componentsAPIThe task managerThe guest agentThe conductorTerminologyDatastoreDatastore versionInstanceConfiguration groupFlavorDatabaseA multi-datastore scenarioDatabase software distribution supportPutting it all togetherUse casesDev/test databasesWeb application 1313

Table of ContentsFeaturesThe Juno releaseThe Kilo releaseThe Liberty releaseSummaryChapter 2: Setting up Trove with DevStack in a BoxRequirementsOperating systemDatabaseMessaging queueWeb serverInternet connectionPreparing the serverMinimum configuration requiredServer configurationSetting the IP addressInstalling prerequisitesAdding a userInstalling packagesDevStackDownloading the DevStack scriptUsing a proxy with Understanding the DevStack files25Configuring the DevStack installation26Installing DevStack30stack.shunstack.shrejoin-stack.shrun test.shexercise.shclean.shlocal.shStep 1 – copy the local.conf file from the samples directory to the base directoryStep 2 – modify the localrc sectionStep 3 – modify the local.conf to install Trove and SwiftUsing a proxy server2525252626262628282930Verifying the installationTroubleshooting the installWorking with screenScreen control keyUseful commands3435363636[ ii ]

Table of ContentsDevStack and screen37Killing DevStackRestarting DevStack services3838Summary40Different methods of deploying OpenStackRequired OpenStack servicesPlanning the installWhere to install the Trove componentsTake a backupInstalling TroveInstalling Trove from sourceInstalling with the Ubuntu OpenStack repositoryConfiguring TroveSetting up the MySQL databaseKeystone configurationModifying the configuration files424444444546464849505152Initializing the Trove databaseRestarting the servicesSummary545455Chapter 3: Installing Trove in an Existing OpenStack Environment 41trove.conftrove-taskmanager.conf and trove-conductor.conftrove-guestagent.confChapter 4: Preparing the Guest ImagesStructure of a guest imageInstance creation using the guest imageCreating the Trove guest imageInstallation using configuration management systemsInstallation using templatesDisk Image BuilderRed stack scripts5253535758596162626372Uploading the Trove imagesModify QCOW2 images using guestfishInstalling guestfishLoading the imagesModify the files on the imageSend commands727576767677Summary78Example: Adding a user to the Ubuntu QCOW2 image[ iii ]77

Table of ContentsChapter 5: Provisioning Database InstancesChecking for prerequisitesLaunching our first instanceLogging into the instance via SSHLaunching the instance using the GUIConnect to the database instanceInstance operationsResizeTerminate the Trove instancesTroubleshootingSummaryChapter 6: Configuring the Trove InstancesDefault datastore and version configurationModifying the instance configurationConfiguration groupsDefining configuration parametersUploading configuration parametersCreating a configurationApplying the configuration to an instanceVerificationViewing the configurationPatching the configurationUpdating the configurationRemoving the 4105105106107109110111Verification111Adding a new parameterSummaryChapter 7: Database Backup and RestoreFormulating a backup and recovery planBacking up/restoring in TroveThe concept of strategies in TroveThe backup/restore strategy in actionConfiguring the backup strategiesConfiguring the storage strategiesBackup prerequisites[ iv ]112113115115116116118119120121

Table of ContentsBackups and restoresFull backupIncremental backupViewing the backupRestoring backupsDeleting backupsSummaryChapter 8: Advanced Database FeaturesReplication and clusteringReplicationClusteringReplication in TroveSupported data storesSetting up replicationsCreating a replicated pairVerifying replicationFailover optionsPromote to the replica masterEject the masterDetach replicaClustering in TroveSupported data storeCreating and uploading the MongoDB imageCreating a 28129129129130132133134136137138139139140141144145

PrefaceDatabase management has come a long way over the last decade or so. The processof provisioning databases used to start with racking and stacking a physicalserver, installing and configuring an operating system, and finally, installing andconfiguring a database management system. This entire process took weeks and,in some cases, months. Once the database is provisioned, you then of course havea whole host of things to be managed, including availability, backups, security,and performance. This provisioning and management consumed a lot of time andresources. During the evolution, we had two trends that have had a significantimpact on the way databases were provisioned and managed. Automation easedthe management aspect and virtualization eased the provisioning, at least up tothe operating-system layer. Meanwhile, the other trend that we have seen is thatenterprises are moving away from a single database technology model to a modelwhich is fancily termed "polyglot persistence". This basically means adoptingmultiple database technologies with the intention of storing the data in a databasethat is best suited for that type of data. With multiple types of database technologiescoming into play, enterprises are finding it difficult to manage this complexity whilemaintaining corporate standards and compliance.[ vii ]

PrefaceFortunately for us, over the last couple of years, cloud is the other trend that came toour rescue. With the advent of cloud, we have initially seen self-service based agileprovisioning of infrastructure take off, which has been termed as Infrastructure asa Service and has automated a lot of aspects and made infrastructure managementeasier. Building on this a bit more, we now have self-service based agile provisioningof multiple types of databases, which is p

OpenStack, with Packt Publishing, and has authored several whitepapers and blogs on technology and metaphysical topics, in addition to writing poems in Hindi. Also, he has been a guest speaker for undergraduate engineering students in Chennai. You can connect with him at https://in.linkedin.com/in/alokas or follow him on Twitter at @alok_as.