Trove
Trove
Amrith Kumar
Douglas Shelley
OpenStack Trove
Copyright © 2015 by Amrith Kumar and Douglas Shelley
This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with
reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed
on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or
parts thereof is permitted only under the provisions of the Copyright Law of the Publisher’s location, in its
current version, and permission for use must always be obtained from Springer. Permissions for use may be
obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under
the respective Copyright Law.
ISBN-13 (pbk): 978-1-4842-1222-6
ISBN-13 (electronic): 978-1-4842-1221-9
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol
with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only
in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are
not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director: Welmoed Spahr
Lead Editor: Louise Corrigan
Technical Reviewer: Nikhil Manchanda
Editorial Board: Steve Anglin, Louise Corrigan, Jim DeWolf, Jonathan Gennick, Robert Hutchinson,
Michelle Lowman, James Markham, Susan McDermott, Matthew Moodie, Jeffrey Pepper,
Douglas Pundick, Ben Renow-Clarke, Gwenan Spearing, Steve Weiss
Coordinating Editor: Mark Powers
Copy Editor: Lori Jacobs
Compositor: SPi Global
Indexer: SPi Global
Artist: SPi Global
Distributed to the book trade worldwide by Springer Science+Business Media New York,
233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505,
e-mail [email protected], or visit www.springeronline.com. Apress Media, LLC is a California LLC
and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc).
SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail [email protected], or visit www.apress.com.
Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use.
eBook versions and licenses are also available for most titles. For more information, reference our Special
Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this text is available to
readers at www.apress.com/9781484212226. For additional information about how to locate and download
your book’s source code, go to www.apress.com/source-code/. Readers can also access source code at
SpringerLink in the Supplementary Material section for each chapter.
I dedicate this book to my dear wife, Kamlu. Without your help, support, and the innumerable lost
nights, weekends, and interrupted vacations, this book would never have happened. I've really
enjoyed working with Doug on this. I learned a lot in this process, which may be best summarized
this way.
—Amrith Kumar
I dedicate this book to my wife, Debbie, and my daughters, Alexa and Sarah. They have endured
many years of listening to me attempt to excite them with descriptions of various technologies – most
lately OpenStack and Trove. Their support for my foray into Tesora, Trove, and OpenStack, including
the away time with the community, has really made this possible. I have learned a lot working with
Amrith on this book and I really hope It is useful to our readers.
—Doug Shelley
Contents at a Glance
■
■Chapter 1: An Introduction to Database as a Service�������������������������������������������� 1
■
■Chapter 2: Downloading and Installing OpenStack Trove������������������������������������ 17
■
■Chapter 3: Basic Trove Operations���������������������������������������������������������������������� 47
■
■Chapter 4: Concepts and Architecture����������������������������������������������������������������� 73
■
■Chapter 5: Advanced Trove Operations�������������������������������������������������������������� 107
■
■Chapter 6: Debugging and Troubleshooting������������������������������������������������������ 149
■
■Chapter 7: Building Guest Images for Trove������������������������������������������������������ 165
■
■Chapter 8: Operating Trove in Production��������������������������������������������������������� 185
■
■Appendix A: Trove Configuration Options���������������������������������������������������������� 199
■
■Appendix B: The Trove Command-Line Interface����������������������������������������������� 221
■
■Appendix C: The Trove API��������������������������������������������������������������������������������� 245
Index��������������������������������������������������������������������������������������������������������������������� 307
v
Contents
■
■Chapter 1: An Introduction to Database as a Service�������������������������������������������� 1
What Is Database as a Service?��������������������������������������������������������������������������������������� 1
The Database������������������������������������������������������������������������������������������������������������������������������������������ 1
The Service��������������������������������������������������������������������������������������������������������������������������������������������� 2
The Service as a Category���������������������������������������������������������������������������������������������������������������������� 2
DBaaS Defined���������������������������������������������������������������������������������������������������������������������������������������� 2
vii
■ Contents
OpenStack Trove������������������������������������������������������������������������������������������������������������� 11
A Brief History of Trove��������������������������������������������������������������������������������������������������� 12
Tenancy in OpenStack Trove������������������������������������������������������������������������������������������� 12
Trove in the OpenStack Ecosystem�������������������������������������������������������������������������������� 12
Summary������������������������������������������������������������������������������������������������������������������������ 15
■
■Chapter 2: Downloading and Installing OpenStack Trove������������������������������������ 17
Deploying a Single-Node Development Environment����������������������������������������������������� 17
Set Up the Ubuntu Environment����������������������������������������������������������������������������������������������������������� 17
Install Some Basic Packages���������������������������������������������������������������������������������������������������������������� 19
Verify Your Setup���������������������������������������������������������������������������������������������������������������������������������� 19
Enable Password-less sudo for the “ubuntu” User������������������������������������������������������������������������������ 21
Install OpenStack Using the devstack Tool������������������������������������������������������������������������������������������� 22
Enable the Default Trove Public Key����������������������������������������������������������������������������������������������������� 26
Authenticate with the System�������������������������������������������������������������������������������������������������������������� 27
Launch Your First Trove Database��������������������������������������������������������������������������������������������������������� 28
Using Neutron with devstack���������������������������������������������������������������������������������������������������������������� 31
Accessing the Dashboard��������������������������������������������������������������������������������������������������������������������� 33
Deploying Trove in a Multinode OpenStack Environment����������������������������������������������� 37
Prerequisites���������������������������������������������������������������������������������������������������������������������������������������� 37
Install the Required Packages�������������������������������������������������������������������������������������������������������������� 37
Create the Trove User��������������������������������������������������������������������������������������������������������������������������� 38
viii
■ Contents
Summary������������������������������������������������������������������������������������������������������������������������ 46
■
■Chapter 3: Basic Trove Operations���������������������������������������������������������������������� 47
Interacting with RESTful Services using curl����������������������������������������������������������������� 47
Obtain a Token from Keystone�������������������������������������������������������������������������������������������������������������� 48
Use the Token to Interact with the RESTful Service����������������������������������������������������������������������������� 49
Summary������������������������������������������������������������������������������������������������������������������������ 72
ix
■ Contents
■
■Chapter 4: Concepts and Architecture����������������������������������������������������������������� 73
High-Level Trove Architecture���������������������������������������������������������������������������������������� 73
Trove Concepts��������������������������������������������������������������������������������������������������������������� 76
The Trove Services�������������������������������������������������������������������������������������������������������������������������������� 77
The Trove Guest Agent API�������������������������������������������������������������������������������������������������������������������� 79
Trove Strategies������������������������������������������������������������������������������������������������������������������������������������ 79
Trove Extensions����������������������������������������������������������������������������������������������������������������������������������� 82
Classification Model for Guest Agents and Strategies�������������������������������������������������������������������������� 83
The Trove Guest Image������������������������������������������������������������������������������������������������������������������������� 85
The Trove Message Queue and the Trove Internal API�������������������������������������������������������������������������� 86
The Trove Infrastructure Database������������������������������������������������������������������������������������������������������� 89
The Trove Public API����������������������������������������������������������������������������������������������������������������������������� 90
x
■ Contents
■
■Chapter 6: Debugging and Troubleshooting������������������������������������������������������ 149
Accessing the Trove Guest Instance Command Line���������������������������������������������������� 149
Guest Images from OpenStack����������������������������������������������������������������������������������������������������������� 150
Guest Images from Tesora������������������������������������������������������������������������������������������������������������������ 151
Summary���������������������������������������������������������������������������������������������������������������������� 164
■
■Chapter 7: Building Guest Images for Trove������������������������������������������������������ 165
Using Prebuilt Trove Guest Images������������������������������������������������������������������������������� 165
Components of a Trove Guest Image�������������������������������������������������������������������������������������������������� 165
Registering a Trove Guest Image�������������������������������������������������������������������������������������������������������� 166
xi
■ Contents
Summary���������������������������������������������������������������������������������������������������������������������� 197
■
■Appendix A: Trove Configuration Options���������������������������������������������������������� 199
Trove Configuration Files���������������������������������������������������������������������������������������������� 199
Trove Configuration Options����������������������������������������������������������������������������������������� 201
Datastore-Specific Configuration Options�������������������������������������������������������������������� 211
Summary���������������������������������������������������������������������������������������������������������������������� 220
■
■Appendix B: The Trove Command-Line Interface����������������������������������������������� 221
The Command-Line Interface��������������������������������������������������������������������������������������� 221
The trove Command��������������������������������������������������������������������������������������������������������������������������� 221
The trove-manage Command������������������������������������������������������������������������������������������������������������� 240
Summary���������������������������������������������������������������������������������������������������������������������� 243
xii
■ Contents
■
■Appendix C: The Trove API��������������������������������������������������������������������������������� 245
The Trove API Service End Point����������������������������������������������������������������������������������� 245
API Conventions����������������������������������������������������������������������������������������������������������� 246
List API Versions����������������������������������������������������������������������������������������������������������� 248
Instance APIs���������������������������������������������������������������������������������������������������������������� 248
List Instances������������������������������������������������������������������������������������������������������������������������������������� 249
Create Instance����������������������������������������������������������������������������������������������������������������������������������� 249
Show Instance������������������������������������������������������������������������������������������������������������������������������������ 253
Instance Actions��������������������������������������������������������������������������������������������������������������������������������� 254
Patch Instance������������������������������������������������������������������������������������������������������������������������������������ 257
Update Instance���������������������������������������������������������������������������������������������������������������������������������� 263
Delete Instance����������������������������������������������������������������������������������������������������������������������������������� 266
List Backups��������������������������������������������������������������������������������������������������������������������������������������� 267
List Instance Configuration����������������������������������������������������������������������������������������������������������������� 269
xiii
■ Contents
Index��������������������������������������������������������������������������������������������������������������������� 307
xiv
About the Authors
xv
About the Technical Reviewer
xvii
Acknowledgments
We would like to thank the entire OpenStack Trove community for their commitment and dedication to
the Trove vision, and making the OpenStack Database as a Service a reality. Without the many developers,
reviewers, and operators contributing to the project over several years, we wouldn’t have had such a rich
topic to write about.
A very special thanks to the entire team at Tesora who have supported this book through reviews,
answering technical questions and providing ideas for content.
Our thanks to the team at Apress, Mark Powers, Louise Corrigan, Christine Ricketts, and Lori Jacobs;
you were great.
We would like to specifically thank Laurel Michaels, who has done so much for improving the
documentation of Trove for the community, for painstakingly reviewing each chapter after initial draft, and
providing valuable suggestions for improvement.
—Amrith & Doug
xix