MySQL
Usage example¶
Example
apiVersion: aiven.io/v1alpha1
kind: MySQL
metadata:
name: my-mysql
spec:
authSecretRef:
name: aiven-token
key: token
connInfoSecretTarget:
name: mysql-secret
prefix: MY_SECRET_PREFIX_
annotations:
foo: bar
labels:
baz: egg
project: my-aiven-project
cloudName: google-europe-west1
plan: business-4
maintenanceWindowDow: sunday
maintenanceWindowTime: 11:00:00
userConfig:
backup_hour: 17
backup_minute: 11
ip_filter:
- network: 0.0.0.0
description: whatever
- network: 10.20.0.0/16
Info
To create this resource, a Secret
containing Aiven token must be created first.
Apply the resource with:
Verify the newly created MySQL
:
The output is similar to the following:
To view the details of the Secret
, use the following command:
You can use the jq to quickly decode the Secret
:
The output is similar to the following:
{
"MYSQL_HOST": "<secret>",
"MYSQL_PORT": "<secret>",
"MYSQL_DATABASE": "<secret>",
"MYSQL_USER": "<secret>",
"MYSQL_PASSWORD": "<secret>",
"MYSQL_SSL_MODE": "<secret>",
"MYSQL_URI": "<secret>",
"MYSQL_REPLICA_URI": "<secret>",
"MYSQL_CA_CERT": "<secret>",
}
MySQL¶
MySQL is the Schema for the mysqls API.
Exposes secret keys
MYSQL_HOST
, MYSQL_PORT
, MYSQL_DATABASE
, MYSQL_USER
, MYSQL_PASSWORD
, MYSQL_SSL_MODE
, MYSQL_URI
, MYSQL_REPLICA_URI
, MYSQL_CA_CERT
.
Required
apiVersion
(string). Valueaiven.io/v1alpha1
.kind
(string). ValueMySQL
.metadata
(object). Data that identifies the object, including aname
string and optionalnamespace
.spec
(object). MySQLSpec defines the desired state of MySQL. See below for nested schema.
spec¶
Appears on MySQL
.
MySQLSpec defines the desired state of MySQL.
Required
plan
(string, MaxLength: 128). Subscription plan.project
(string, Immutable, Pattern:^[a-zA-Z0-9_-]+$
, MaxLength: 63). Identifies the project this resource belongs to.
Optional
authSecretRef
(object). Authentication reference to Aiven token in a secret. See below for nested schema.cloudName
(string, MaxLength: 256). Cloud the service runs in.connInfoSecretTarget
(object). Secret configuration. See below for nested schema.connInfoSecretTargetDisabled
(boolean, Immutable). When true, the secret containing connection information will not be created, defaults to false. This field cannot be changed after resource creation.disk_space
(string, Pattern:(?i)^[1-9][0-9]*(GiB|G)?$
). The disk space of the service, possible values depend on the service type, the cloud provider and the project. Reducing will result in the service re-balancing. The removal of this field does not change the value.maintenanceWindowDow
(string, Enum:monday
,tuesday
,wednesday
,thursday
,friday
,saturday
,sunday
). Day of week when maintenance operations should be performed. One monday, tuesday, wednesday, etc.maintenanceWindowTime
(string, MaxLength: 8). Time of day when maintenance operations should be performed. UTC time in HH:mm:ss format.projectVPCRef
(object). ProjectVPCRef reference to ProjectVPC resource to use its ID as ProjectVPCID automatically. See below for nested schema.projectVpcId
(string, MaxLength: 36). Identifier of the VPC the service should be in, if any.serviceIntegrations
(array of objects, Immutable, MaxItems: 1). Service integrations to specify when creating a service. Not applied after initial service creation. See below for nested schema.tags
(object, AdditionalProperties: string). Tags are key-value pairs that allow you to categorize services.technicalEmails
(array of objects, MaxItems: 10). Defines the email addresses that will receive alerts about upcoming maintenance updates or warnings about service instability. See below for nested schema.terminationProtection
(boolean). Prevent service from being deleted. It is recommended to have this enabled for all services.userConfig
(object). MySQL specific user configuration options. See below for nested schema.
authSecretRef¶
Appears on spec
.
Authentication reference to Aiven token in a secret.
Required
connInfoSecretTarget¶
Appears on spec
.
Secret configuration.
Required
name
(string, Immutable). Name of the secret resource to be created. By default, it is equal to the resource name.
Optional
annotations
(object, AdditionalProperties: string). Annotations added to the secret.labels
(object, AdditionalProperties: string). Labels added to the secret.prefix
(string). Prefix for the secret's keys. Added "as is" without any transformations. By default, is equal to the kind name in uppercase + underscore, e.g.KAFKA_
,REDIS_
, etc.
projectVPCRef¶
Appears on spec
.
ProjectVPCRef reference to ProjectVPC resource to use its ID as ProjectVPCID automatically.
Required
name
(string, MinLength: 1).
Optional
namespace
(string, MinLength: 1).
serviceIntegrations¶
Appears on spec
.
Service integrations to specify when creating a service. Not applied after initial service creation.
Required
integrationType
(string, Enum:read_replica
).sourceServiceName
(string, MinLength: 1, MaxLength: 64).
technicalEmails¶
Appears on spec
.
Defines the email addresses that will receive alerts about upcoming maintenance updates or warnings about service instability.
Required
email
(string). Email address.
userConfig¶
Appears on spec
.
MySQL specific user configuration options.
Optional
additional_backup_regions
(array of strings, MaxItems: 1). Additional Cloud Regions for Backup Replication.admin_password
(string, Immutable, Pattern:^[a-zA-Z0-9-_]+$
, MinLength: 8, MaxLength: 256). Custom password for admin user. Defaults to random string. This must be set only when a new service is being created.admin_username
(string, Immutable, Pattern:^[_A-Za-z0-9][-._A-Za-z0-9]{0,63}$
, MaxLength: 64). Custom username for admin user. This must be set only when a new service is being created.backup_hour
(integer, Minimum: 0, Maximum: 23). The hour of day (in UTC) when backup for the service is started. New backup is only started if previous backup has already completed.backup_minute
(integer, Minimum: 0, Maximum: 59). The minute of an hour when backup for the service is started. New backup is only started if previous backup has already completed.binlog_retention_period
(integer, Minimum: 600, Maximum: 86400). The minimum amount of time in seconds to keep binlog entries before deletion. This may be extended for services that require binlog entries for longer than the default for example if using the MySQL Debezium Kafka connector.ip_filter
(array of objects, MaxItems: 1024). Allow incoming connections from CIDR address block, e.g.10.20.0.0/16
. See below for nested schema.migration
(object). Migrate data from existing server. See below for nested schema.mysql
(object). mysql.conf configuration values. See below for nested schema.mysql_version
(string, Enum:8
). MySQL major version.private_access
(object). Allow access to selected service ports from private networks. See below for nested schema.privatelink_access
(object). Allow access to selected service components through Privatelink. See below for nested schema.project_to_fork_from
(string, Immutable, Pattern:^[a-z][-a-z0-9]{0,63}$|^$
, MaxLength: 63). Name of another project to fork a service from. This has effect only when a new service is being created.public_access
(object). Allow access to selected service ports from the public Internet. See below for nested schema.recovery_target_time
(string, Immutable, MaxLength: 32). Recovery target time when forking a service. This has effect only when a new service is being created.service_log
(boolean). Store logs for the service so that they are available in the HTTP API and console.service_to_fork_from
(string, Immutable, Pattern:^[a-z][-a-z0-9]{0,63}$|^$
, MaxLength: 64). Name of another service to fork from. This has effect only when a new service is being created.static_ips
(boolean). Use static public IP addresses.
ip_filter¶
Appears on spec.userConfig
.
CIDR address block, either as a string, or in a dict with an optional description field.
Required
network
(string, MaxLength: 43). CIDR address block.
Optional
description
(string, MaxLength: 1024). Description for IP filter list entry.
migration¶
Appears on spec.userConfig
.
Migrate data from existing server.
Required
host
(string, MaxLength: 255). Hostname or IP address of the server where to migrate data from.port
(integer, Minimum: 1, Maximum: 65535). Port number of the server where to migrate data from.
Optional
dbname
(string, MaxLength: 63). Database name for bootstrapping the initial connection.ignore_dbs
(string, MaxLength: 2048). Comma-separated list of databases, which should be ignored during migration (supported by MySQL and PostgreSQL only at the moment).ignore_roles
(string, MaxLength: 2048). Comma-separated list of database roles, which should be ignored during migration (supported by PostgreSQL only at the moment).method
(string, Enum:dump
,replication
). The migration method to be used (currently supported only by Redis, Dragonfly, MySQL and PostgreSQL service types).password
(string, MaxLength: 256). Password for authentication with the server where to migrate data from.ssl
(boolean). The server where to migrate data from is secured with SSL.username
(string, MaxLength: 256). User name for authentication with the server where to migrate data from.
mysql¶
Appears on spec.userConfig
.
mysql.conf configuration values.
Optional
connect_timeout
(integer, Minimum: 2, Maximum: 3600). The number of seconds that the mysqld server waits for a connect packet before responding with Bad handshake.default_time_zone
(string, Pattern:^([-+][\d:]*|[\w/]*)$
, MinLength: 2, MaxLength: 100). Default server time zone as an offset from UTC (from -12:00 to +12:00), a time zone name, orSYSTEM
to use the MySQL server default.group_concat_max_len
(integer, Minimum: 4). The maximum permitted result length in bytes for the GROUP_CONCAT() function.information_schema_stats_expiry
(integer, Minimum: 900, Maximum: 31536000). The time, in seconds, before cached statistics expire.innodb_change_buffer_max_size
(integer, Minimum: 0, Maximum: 50). Maximum size for the InnoDB change buffer, as a percentage of the total size of the buffer pool. Default is 25.innodb_flush_neighbors
(integer, Minimum: 0, Maximum: 2). Specifies whether flushing a page from the InnoDB buffer pool also flushes other dirty pages in the same extent (default is 1): 0 - dirty pages in the same extent are not flushed, 1 - flush contiguous dirty pages in the same extent, 2 - flush dirty pages in the same extent.innodb_ft_min_token_size
(integer, Minimum: 0, Maximum: 16). Minimum length of words that are stored in an InnoDB FULLTEXT index. Changing this parameter will lead to a restart of the MySQL service.innodb_ft_server_stopword_table
(string, Pattern:^.+/.+$
, MaxLength: 1024). This option is used to specify your own InnoDB FULLTEXT index stopword list for all InnoDB tables.innodb_lock_wait_timeout
(integer, Minimum: 1, Maximum: 3600). The length of time in seconds an InnoDB transaction waits for a row lock before giving up. Default is 120.innodb_log_buffer_size
(integer, Minimum: 1048576, Maximum: 4294967295). The size in bytes of the buffer that InnoDB uses to write to the log files on disk.innodb_online_alter_log_max_size
(integer, Minimum: 65536, Maximum: 1099511627776). The upper limit in bytes on the size of the temporary log files used during online DDL operations for InnoDB tables.innodb_print_all_deadlocks
(boolean). When enabled, information about all deadlocks in InnoDB user transactions is recorded in the error log. Disabled by default.innodb_read_io_threads
(integer, Minimum: 1, Maximum: 64). The number of I/O threads for read operations in InnoDB. Default is 4. Changing this parameter will lead to a restart of the MySQL service.innodb_rollback_on_timeout
(boolean). When enabled a transaction timeout causes InnoDB to abort and roll back the entire transaction. Changing this parameter will lead to a restart of the MySQL service.innodb_thread_concurrency
(integer, Minimum: 0, Maximum: 1000). Defines the maximum number of threads permitted inside of InnoDB. Default is 0 (infinite concurrency - no limit).innodb_write_io_threads
(integer, Minimum: 1, Maximum: 64). The number of I/O threads for write operations in InnoDB. Default is 4. Changing this parameter will lead to a restart of the MySQL service.interactive_timeout
(integer, Minimum: 30, Maximum: 604800). The number of seconds the server waits for activity on an interactive connection before closing it.internal_tmp_mem_storage_engine
(string, Enum:MEMORY
,TempTable
). The storage engine for in-memory internal temporary tables.log_output
(string, Enum:INSIGHTS
,INSIGHTS,TABLE
,NONE
,TABLE
). The slow log output destination when slow_query_log is ON. To enable MySQL AI Insights, choose INSIGHTS. To use MySQL AI Insights and the mysql.slow_log table at the same time, choose INSIGHTS,TABLE. To only use the mysql.slow_log table, choose TABLE. To silence slow logs, choose NONE.long_query_time
(number, Minimum: 0, Maximum: 3600). The slow_query_logs work as SQL statements that take more than long_query_time seconds to execute.max_allowed_packet
(integer, Minimum: 102400, Maximum: 1073741824). Size of the largest message in bytes that can be received by the server. Default is 67108864 (64M).max_heap_table_size
(integer, Minimum: 1048576, Maximum: 1073741824). Limits the size of internal in-memory tables. Also set tmp_table_size. Default is 16777216 (16M).net_buffer_length
(integer, Minimum: 1024, Maximum: 1048576). Start sizes of connection buffer and result buffer. Default is 16384 (16K). Changing this parameter will lead to a restart of the MySQL service.net_read_timeout
(integer, Minimum: 1, Maximum: 3600). The number of seconds to wait for more data from a connection before aborting the read.net_write_timeout
(integer, Minimum: 1, Maximum: 3600). The number of seconds to wait for a block to be written to a connection before aborting the write.slow_query_log
(boolean). Slow query log enables capturing of slow queries. Setting slow_query_log to false also truncates the mysql.slow_log table.sort_buffer_size
(integer, Minimum: 32768, Maximum: 1073741824). Sort buffer size in bytes for ORDER BY optimization. Default is 262144 (256K).sql_mode
(string, Pattern:^[A-Z_]*(,[A-Z_]+)*$
, MaxLength: 1024). Global SQL mode. Set to empty to use MySQL server defaults. When creating a new service and not setting this field Aiven default SQL mode (strict, SQL standard compliant) will be assigned.sql_require_primary_key
(boolean). Require primary key to be defined for new tables or old tables modified with ALTER TABLE and fail if missing. It is recommended to always have primary keys because various functionality may break if any large table is missing them.tmp_table_size
(integer, Minimum: 1048576, Maximum: 1073741824). Limits the size of internal in-memory tables. Also set max_heap_table_size. Default is 16777216 (16M).wait_timeout
(integer, Minimum: 1, Maximum: 2147483). The number of seconds the server waits for activity on a noninteractive connection before closing it.
private_access¶
Appears on spec.userConfig
.
Allow access to selected service ports from private networks.
Optional
mysql
(boolean). Allow clients to connect to mysql with a DNS name that always resolves to the service's private IP addresses. Only available in certain network locations.mysqlx
(boolean). Allow clients to connect to mysqlx with a DNS name that always resolves to the service's private IP addresses. Only available in certain network locations.prometheus
(boolean). Allow clients to connect to prometheus with a DNS name that always resolves to the service's private IP addresses. Only available in certain network locations.
privatelink_access¶
Appears on spec.userConfig
.
Allow access to selected service components through Privatelink.
Optional
mysql
(boolean). Enable mysql.mysqlx
(boolean). Enable mysqlx.prometheus
(boolean). Enable prometheus.
public_access¶
Appears on spec.userConfig
.
Allow access to selected service ports from the public Internet.
Optional
mysql
(boolean). Allow clients to connect to mysql from the public internet for service nodes that are in a project VPC or another type of private network.mysqlx
(boolean). Allow clients to connect to mysqlx from the public internet for service nodes that are in a project VPC or another type of private network.prometheus
(boolean). Allow clients to connect to prometheus from the public internet for service nodes that are in a project VPC or another type of private network.