Este conteúdo não está disponível no idioma selecionado.
Chapter 2. Using Database-as-a-Service
2.1. Automate the Creation and Configuration of Database-as-a-Service Guest Images Copiar o linkLink copiado para a área de transferência!
Red Hat recommends using the trove-image-create tool for generating automated DBaaS-compatible images for supported datastores.
To get the trove-image-create tool, install the openstack-trove-images package:
yum install openstack-trove-images
# yum install openstack-trove-images
The following basic options are available:
| Option | Description, parameters |
|---|---|
|
| The base image that you are going to use. QEMU images (qcow2) are supported. Specify the image file name (and, optionally, its path) as a pamaterer. |
|
|
The OpenStack version you want to use. Specify either |
|
| The datastore you want to deploy. Supported datastores are listed in the Preface, and potential parameters are:
|
Example 2.1. Customize an Image
For example, you can use the tool this way:
trove-image-create -s mysql -r liberty -i myimage.qcow2
# trove-image-create -s mysql -r liberty -i myimage.qcow2
This will customize the image stored in the myimage.qcow2 file in the current working directory by adding MariaDB 5.5 and trove from Red Hat OpenStack Platform 8 (Liberty) to it.
There are additional options that must be used if you are working with a RHEL 7 image:
| Option | Recognized parameters and their syntax | Description |
|---|---|---|
|
|
USER | Register with Subscription Manager using your Red Hat credentials. |
|
|
| Attach a specified or automatically determined subscription pool to the system. |
Example 2.2. Customize a RHEL 7 Image
For example:
trove-image-create -s mysql -r liberty -i ../../images/rhel-mariadb55.qcow2 --sm-register admin@example.com:password:123456 --sm-pool auto
# trove-image-create -s mysql -r liberty -i ../../images/rhel-mariadb55.qcow2 --sm-register admin@example.com:password:123456 --sm-pool auto
This will customize the image in a manner similar to the previous example but also register the system using Red Hat login name admin@example.com, password 123456, and the best-matching subscription.
2.1.1. Loading the Image to Database-as-a-Service Management Copiar o linkLink copiado para a área de transferência!
When the customization of the image is complete, perform the following steps:
Upload the image to the Image service. To do so, run a command similar to this one:
openstack image create rhel7-mariadb55 --disk-format qcow2 --container-format bare --public < myimage.qcow2
# openstack image create rhel7-mariadb55 --disk-format qcow2 --container-format bare --public < myimage.qcow2Copy to Clipboard Copied! Toggle word wrap Toggle overflow Get the ID of the uploaded image from the output of the previous command, which should look like the following:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The ID would be c637391b-e00f-47fb-adb5-e8dfc4e224d4 in this case.
Update the DBaaS management datastore to have the record of the new image that will be used to launch instances for the datastore and version you want:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantThe value of the
PACKAGESvariable depends on the datastore you are using. For MySQL (any version), usemysql-community-server. For MariaDB 10.0, useMariaDB-server.
2.1.2. Troubleshooting Copiar o linkLink copiado para a área de transferência!
In the event of an instance failing on launch, an image with an SSH key can be created and used for troubleshooting. The trove-image-create tool has the --root-ssh-key option for this purpose. This option takes the path to a public key as a parameter, and injects the key into the image. For example:
trove-image-create -i myimage.qcow2 -r liberty -s mysql --root-ssh-key ~/.ssh/id_rsa.pub
# trove-image-create -i myimage.qcow2 -r liberty -s mysql --root-ssh-key ~/.ssh/id_rsa.pub
In order to be able to access an instance based on this image, follow these steps:
- Edit the security group associated with the instance.
- Open the SSH port.
- Consider allowing ICMP as well.
- If the instance is in a private network, you will need to add a floating IP to the instance.
After completing these steps, you should be able to run the following command to log in to the instance:
ssh root@INSTANCE_IP
# ssh root@INSTANCE_IP