瑞士电信云下的Mariadb存储容量

Maria DB storage capacity under Swisscom cloud

根据此页面 https://developer.swisscom.com/pricing 可以为每个计划定义实例数。这是否意味着如果系统需要额外的 GB,我只需要添加更多实例就可以了?代码无需更改,我可以使用相同的连接参数吗?

在此图中,您看到的是应用程序(不是持久数据服务)。使用应用程序,您可以非常动态地添加实例和内存。应用程序是无状态的。

请阅读 twelve-factor app 了解有关如何为 CF 开发应用程序的更多信息。

In the modern era, software is commonly delivered as a service: called web apps, or software-as-a-service. The twelve-factor app is a methodology for building software-as-a-service apps.

对于服务(具有持久数据),您必须选择一个计划。例如,如果您使用 small 并且需要更多 connections/storage(例如 large),则无法通过一条命令升级。

$ cf m -s mariadb
Getting service plan information for service mariadb as admin...
OK

service plan   description                                        free or paid
small          Maximum 10 concurrent connections, 1GB storage     paid
medium         Maximum 15 concurrent connections, 8GB storage     paid
large          Maximum 100 concurrent connections, 16GB storage   paid

你需要

  • 转储数据库(在本地设备上使用服务连接器插件和 mysqldump
  • 创建新服务(cf cs mariadb large ...
  • 将数据恢复到新服务(服务连接器和 mysql 客户端)
  • 删除旧服务(cf ds -f...

目前没有"one-click"升级。

添加到 Fyodor Glebov 的回答:

有一种简单的一键升级方法:Push2Cloud。

使用自定义工作流,您可以自动化与 CloudFoundry 的每次交互。我们提供了两个 workflows/Docker 迁移 Redis 的镜像和 MongoDB 个实例:

同样的方法也适用于 Maria DB。如果您有兴趣实施工作流程,请在主 Push2Cloud 存储库上提出问题。

这是 MongoDB 的分步指南:

  1. 停止连接到旧数据库的应用程序(以确保数据一致性)
  2. 为旧 mongodb (cf create-service-key <mongodb-name> migration) 创建服务密钥
  3. 检索服务密钥:cf service-key <mongodb-name> migration
  4. cf ssh 进入与数据库相同 space 的任何应用程序:cf ssh <app-name> -L 13000:<mongodb-host>:<mongodb-port>(来自服务密钥的主机和端口)
  5. 以下命令的凭据都可以在您在第 3 步中检索到的服务密钥中找到。打开一个新终端window和运行 mongodump --host 127.0.0.1:13000 --authenticationDatabase <mongodb-database> --username <mongodb-username> --password <mongodb-password> --db <mongodb-database> --out=dbbackup/dump
  6. 使用 cf create-service 创建新数据库(使用 cf m -s mongodb 列出可用计划)
  7. 为新数据库创建服务密钥并检索它
  8. 从上面关闭隧道并使用新数据库的主机和端口创建一个新隧道
  9. 运行 mongorestore --host 127.0.0.1:13000 --authenticationDatabase <new-mongodb-database> --username <new-mongodb-username> --password <new-mongodb-password> --db <new-mongodb-database> <path-to-dump-file>