Browse Source

[doc] Create instance in user guide

Add parameters to create public trove instance.

Change-Id: Ib69d7a3c0389f6419eff81879a17d150c8f056e9
Story: 2006500
Task: 36472
changes/37/681437/1
Lingxian Kong 1 week ago
parent
commit
b43248be79
2 changed files with 58 additions and 109 deletions
  1. 3
    45
      doc/source/install/install-devstack.rst
  2. 55
    64
      doc/source/user/create-db.rst

+ 3
- 45
doc/source/install/install-devstack.rst View File

@@ -139,48 +139,6 @@ Trove instance:
139 139
 Create your first Trove instance
140 140
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
141 141
 
142
-#.  Switch to a non-admin user, choose a Nova flavor ID for the Trove
143
-    instance.
144
-
145
-    .. code-block:: console
146
-
147
-        $ source ~/devstack/openrc demo demo
148
-        $ openstack flavor list
149
-        +----+---------------+-------+------+-----------+-------+-----------+
150
-        | ID | Name          |   RAM | Disk | Ephemeral | VCPUs | Is Public |
151
-        +----+---------------+-------+------+-----------+-------+-----------+
152
-        | 1  | m1.tiny       |   512 |    1 |         0 |     1 | True      |
153
-        | 2  | m1.small      |  2048 |   20 |         0 |     1 | True      |
154
-        | 3  | m1.medium     |  4096 |   40 |         0 |     2 | True      |
155
-        | 4  | m1.large      |  8192 |   80 |         0 |     4 | True      |
156
-        | 5  | m1.xlarge     | 16384 |  160 |         0 |     8 | True      |
157
-        | 6  | mysql-minimum |   512 |    5 |         0 |     1 | True      |
158
-        | c1 | cirros256     |   256 |    1 |         0 |     1 | True      |
159
-        | d1 | ds512M        |   512 |    5 |         0 |     1 | True      |
160
-        | d2 | ds1G          |  1024 |   10 |         0 |     1 | True      |
161
-        | d3 | ds2G          |  2048 |   10 |         0 |     2 | True      |
162
-        | d4 | ds4G          |  4096 |   20 |         0 |     4 | True      |
163
-        +----+---------------+-------+------+-----------+-------+-----------+
164
-        $ flavorid=6
165
-
166
-#.  Choose a private network on which the database service can be accessed.
167
-
168
-    .. code-block:: console
169
-
170
-        $ openstack network list --internal
171
-        +--------------------------------------+---------+----------------------------------------------------------------------------+
172
-        | ID                                   | Name    | Subnets                                                                    |
173
-        +--------------------------------------+---------+----------------------------------------------------------------------------+
174
-        | a0f3cf12-3562-4064-aa34-61d37265e867 | private | 377e791f-2631-4d8e-93cd-036344b24b3f, 7e04abb4-7c16-4b92-8865-7831ecf3ee66 |
175
-        +--------------------------------------+---------+----------------------------------------------------------------------------+
176
-        # netid=a0f3cf12-3562-4064-aa34-61d37265e867
177
-
178
-#.  Create the Trove instance.
179
-
180
-    .. code-block:: console
181
-
182
-        $ openstack database instance create my-first-trove-instance $flavorid \
183
-          --size 1 \
184
-          --nic net-id=$netid \
185
-          --datastore mysql --datastore_version 5.7 \
186
-          --databases test --users test_user:password
142
+Refer to
143
+`Create and access a database <https://docs.openstack.org/trove/latest/user/create-db.html>`_
144
+for the detailed steps.

+ 55
- 64
doc/source/user/create-db.rst View File

@@ -7,7 +7,7 @@ Assume that you have installed the Database service and populated your
7 7
 data store with images for the type and versions of databases that you
8 8
 want, and that you can create and access a database.
9 9
 
10
-This example shows you how to create and access a MySQL 5.5 database.
10
+This example shows you how to create and access a MySQL 5.7 database.
11 11
 
12 12
 Create and access a database
13 13
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -87,90 +87,81 @@ Create and access a database
87 87
 #. **Create a database instance**
88 88
 
89 89
    This example creates a database instance with the following
90
-   characteristics:
90
+   parameters:
91 91
 
92 92
    -  Name of the instance: ``mysql_instance_1``
93
-
94 93
    -  Database flavor: ``6``
95
-
96
-   In addition, this command specifies these options for the instance:
97
-
98
-   -  A volume size of ``5`` (5 GB).
99
-
100
-   -  The ``myDB`` database.
101
-
94
+   -  A volume size of ``5`` (5 GB)
95
+   -  A database named ``test``
102 96
    -  The database is based on the ``mysql`` data store and the
103
-      ``mysql-5.5`` datastore\_version.
104
-
97
+      ``5.7`` datastore version
105 98
    -  The ``userA`` user with the ``password`` password.
99
+   -  A Neutron network ``8799cf10-01ef-40e2-b04e-06da7cfa5668`` to allocate
100
+      the database IP address (for internal access).
101
+   -  Expose the instance to the public via ``--is-public`` (for external
102
+      access). Ignore this parameter if you don't want to expose database
103
+      service to the public internet.
104
+   -  Only the IP addresses coming from ``202.37.199.1/24`` or ``10.1.0.1/24``
105
+      are allowed to access the database service.
106 106
 
107 107
    .. code-block:: console
108 108
 
109
-      $ openstack database instance create mysql_instance_1 6 --size 5 --databases myDB \
110
-          --users userA:password --datastore_version mysql-5.5 \
111
-          --datastore mysql
112
-      +-------------------+---------------------------------------------------------------------------------------t-----------------------------------------------------------------------------------------------------------------+
113
-      |      Property     |                                                                                                  Value                                                                                                  |
114
-      +-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
115
-      |      created      |                                                                                           2014-05-29T21:26:21                                                                                           |
116
-      |     datastore     |                                                                              {u'version': u'mysql-5.5', u'type': u'mysql'}                                                                              |
117
-      | datastore_version |                                                                                                mysql-5.5                                                                                                |
118
-      |       flavor      | {u'id': u'6', u'links': [{u'href': u'https://controller:8779/v1.0/46d0bc4fc32e4b9e8520f8fc62199f58/flavors/6', u'rel': u'self'}, {u'href': u'https://controller:8779/flavors/6', u'rel': u'bookmark'}]} |
119
-      |         id        |                                                                                   5599dad6-731e-44df-bb60-488da3da9cfe                                                                                  |
120
-      |        name       |                                                                                             mysql_instance_1                                                                                            |
121
-      |       status      |                                                                                                  BUILD                                                                                                  |
122
-      |      updated      |                                                                                           2014-05-29T21:26:21                                                                                           |
123
-      |       volume      |                                                                                               {u'size': 5}                                                                                              |
124
-      +-------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
109
+      $ openstack database instance create mysql_instance_1 \
110
+          6 \
111
+          --size 5 \
112
+          --nic net-id=8799cf10-01ef-40e2-b04e-06da7cfa5668 \
113
+          --databases test --users userA:password \
114
+          --datastore mysql --datastore_version 5.7 \
115
+          --is-public \
116
+          --allowed-cidr 10.1.0.1/24 \
117
+          --allowed-cidr 202.37.199.1/24
118
+      +-------------------+--------------------------------------+
119
+      | Field             | Value                                |
120
+      +-------------------+--------------------------------------+
121
+      | created           | 2019-09-11T09:19:18                  |
122
+      | datastore         | mysql                                |
123
+      | datastore_version | 5.7                                  |
124
+      | flavor            | 6                                    |
125
+      | id                | 4bca2f27-f986-419e-ab4a-df1db399d590 |
126
+      | name              | mysql_instance_1                     |
127
+      | region            | RegionOne                            |
128
+      | status            | BUILD                                |
129
+      | updated           | 2019-09-11T09:19:18                  |
130
+      | volume            | 5                                    |
131
+      +-------------------+--------------------------------------+
125 132
 
126 133
 #. **Get the IP address of the database instance**
127 134
 
128
-   First, use the :command:`openstack database instance list` command to list all instances and
129
-   their IDs:
135
+   Both internal and external IP addresses can be shown by running:
130 136
 
131 137
    .. code-block:: console
132 138
 
133
-      $ openstack database instance list
134
-      +--------------------------------------+------------------+-----------+-------------------+--------+-----------+------+
135
-      |                  id                  |       name       | datastore | datastore_version | status | flavor_id | size |
136
-      +--------------------------------------+------------------+-----------+-------------------+--------+-----------+------+
137
-      | 5599dad6-731e-44df-bb60-488da3da9cfe | mysql_instance_1 |   mysql   |     mysql-5.5     | BUILD  |     6     |  5   |
138
-      +--------------------------------------+------------------+-----------+-------------------+--------+-----------+------+
139
-
140
-   This command returns the instance ID of your new instance.
141
-
142
-   You can now pass in the instance ID with the :command:`openstack database instance show` command
143
-   to get the IP address of the instance. In this example, replace
144
-   ``INSTANCE_ID`` with ``5599dad6-731e-44df-bb60-488da3da9cfe``.
145
-
146
-   .. code-block:: console
147
-
148
-      $ openstack database instance show INSTANCE_ID
149
-
139
+      $ openstack database instance show 4bca2f27-f986-419e-ab4a-df1db399d590
150 140
       +-------------------+--------------------------------------+
151
-      |      Property     |                Value                 |
141
+      | Field             | Value                                |
152 142
       +-------------------+--------------------------------------+
153
-      |      created      |         2014-05-29T21:26:21          |
154
-      |     datastore     |                mysql                 |
155
-      | datastore_version |              mysql-5.5               |
156
-      |       flavor      |                  6                   |
157
-      |         id        | 5599dad6-731e-44df-bb60-488da3da9cfe |
158
-      |         ip        |             172.16.200.2             |
159
-      |        name       |           mysql_instance_1           |
160
-      |       status      |                BUILD                 |
161
-      |      updated      |         2014-05-29T21:26:54          |
162
-      |       volume      |                  5                   |
143
+      | created           | 2019-09-11T07:14:37                  |
144
+      | datastore         | mysql                                |
145
+      | datastore_version | 5.7                                  |
146
+      | flavor            | 6                                    |
147
+      | id                | 4bca2f27-f986-419e-ab4a-df1db399d590 |
148
+      | ip                | 10.1.0.14, 172.24.5.15               |
149
+      | name              | mysql_instance_1                     |
150
+      | region            | RegionOne                            |
151
+      | status            | ACTIVE                               |
152
+      | updated           | 2019-09-11T07:14:47                  |
153
+      | volume            | 5                                    |
154
+      | volume_used       | 0.12                                 |
163 155
       +-------------------+--------------------------------------+
164 156
 
165
-   This command returns the IP address of the database instance.
166
-
167 157
 #. **Access the new database**
168 158
 
169
-   You can now access the new database you just created (myDB) by using
159
+   You can now access the new database you just created by using
170 160
    typical database access commands. In this MySQL example, replace
171
-   ``IP_ADDRESS`` with ``172.16.200.2``.
161
+   ``IP_ADDRESS`` with either 10.1.0.14 or 172.24.5.15 according to where the
162
+   command is running. Make sure your IP address is in the allowed CIDRs
163
+   specified in the above command.
172 164
 
173 165
    .. code-block:: console
174 166
 
175
-      $ mysql -u userA -p password -h IP_ADDRESS myDB
176
-
167
+      $ mysql -h IP_ADDRESS -uuserA -ppassword

Loading…
Cancel
Save