Add doc: how to provision RDS instance with multiple databases (#529)
* Add doc: how to provision RDS instance with multiple databases Added one how-to doc on provisioning an RDS instance with more than one databases Signed-off-by: Zheng Xi Zhou <zzxwill@gmail.com> * fix build issues Signed-off-by: Zheng Xi Zhou <zzxwill@gmail.com>
This commit is contained in:
parent
c841c7f900
commit
4f1892cef9
|
@ -0,0 +1,59 @@
|
||||||
|
---
|
||||||
|
title: Provision an RDS instance with more than one database
|
||||||
|
---
|
||||||
|
|
||||||
|
In the guide [Provision and Binding Cloud Resources](./provision-and-consume-cloud-services) and [Provision a Database and Import a SQL File for initialization](./provision-and-initiate-database),
|
||||||
|
only one database will be created in an RDS instance. This tutorial will show you how to create more than one database in an RDS instance.
|
||||||
|
|
||||||
|
In the [reference doc for Alibaba Cloud RDS](./terraform/alibaba-rds), set `database_name` if you want to create one database.
|
||||||
|
If you want to create more than one database, set `databases` to array of databases. Each database is a map, the map
|
||||||
|
contains the following attributes: name, character_set, description.
|
||||||
|
|
||||||
|
```
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name" : "test",
|
||||||
|
"character_set" : "utf8",
|
||||||
|
"description" : "test database"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "test2",
|
||||||
|
"character_set" : "utf8",
|
||||||
|
"description" : "test database"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
| Name | Description | Type | Required | Default |
|
||||||
|
|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|----------|---------|
|
||||||
|
| database_name | Database name | string | false | |
|
||||||
|
| databases | The database list, each database is a map, the map contains the following attributes: name, character_set, description, like `[{"name":"test","character_set":"utf8","description":"test database"},]`. It conflicts with `database_name`. | list(map(string)) | false | |
|
||||||
|
|
||||||
|
Applying the following application can create more than one database in an RDS instance.
|
||||||
|
|
||||||
|
> ⚠️ This section requires your platform engineers have already enabled [cloud resources addon](../../../reference/addons/terraform).
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: core.oam.dev/v1beta1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: alibaba-rds-multiple-databases
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
- name: db
|
||||||
|
type: alibaba-rds
|
||||||
|
properties:
|
||||||
|
instance_name: dblinks
|
||||||
|
account_name: oamtest
|
||||||
|
password: U34rfwefwefffaked
|
||||||
|
databases:
|
||||||
|
- name: dev
|
||||||
|
character_set: utf8
|
||||||
|
description: "dev database"
|
||||||
|
- name: prod
|
||||||
|
character_set: utf8
|
||||||
|
description: "prod database"
|
||||||
|
writeConnectionSecretToRef:
|
||||||
|
name: db-conn
|
||||||
|
|
||||||
|
```
|
|
@ -0,0 +1,59 @@
|
||||||
|
---
|
||||||
|
title: RDS 实例创建多数据库
|
||||||
|
---
|
||||||
|
|
||||||
|
指南 [创建和使用云资源](./provision-and-consume-cloud-services)和[数据库创建和初始化](./provision-and-initiate-database)里,在一个
|
||||||
|
RDS 实例中,只创建了一个数据库。本教程将告诉你如何在一个 RDS 实例中创建多个数据库。
|
||||||
|
|
||||||
|
在[阿里云 RDS 参考文档](./terraform/alibaba-rds)中,如果你想创建一个数据库,请设置`database_name`。 如果你想创建多个数据库,
|
||||||
|
设置 `databases`,它是一个数据库列表,每个数据库都是一个 map,包含属性:name、character_set、description。
|
||||||
|
|
||||||
|
```
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name" : "test",
|
||||||
|
"character_set" : "utf8",
|
||||||
|
"description" : "test database"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "test2",
|
||||||
|
"character_set" : "utf8",
|
||||||
|
"description" : "test database"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
| 名称 | 描述 | 类型 | 是否必须 | 默认值 |
|
||||||
|
|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------|-----|
|
||||||
|
| database_name | Database name | string | false | |
|
||||||
|
| databases | The database list, each database is a map, the map contains the following attributes: name, character_set, description, like `[{"name":"test","character_set":"utf8","description":"test database"},]`. It conflicts with `database_name`. | list(map(string)) | false | |
|
||||||
|
|
||||||
|
执行以下 Yaml 文件可以在 RDS 实例中创建多个数据库。
|
||||||
|
|
||||||
|
> ⚠️ 请确认管理员已经安装了 [云资源插件](../../../reference/addons/terraform)。
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: core.oam.dev/v1beta1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: alibaba-rds-multiple-databases
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
- name: db
|
||||||
|
type: alibaba-rds
|
||||||
|
properties:
|
||||||
|
instance_name: dblinks
|
||||||
|
account_name: oamtest
|
||||||
|
password: U34rfwefwefffaked
|
||||||
|
databases:
|
||||||
|
- name: dev
|
||||||
|
character_set: utf8
|
||||||
|
description: "dev database"
|
||||||
|
- name: prod
|
||||||
|
character_set: utf8
|
||||||
|
description: "prod database"
|
||||||
|
writeConnectionSecretToRef:
|
||||||
|
name: db-conn
|
||||||
|
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
---
|
||||||
|
title: RDS 实例创建多数据库
|
||||||
|
---
|
||||||
|
|
||||||
|
指南 [创建和使用云资源](./provision-and-consume-cloud-services)和[数据库创建和初始化](./provision-and-initiate-database)里,在一个
|
||||||
|
RDS 实例中,只创建了一个数据库。本教程将告诉你如何在一个 RDS 实例中创建多个数据库。
|
||||||
|
|
||||||
|
在[阿里云 RDS 参考文档](./terraform/alibaba-rds)中,如果你想创建一个数据库,请设置`database_name`。 如果你想创建多个数据库,
|
||||||
|
设置 `databases`,它是一个数据库列表,每个数据库都是一个 map,包含属性:name、character_set、description。
|
||||||
|
|
||||||
|
```
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name" : "test",
|
||||||
|
"character_set" : "utf8",
|
||||||
|
"description" : "test database"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "test2",
|
||||||
|
"character_set" : "utf8",
|
||||||
|
"description" : "test database"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
| 名称 | 描述 | 类型 | 是否必须 | 默认值 |
|
||||||
|
|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|-------|-----|
|
||||||
|
| database_name | Database name | string | false | |
|
||||||
|
| databases | The database list, each database is a map, the map contains the following attributes: name, character_set, description, like `[{"name":"test","character_set":"utf8","description":"test database"},]`. It conflicts with `database_name`. | list(map(string)) | false | |
|
||||||
|
|
||||||
|
执行以下 Yaml 文件可以在 RDS 实例中创建多个数据库。
|
||||||
|
|
||||||
|
> ⚠️ 请确认管理员已经安装了 [云资源插件](../../../reference/addons/terraform)。
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: core.oam.dev/v1beta1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: alibaba-rds-multiple-databases
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
- name: db
|
||||||
|
type: alibaba-rds
|
||||||
|
properties:
|
||||||
|
instance_name: dblinks
|
||||||
|
account_name: oamtest
|
||||||
|
password: U34rfwefwefffaked
|
||||||
|
databases:
|
||||||
|
- name: dev
|
||||||
|
character_set: utf8
|
||||||
|
description: "dev database"
|
||||||
|
- name: prod
|
||||||
|
character_set: utf8
|
||||||
|
description: "prod database"
|
||||||
|
writeConnectionSecretToRef:
|
||||||
|
name: db-conn
|
||||||
|
|
||||||
|
```
|
||||||
|
|
|
@ -98,6 +98,7 @@ module.exports = {
|
||||||
"end-user/components/cloud-services/provision-and-consume-cloud-services",
|
"end-user/components/cloud-services/provision-and-consume-cloud-services",
|
||||||
"end-user/components/cloud-services/provision-and-initiate-database",
|
"end-user/components/cloud-services/provision-and-initiate-database",
|
||||||
"end-user/components/cloud-services/secure-your-database-connection",
|
"end-user/components/cloud-services/secure-your-database-connection",
|
||||||
|
"end-user/components/cloud-services/provision-an-RDS-instance-with-more-than-one-database",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"end-user/traits/rollout",
|
"end-user/traits/rollout",
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
---
|
||||||
|
title: Provision an RDS instance with more than one database
|
||||||
|
---
|
||||||
|
|
||||||
|
In the guide [Provision and Binding Cloud Resources](./provision-and-consume-cloud-services) and [Provision a Database and Import a SQL File for initialization](./provision-and-initiate-database),
|
||||||
|
only one database will be created in an RDS instance. This tutorial will show you how to create more than one database in an RDS instance.
|
||||||
|
|
||||||
|
In the [reference doc for Alibaba Cloud RDS](./terraform/alibaba-rds), set `database_name` if you want to create one database.
|
||||||
|
If you want to create more than one database, set `databases` to array of databases. Each database is a map, the map
|
||||||
|
contains the following attributes: name, character_set, description.
|
||||||
|
|
||||||
|
```
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"name" : "test",
|
||||||
|
"character_set" : "utf8",
|
||||||
|
"description" : "test database"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name" : "test2",
|
||||||
|
"character_set" : "utf8",
|
||||||
|
"description" : "test database"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
| Name | Description | Type | Required | Default |
|
||||||
|
|----------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------|----------|---------|
|
||||||
|
| database_name | Database name | string | false | |
|
||||||
|
| databases | The database list, each database is a map, the map contains the following attributes: name, character_set, description, like `[{"name":"test","character_set":"utf8","description":"test database"},]`. It conflicts with `database_name`. | list(map(string)) | false | |
|
||||||
|
|
||||||
|
Applying the following application can create more than one database in an RDS instance.
|
||||||
|
|
||||||
|
> ⚠️ This section requires your platform engineers have already enabled [cloud resources addon](../../../reference/addons/terraform).
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: core.oam.dev/v1beta1
|
||||||
|
kind: Application
|
||||||
|
metadata:
|
||||||
|
name: alibaba-rds-multiple-databases
|
||||||
|
spec:
|
||||||
|
components:
|
||||||
|
- name: db
|
||||||
|
type: alibaba-rds
|
||||||
|
properties:
|
||||||
|
instance_name: dblinks
|
||||||
|
account_name: oamtest
|
||||||
|
password: U34rfwefwefffaked
|
||||||
|
databases:
|
||||||
|
- name: dev
|
||||||
|
character_set: utf8
|
||||||
|
description: "dev database"
|
||||||
|
- name: prod
|
||||||
|
character_set: utf8
|
||||||
|
description: "prod database"
|
||||||
|
writeConnectionSecretToRef:
|
||||||
|
name: db-conn
|
||||||
|
|
||||||
|
```
|
|
@ -202,6 +202,10 @@
|
||||||
{
|
{
|
||||||
"type": "doc",
|
"type": "doc",
|
||||||
"id": "version-v1.2/end-user/components/cloud-services/secure-your-database-connection"
|
"id": "version-v1.2/end-user/components/cloud-services/secure-your-database-connection"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "doc",
|
||||||
|
"id": "version-v1.2/end-user/components/cloud-services/provision-an-RDS-instance-with-more-than-one-database"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue