Help:Adding a Database to a Cloud VPS Project

From Wikitech
Jump to navigation Jump to search

Overview

This page explains how to add a database server to a Cloud VPS project.

Trove: Database as a Service for Cloud VPS

Cloud VPS provides database management via the OpenStack Trove project. A Trove database is fully managed by OpenStack and consists of a database instance and a Cinder volume.

Database engines and storage are separate components from standard server instances or cinder volumes and can be found under the 'Database' menu in Horizon. This menu supports creating, resizing, and destroying database servers; it also supports minimal database configuration within a given instance: creation and destruction of databases and some limited management.

Horizon Trove Screenshot.png

Managing Trove Databases

A database instance can contain one or more actual databases. Once an instance is created with Trove you have a few options for user and database management. Individual databases and users can be created using the Databases and Users tabs, respectively.

If you prefer a command line interface for database management (or need more fine-grained control than that offered by Horizon) you can enable a root user on the Instances page and use the resulting credentials to access a root database login.

Trove root access.png
Enable trove root.png


Accessing Trove Databases From Your VM

The trove instance Overview tab includes shortcuts for database access: a shell command example and an example URI.

Trove db access.png

The commandline can by copy-and-pasted into your shell and used to get a mysql, psql, or equivalent prompt. You will need to substitute in the proper username and have a password at the ready. For a root shell, enable and set a password using 'Manage Root Access' menu as documented above.

Snapshots, Backups, Replicas

Generic Trove documentation describes several backup and snapshot features which are not currently available from WMCS cloud services. Support for these services requires a Swift storage backend; we have near-term plans to add Swift support along with database backups but as of July 2021 this is not yet available.

Until WMCS provides better services in this space, users are encouraged to run periodic database dumps using mysqldump and storing the backups on a separate Cinder volume.

Usage Quotas in Trove

A Trove database instance uses Cinder volume and a Nova instance. Nevertheless, a database instance is not counted against a project's storage or virtualization quotas. Rather, Trove has separate quotas to govern database use; the instances and volumes themselves are stored in a separate project and cannot be accessed directly by users.

By default any Cloud VPS project should be able to create one or two small Trove instances. When you're ready for more cores or gigabytes, open a quota request in Phabricator. You should not need to rebuild your database instances; with adequate quotas your instance and storage can be resized as needed without a rebuild.

Orchestration is Hard

A properly-functioning Trove database instance is quite complicated and relies on very many different OpenStack features working in concert: storage, compute, DNS, networking, and docker. This means that if OpenStack APIs are the least bit fragile, database instance creation may fail with cryptic error messages. Similarly, existing, running database instances may appear as 'down' Horizon if any of OpenStack's communication channels are unreliable.

The good news is that Trove and Openstack have very little interaction with a database once it's up and running. That means that fragility in the orchestration layer does not necessarily mean that your data or database is itself fragile. Do please reach out to the WMCS team if you encounter poor Trove behavior, but also please do not panic.

Communication and support

We communicate and provide support through several primary channels. Please reach out with questions and to join the conversation.

Communicate with us
Connect Best for
Phabricator Workboard #Cloud-Services Task tracking and bug reporting
IRC Channel #wikimedia-cloud connect
Telegram bridge
mattermost bridge
General discussion and support
Mailing List cloud@ Information about ongoing initiatives, general discussion and support
Announcement emails cloud-announce@ Information about critical changes (all messages mirrored to cloud@)
News wiki page News Information about major near-term plans
Cloud Services Blog Clouds & Unicorns Learning more details about some of our work
Wikimedia Technical Blog techblog.wikimedia.org News and stories from the Wikimedia technical movement