MariaDB
This provisions a new MariaDB database in an existing MariaDB instance. The instance must be reachable from Humanitec IPs.
Property | Description |
---|---|
Resource Type | mariadb |
Account Type | None |
Inputs
Values
Name | Type | Description |
---|---|---|
host |
string | The IP Address or hostname that the instance is available on. |
port |
integer | The port the instance is listening on. |
append_host_to_user |
boolean | [Optional] Azure Databases for Postgres and MySQL require usernames to have @servername appended to them. Set this to true for the Driver to append this automatically. (See: Azure Database connection strings) |
copy_from_name |
string | [Optional] If provided, specifies the database in the same instance to copy data from. |
Secrets
Name | Type | Description |
---|---|---|
dbcredentials |
object | An object holding username and password properties for the PostgreSQL superuser. |
Notes
Automatic population of database
MariaDB does not provide any standard way of duplicating databases. Instead, the suggested approach is to “dump and restore” a database using tools such as mariadb-dump/mysqldump.
This Driver emulates a dump and restore of the database - i.e. it serially copies data from the source database to the target database. It therefore suffers from limitations of dumping and restoring a database. The main issue is that if the source database is being written to, there are no guarantees about the data integrity in the resulting database. Consider a source database with 2 tables A and B:
- Table A is copied to the target database.
- New data is then written to Table A and Table B in the source database.
- Table B is copied from the source database to the target database.
The target database will now have the updated to table B but not table A.
This functionality should not be used for production databases or where data integrity must be guaranteed.
Example
To create a fresh MariaDB database in an instance available at dev-mariadb.example.com
:
curl https://api.humanitec.io/orgs/${HUMANITEC_ORG}/resources/defs \
-X POST \
-H "Authorization: Bearer ${HUMANITEC_TOKEN}" \
-H "Content-Type: application/json" \
--data-binary '
{
"id": "dev-mariadb",
"name": "Dev MariaDB",
"type": "mariadb",
"criteria": [
{
"env_type": "development"
}
],
"driver_type": "humanitec/mariadb",
"driver_inputs": {
"values": {
"host": "dev-mariadb.example.com",
"port": 3306
},
"secrets": {
"dbcredentials": {
"username": "root",
"password": "53cr3t-P455w0rd"
}
}
}
}'