summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2020-09-11 13:18:02 +1200
committerLingxian Kong <anlin.kong@gmail.com>2020-09-13 19:13:53 +1200
commit72e20e4e97c54d59e6330180b65635928c9b274e (patch)
tree3b2b04cc6618dde8c6727815361703dd00bcbdd3 /doc
parentdf4f74769ee731c57cf8dcef01dec8946baa58c6 (diff)
downloadtrove-72e20e4e97c54d59e6330180b65635928c9b274e.tar.gz
Only enable user and database API for MySQL
Change-Id: Ic59f2fd94c5f216414effe7d13d0dd486dce9243
Diffstat (limited to 'doc')
-rw-r--r--doc/source/user/create-db.rst12
-rw-r--r--doc/source/user/manage-db-and-users.rst103
2 files changed, 57 insertions, 58 deletions
diff --git a/doc/source/user/create-db.rst b/doc/source/user/create-db.rst
index b8446b84..6118ba39 100644
--- a/doc/source/user/create-db.rst
+++ b/doc/source/user/create-db.rst
@@ -1,16 +1,16 @@
.. _create_db:
-============================
-Create and access a database
-============================
+=====================================
+Create and access a database instance
+=====================================
Assume that you have installed the Database service and populated your
data store with images for the type and versions of databases that you
-want, and that you can create and access a database.
+want, and that you can create and access a database instance.
This example shows you how to create and access a MySQL 5.7 database.
-Create and access a database
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Create and access a database instance
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#. **Determine which flavor to use for your database**
diff --git a/doc/source/user/manage-db-and-users.rst b/doc/source/user/manage-db-and-users.rst
index 38a80442..ad25b1d8 100644
--- a/doc/source/user/manage-db-and-users.rst
+++ b/doc/source/user/manage-db-and-users.rst
@@ -2,60 +2,70 @@
Manage databases and users on Trove instances
=============================================
-Assume that you installed Trove service and uploaded images with datastore
-of your choice.
-This section shows how to manage users and databases in a MySQL 5.7 instance.
+Assume that you installed Trove service and uploaded images with datastore of
+your choice. This section shows how to manage users and databases in a MySQL
+5.7 instance.
-Add new database and user to an existing Trove instance
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.. warning::
-Trove provides API to manage users and databases on
-datastores including relational (e.g. MySQL, PostgreSQL) and non-relational
-(e.g. Redis, Cassandra). Once a Trove instance with a datastore of choice is
-active you can use Trove API to create new databases and/or users.
+ Currently, the Database and User API is only supported by mysql datastore.
+ For others, the recommended way is to get root password (``POST
+ /v1.0/{project_id}/instances/{instance_id}/root``) and communicate with the
+ database service directly for database and user management.
+
+Manage root user
+~~~~~~~~~~~~~~~~
+
+For all the datastores, the user could enable root and get root password for
+further database operations.
.. code-block:: console
- $ openstack database user list db-instance
+ $ openstack database root enable f22ce0d9-8c9c-403a-8599-2269761a66de
+ +----------+--------------------------------------+
+ | Field | Value |
+ +----------+--------------------------------------+
+ | name | root |
+ | password | I5nPpBj1qf1eGR1idQorj1szppXGpYyYNj4h |
+ +----------+--------------------------------------+
+
+If needed, ``openstack database root disable <instance_id>`` command could
+disable the root user.
+
+Database and User management via Trove API
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Trove provides API to manage users and databases for mysql datastore.
+
+.. code-block:: console
+ $ openstack database user list db-instance
+------+------+-----------+
| Name | Host | Databases |
+------+------+-----------+
| test | % | testdb |
+------+------+-----------+
-
- $ openstack database user create db-instance newuser userpass --databases testdb
-
- $ openstack database user list db-instance
-
+ $ openstack database user create db-instance newuser userpass --databases testdb
+ $ openstack database user list db-instance
+---------+------+-----------+
| Name | Host | Databases |
+---------+------+-----------+
| newuser | % | testdb |
| test | % | testdb |
+---------+------+-----------+
-
-
- $ mysql -h 172.24.4.199 -u newuser -p testdb
+ $ mysql -h 172.24.4.199 -u newuser -p testdb
Enter password:
-
mysql> show databases;
-
+--------------------+
| Database |
+--------------------+
| information_schema |
| testdb |
+--------------------+
-
2 rows in set (0.00 sec)
-
- $ openstack database db create db-instance newdb
-
-
- $ openstack database db list db-instance
-
+ $ openstack database db create db-instance newdb
+ $ openstack database db list db-instance
+--------+
| Name |
+--------+
@@ -64,8 +74,7 @@ active you can use Trove API to create new databases and/or users.
| testdb |
+--------+
- $ mysql -h 172.24.4.199 -u newuser -p newdb
-
+ $ mysql -h 172.24.4.199 -u newuser -p newdb
Enter password:
ERROR 1044 (42000): Access denied for user 'newuser'@'%' to database 'newdb'
@@ -73,15 +82,14 @@ active you can use Trove API to create new databases and/or users.
Manage access to databases
~~~~~~~~~~~~~~~~~~~~~~~~~~
-With Trove API you can grant and revoke database access rights for existing users.
+With Trove API you can grant and revoke database access rights for existing
+users.
.. code-block:: console
- $ openstack database user grant access db-instance newuser newdb
-
-
- $ openstack database user show access db-instance newuser
+ $ openstack database user grant access db-instance newuser newdb
+ $ openstack database user show access db-instance newuser
+--------+
| Name |
+--------+
@@ -89,30 +97,24 @@ With Trove API you can grant and revoke database access rights for existing user
| testdb |
+--------+
- $ mysql -h IP_ADDRESS -u newuser -p newdb
+ $ mysql -h IP_ADDRESS -u newuser -p newdb
Enter password:
-
- $ openstack database user show access db-instance test
-
+ $ openstack database user show access db-instance test
+--------+
| Name |
+--------+
| testdb |
+--------+
- $ mysql -h IP_ADDRESS -u test -p newdb
+ $ mysql -h IP_ADDRESS -u test -p newdb
Enter password:
-
ERROR 1044 (42000): Access denied for user 'test'@'%' to database 'newdb'
+ $ openstack database user revoke access db-instance newuser newdb
- $ openstack database user revoke access db-instance newuser newdb
-
-
- $ mysql -h IP_ADDRESS -u newuser -p newdb
+ $ mysql -h IP_ADDRESS -u newuser -p newdb
Enter password:
-
ERROR 1044 (42000): Access denied for user 'newuser'@'%' to database 'newdb'
@@ -123,8 +125,7 @@ Lastly, Trove provides API for deleting databases.
.. code-block:: console
- $ openstack database db list db-instance
-
+ $ openstack database db list db-instance
+--------+
| Name |
+--------+
@@ -133,10 +134,9 @@ Lastly, Trove provides API for deleting databases.
| testdb |
+--------+
- $ openstack database db delete db-instance testdb
-
- $ openstack database db list db-instance
+ $ openstack database db delete db-instance testdb
+ $ openstack database db list db-instance
+--------+
| Name |
+--------+
@@ -144,7 +144,6 @@ Lastly, Trove provides API for deleting databases.
| sys |
+--------+
- $ mysql -h IP_ADDRESS -u test -p testdb
+ $ mysql -h IP_ADDRESS -u test -p testdb
Enter password:
-
ERROR 1049 (42000): Unknown database 'testdb' \ No newline at end of file