Version information
This version is compatible with:
- Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x
- Puppet >= 6.1.0 < 8.0.0
- , , , , , ,
Start using this module
Add this module to your Puppetfile:
mod 'puppet-proxysql', '6.0.0'
Learn more about managing modules with a PuppetfileDocumentation
Table of Contents
- Overview
- Setup - The basics of getting started with proxysql
- Usage - Configuration options and additional functionality
- Reference - An under-the-hood peek at what the module is doing and how
- Limitations - OS compatibility, etc.
- Development - Guide for contributing to the module
Overview
The proxysql module installs, configures and manages the ProxySQL service.
This module will install the ProxySQL and manage it's configuration. It also extends Puppet to be able to manage mysql_users
, mysql_servers
, mysql_replication_hostgroups
, mysql_galera_hostgroups
, mysql_query_rules
, proxysql_servers
, scheduler
and global_variables
.
Setup
Setup Requirements
The module requires Puppet 5.5.8 and above. It also depends on:
- puppetlabs/mysql
- puppetlabs/apt - (Not strictly required on non Debian based systems)
- puppetlabs/stdlib
- camptocamp/systemd - (Not strictly required if installing ProxySQL 1.4)
For up to date details on external dependencies, please see the metadata.json or for released versions, the puppet forge page.
puppet/selinux is an optional soft
dependency and not even listed in the metadata.json. No Operating Systems require this module to be present, but if it is, it will be used to install SELinux rules that allow logrotate to work. See manage_selinux
Beginning with proxysql
To install the ProxySQL software with all the default options:
include proxysql
By default, packages come from the official upstream package repositories which the module will configure. On new installations, (by default), the 2.0.x repository will be configured. If ProxySQL is already installed, then the repository matching the currently installed version will be used.
To force the use of 1.4.x packages, use the version
parameter. (Note, the example below does not force the installation of 1.4.16
, it only ensures the correct repository
is configured and that ProxySQL will be configured as if the version installed is 1.4.16
)
class { 'proxysql':
version => '1.4.16',
}
To use your Operating System's own packages set manage_repo => false
.
class { 'proxysql':
manage_repo => false,
}
or you can configure your own repository by eg. declaring your own yumrepo
, pulp_rpmbind
or rhn_channel
resource and setting manage_repo => false
.
For example, using pulp
and katello/pulp
pulp_rpmbind { 'my_proxysql_repo':}
class { 'proxysql':
manage_repo => false,
require => Pulp_rpmbind['my_proxysql_repo'],
}
Alternatively, you can specify a package_source
and associated options. This mimics the old, (pre version 4), behaviour of this module.
class { 'proxysql':
package_source => 'https://github.com/sysown/proxysql/releases/download/v1.4.11/proxysql_1.4.11-debian9_amd64.deb',
package_checksum_value => '65a3c2b98eefa42946ee59eef18ba18534c2a39d',
package_checksum_type => 'sha1',
}
You can customize options such as (but not limited to) listen_port
, admin_password
, monitor_password
, ...
class { 'proxysql':
listen_port => 3306,
admin_password => Sensitive('654321'),
monitor_password => Sensitive('123456'),
override_config_settings => $override_settings,
}
You can configure users\hostgroups\rules\schedulers using class parameters
class { 'proxysql':
mysql_servers => [
{
'db1' => {
'port' => 3306,
'hostgroup_id' => 1,
}
},
{
'db2' => {
'hostgroup_id' => 2,
}
},
],
mysql_users => [
{
'app' => {
'password' => '*92C74DFBDA5D60ABD41EFD7EB0DAE389F4646ABB',
'default_hostgroup' => 1,
}
},
{
'ro' => {
'password' => mysql_password('MyReadOnlyUserPassword'),
'default_hostgroup' => 2,
}
},
],
mysql_hostgroups => [
{
'1-2' => {
'writer' => 1,
'reader' => 2,
}
},
],
mysql_group_replication_hostgroups => [
{
'hostgroup 2' => {
'reader' => 10,
'writer' => 5,
'backup' => 2,
'offline' => 11,
}
},
],
mysql_galera_hostgroups => [
{
'galera hostgroup 1' => {
'writer' => 1,
'backup' => 2,
'reader' => 3,
'offline' => 4,
}
},
],
mysql_rules => [
{
'mysql_query_rule-1' => {
'rule_id' => 1,
'match_pattern' => 'testtable',
'replace_pattern' => 'test.newtable',
'apply' => 1,
'active' => 1,
}
},
],
schedulers => [
{
'scheduler-1' => {
'scheduler_id' => 1,
'active' => 0,
'filename' => '/usr/bin/whoami',
}
},
],
Or by using individual resources:
class { 'proxysql':
listen_port => 3306,
admin_password => Sensitive('SuperSecretPassword'),
}
proxy_mysql_server { '192.168.33.31:3306-31':
hostname => '192.168.33.31',
port => 3306,
hostgroup_id => 31,
}
proxy_mysql_server { '192.168.33.32:3306-31':
hostname => '192.168.33.32',
port => 3306,
hostgroup_id => 31,
}
proxy_mysql_server { '192.168.33.33:3306-31':
hostname => '192.168.33.33',
port => 3306,
hostgroup_id => 31,
}
proxy_mysql_server { '192.168.33.34:3306-31':
hostname => '192.168.33.34',
port => 3306,
hostgroup_id => 31,
}
proxy_mysql_server { '192.168.33.35:3306-31':
hostname => '192.168.33.35',
port => 3306,
hostgroup_id => 31,
}
proxy_mysql_replication_hostgroup { '30-31':
writer_hostgroup => 30,
reader_hostgroup => 31,
comment => 'Replication Group 1',
}
proxy_mysql_replication_hostgroup { '20-21':
writer_hostgroup => 20,
reader_hostgroup => 21,
comment => 'Replication Group 2',
}
proxy_mysql_group_replication_hostgroup { '5-2-10-11':
reader_hostgroup => 10,
writer_hostgroup => 5,
backup_writer_hostgroup => 2,
offline_hostgroup => 11,
}
proxy_mysql_galera_hostgroup { '1-2-3-4':
writer_hostgroup => 1,
backup_writer_hostgroup => 2,
reader_hostgroup => 3,
offline_hostgroup => 4,
}
proxy_mysql_user { 'tester':
password => 'testerpwd',
default_hostgroup => 30,
}
proxy_mysql_query_rule { 'mysql_query_rule-1':
rule_id => 1,
match_pattern => '^SELECT',
apply => 1,
active => 1,
destination_hostgroup => 31,
}
proxy_scheduler { 'scheduler-1':
scheduler_id => 1,
active => 0,
filename => '/usr/bin/whoami',
}
proxy_scheduler { 'scheduler-2':
scheduler_id => 2,
active => 0,
interval_ms => 1000,
filename => '/usr/bin/id',
}
Usage
Configuration is done by the proxysql
class.
Customize config settings
You can override any configuration setting by using the override_config_settings
hash. This hash resembles the structure of the proxysql.cnf
file
{
admin_variables => {
refresh_interval => 2000,
...
},
mysql_variables => {
monitor_writer_is_also_reader => false,
...
},
mysql_servers => {
'127.0.0.1:33061-1' => {
'address' => '127.0.0.1',
'port' => 33061,
'hostgroup_id' => 1,
},
'127.0.0.1:33062-1' => {
'address' => '127.0.0.1',
'port' => 33062,
'hostgroup_id' => 1,
},
...
},
mysql_users => { ... },
mysql_query_rules => { ... },
scheduler => { ... },
mysql_replication_hostgroups => { ... },
mysql_galera_hostgroups => { ... },
}
Reference
Public classes
proxysql
: Installs and configures ProxySQL
Private classes
proxysql::admin_credentials
: Manages the admin credentials and admin interfacesproxysql::config
: Manages the configuration files andglobal_variables
proxysql::configure
: Manages the resources specified in the public classproxysql::install
: Installs the package(s)proxysql::param
: Manages the default parametersproxysql::prerequisites
: Manages the user / group to own the proxysql filesproxysql::reload_config
: Reloads admin and mysql variables if you enable themanage_config_file
optionproxysql::repo
: Manages the repo's where ProxySQL might be in.proxysql::service
: Manages the service
parameters
proxysql
package_name
The name of the ProxySQL package in your package manager. Defaults to 'proxysql'
package_ensure
The ensure of the ProxySQL package resource. Defaults to 'latest'
service_name
The name of the ProxySQL service resource. Defaults to 'proxysql'
service_ensure
The ensure of the ProxySQL service resource. Defaults to 'running'
datadir
The directory where ProxySQL will store it's data. defaults to '/var/lib/proxysql'
errorlog_file
The File where ProxySQL will store its error logs. Defaults to '/var/lib/proxysql/proxysql.log'. Available from ProxySQL v2.0.0
errorlog_file_mode
The filesystem mode for the errorlog_file
. Defaults to '0600'. Available from ProxySQL v2.0.0
errorlog_file_owner
Owner of the errorlog_file
. Defaults to 'proxysql'. Available from ProxySQL v2.0.0
errorlog_file_group
Group of the errorlog_file
. Defaults to 'proxysql'. Available from ProxySQL v2.0.0
manage_selinux
Whether to create the required selinux rules for logrotate to work. Defaults to true
, but is only applicable to systems where SELinux is active (enforcing
or permissive
).
This parameter also requires the puppet/selinux module to be installed.
listen_ip
The ip where the ProxySQL service will listen on. Defaults to '0.0.0.0' aka all configured IP's on the machine
listen_port
The port where the ProxySQL service will listen on. Defaults to '6033'
listen_socket
The socket where the ProxySQL service will listen on. Defaults to '/tmp/proxysql.sock'
admin_username
The username to connect to the ProxySQL admin interface. Defaults to 'admin'
admin_password
The password to connect to the ProxySQL admin interface. Defaults to 'admin'
stats_username
The username to connect with read-only permissions to the ProxySQL admin interface. Defaults to 'stats'
stats_password
The password to connect with read-only permissions to the ProxySQL admin interface. Defaults to 'stats'
admin_listen_ip
The ip where the ProxySQL admin interface will listen on. Defaults to '127.0.0.1'
admin_listen_port
The port where the ProxySQL admin interface will listen on. Defaults to '6032'
admin_listen_socket
The socket where the ProxySQL admin interface will listen on. Defaults to '/tmp/proxysql_admin.sock'
monitor_username
The username ProxySQL will use to connect to the configured mysql_servers. Defaults to 'monitor'
monitor_password
The password ProxySQL will use to connect to the configured mysql_servers. Defaults to 'monitor'
config_file
The file where the ProxySQL configuration is saved. This will only be configured if manage_config_file
is set to true
.
Defaults to '/etc/proxysql.cnf'
manage_config_file
Determines whether this module will configure the ProxySQL configuration file. Defaults to 'true'
mycnf_file_name
Path of the my.cnf file where the connections details for the admin interface is save. This is required for the providers to work.
This will only be configured if manage_mycnf_file
is set to true
. Defaults to '/root/.my.cnf'
manage_mycnf_file
Determines whether this module will configure the my.cnf file to connect to the admin interface. Defaults to 'true'
restart
Determines whether this module will restart ProxySQL after reconfiguring the config file. Defaults to 'false'
load_to_runtime
Specifies whether the managed ProxySQL resources should be immediately loaded to the active runtime. Boolean, defaults to 'true'.
save_to_disk
Specifies whether the managed ProxySQL resources should be immediately save to disk. Boolean, defaults to 'true'.
manage_repo
Determines whether this module will manage the repositories where ProxySQL might be. Defaults to 'true'
version
The version of proxysql being managed. This parameter affects the repository configured when manage_repo == true
and how the service is managed.
It does not affect the package version being installed. It is used as a hint to the puppet module on how to configure proxysql. To control the exact version
deployed, use package_name
or package_source
. Defaults to the version currently installed, or 2.0.7
if the proxysql_version
fact is not yet
available.
package_source
location of a proxysql package. When specified, this package will be installed with the package\_provider
and the manage_repo
setting will be ignored.
Since version 4 of this module, this defaults to undef
and needs to be specified when you don't want to use a package from a repository.
package_provider
provider for package_source
. Defaults to dpkg
for debian-based, and rpm
for redhat systems.
sys_owner
owner of the datadir and config_file, defaults to root
or proxysql
depending on version
.
sys_group
owner of the datadir and config_file, defaults to the value of sys_owner
.
override_config_settings
Which configuration variables should be overriden. Hash, defaults to {}
(empty hash).
cluster_name
If set, proxysql_servers with the same cluster_name will be automatically added to the same cluster and will synchronize their configuration parameters. Defaults to undef
cluster_username
The username ProxySQL will use to connect to the configured mysql_clusters Defaults to 'cluster'
cluster_password
The password ProxySQL will use to connect to the configured mysql_clusters. Defaults to 'cluster'
mysql_client_package_name
The name of the mysql client package in your package manager. Defaults to undef
manage_hostgroup_for_servers
Determines whether this module will manage hostgroup_id for mysql_servers. If false - it will skip difference in this value between manifest and defined in ProxySQL. Defaults to 'true'
mysql_servers
Array of mysql_servers, that will be created in ProxySQL. Defaults to undef
mysql_users
Array of mysql_users, that will be created in ProxySQL. Defaults to undef
##### mysql_hostgroups
Array of mysql_hostgroups, that will be created in ProxySQL. Defaults to undef
mysql_rules
Array of mysql_rules, that will be created in ProxySQL. Defaults to undef
schedulers
Array of schedulers, that will be created in ProxySQL. Defaults to undef
split_config
If set, ProxySQL config file will be split in 2: main config file with admin and mysql variables and proxy config file with servers\users\hostgroups\scheduler\rules params. Defaults to false
proxy_config_file
The file where servers\users\hostgroups\scheduler\rules params of ProxySQL configuration are saved. This will only be configured if split_config
is set to true
. Defaults to 'proxysql_proxy.cnf'
#####manage_proxy_config_file
Determines whether this module will update the ProxySQL proxy configuration file. Defaults to 'true'
Types
proxy_global_variable
proxy_global_variable
manages a variable in the ProxySQL global_variables
admin table.
name
The name of the variable.
load_to_runtime
Specifies whether the resource should be immediately loaded to the active runtime. Boolean, defaults to 'true'.
save_to_disk
Specifies whether the resource should be immediately save to disk. Boolean, defaults to 'true'.
value
The value of the variable.
proxy_cluster
proxy_cluster
manages an entry in the ProxySQL proxysql_clusters
admin table.
name
The name of the resource.
hostname
Hostname of the server. Required.
port
Port of the server. Required. Defaults to 3306.
proxy_mysql_replication_hostgroup
proxy_mysql_replication_hostgroup
manages an entry in the ProxySQL mysql_replication_hostgroups
admin table.
ensure
Whether the resource is present. Valid values are 'present', 'absent'. Defaults to 'present'.
name
Name to describe the hostgroup config. Must be in a 'writer_hostgroup
-reader_hostgroup
' format.
load_to_runtime
Specifies whether the resource should be immediately loaded to the active runtime. Boolean, defaults to 'true'.
save_to_disk
Specifies whether the resource should be immediately save to disk. Boolean, defaults to 'true'.
writer_hostgroup
Id of the writer hostgroup. Required.
reader_hostgroup
Id of the reader hostgroup. Required.
comment
Optional comment.
mysql_group_replication_hostgroup
mysql_group_replication_hostgroup
manages an entry in the ProxySQL mysql_group_replication_hostgroups
admin table.
ensure
Whether the resource is present. Valid values are 'present', 'absent'. Defaults to 'present'.
name
Name to describe the hostgroup config. Must be in a 'writer_hostgroup
-backup_writer_hostgroup
-reader_hostgroup
-offline_hostgroup
' format.
load_to_runtime
Specifies whether the resource should be immediately loaded to the active runtime. Boolean, defaults to 'true'.
save_to_disk
Specifies whether the resource should be immediately save to disk. Boolean, defaults to 'true'.
writer_hostgroup
Id of the writer hostgroup. Required.
backup_writer_hostgroup
Id of the backup writer hostgroup. Required.
reader_hostgroup
Id of the reader hostgroup. Required.
offline_hostgroup
Id of the offline hostgroup. Required.
active
Specifies whether the resource is active or not. Integer, defaults to 1.
max_writers
Specifies how many active writers the resource has. Integer, defaults to 1.
writer_is_also_reader
Specifies if the writer is also a reader. Integer, defaults to 0.
max_transactions_behind
Specifies how many transactions a resource can be behind the "master" until shunned. Integer, defaults to 0.
comment
Optional comment.
proxy_mysql_galera_hostgroup
proxy_mysql_galera_hostgroup
manages an entry in the ProxySQL mysql_galera_hostgroups
admin table.
ensure
Whether the resource is present. Valid values are 'present', 'absent'. Defaults to 'present'.
load_to_runtime
Specifies whether the resource should be immediately loaded to the active runtime. Boolean, defaults to 'true'.
save_to_disk
Specifies whether the resource should be immediately save to disk. Boolean, defaults to 'true'.
writer_hostgroup
Id of the writer hostgroup. Required if the title of the resource doesn't match the 'writer_hostgroup
-backup_writer_hostgroup
-reader_hostgroup
-offline_hostgroup
' format.
backup_writer_hostgroup
Id of the backup writer hostgroup. Required if the title of the resource doesn't match the 'writer_hostgroup
-backup_writer_hostgroup
-reader_hostgroup
-offline_hostgroup
' format.
reader_hostgroup
Id of the reader hostgroup. Required if the title of the resource doesn't match the 'writer_hostgroup
-backup_writer_hostgroup
-reader_hostgroup
-offline_hostgroup
' format.
offline_hostgroup
Id of the offline hostgroup. Required if the title of the resource doesn't match the 'writer_hostgroup
-backup_writer_hostgroup
-reader_hostgroup
-offline_hostgroup
' format.
active
Specifies whether the resource is active or not. Integer. On creation defaults to proxysql default setting (1).
max_writers
Specifies how many active writers the resource has. Integer. On creation defaults to proxysql default setting (1).
writer_is_also_reader
Specifies if the writer is also a reader. Integer. On creation defaults to proxysql default setting (0).
max_transactions_behind
Specifies how many transactions a resource can be behind the "master" until shunned. Integer. On creation defaults to proxysql default setting (0).
comment
Optional comment.
proxy_mysql_server
proxy_mysql_server
manages an entry in the ProxySQL mysql_servers
admin table.
ensure
Whether the resource is present. Valid values are 'present', 'absent'. Defaults to 'present'.
name
Name to describe the hostgroup config. Must be in a 'hostname
:port
-hostgroup_id
' format.
load_to_runtime
Specifies whether the resource should be immediately loaded to the active runtime. Boolean, defaults to 'true'.
save_to_disk
Specifies whether the resource should be immediately save to disk. Boolean, defaults to 'true'.
hostgroup_id
Id of the hostgroup this server wil be configured to be part of. Integer value, required.
hostname
Hostname of the server. Required.
port
Port of the server. Required. Defaults to 3306.
status
Status of the server. Should be one of the following values: 'ONLINE', 'OFFLINE_SOFT', 'OFFLINE_HARD', 'SHUNNED'. Defaults to 'ONLINE'.
weight
Weight value of the server. The higher the value, the higher the probability this server will be chosen from the hostgroup. Integer, defaults to 1.
compression
Compression value of the serer. If the value is greater than 0, new connections to that server will use compression. Integer, defaults to 0.
max_connections
The maximum number of connections ProxySQL will open to this backend server. Even though this server will have the highest weight, no new connections will be opened to it once this limit is hit. Please ensure that the backend is configured with a correct value of max_connections to avoid that ProxySQL will try to go beyond that limit. Integer, defaults to 1000.
max_replication_lag
If greater and 0, ProxySQL will reguarly monitor replication lag and if it goes beyond such threshold it will temporary shun the host until replication catch ups. Integer, defaults to 0.
use_ssl
If set to 1, connections to the backend will use SSL. Values 0 or 1. Defaults to 0.
max_latency_ms
Ping time is regularly monitored. If a host has a ping time greater than max_latency_ms it is excluded from the connection pool (although the server stays ONLINE. Integer, defaults to 0.
comment
Optional comment.
proxy_mysql_user
proxy_mysql_user
manages an entry in the ProxySQL mysql_users
admin table.
ensure
Whether the resource is present. Valid values are 'present', 'absent'. Defaults to 'present'.
name
Username for the user. Required.
load_to_runtime
Specifies whether the resource should be immediately loaded to the active runtime. Boolean, defaults to 'true'.
save_to_disk
Specifies whether the resource should be immediately save to disk. Boolean, defaults to 'true'.
encrypt_password
Specifies whether the user password should be encrypted (requires ProxySQL setting admin-hash_password
= true
). Boolean, defaults to 'true'.
password
Password for the user. Required.
Note: you should make sure that the global variable admin-hashed_passwords
is set to true
and then encrypt this password using the mysql_password()
function.
active
Flag to determine if this user is active or not. Values 0 or 1. Defaults to 1.
use_ssl
Flag to determine if this user uses SSL or not. Values 0 or 1. Defaults to 0.
default_hostgroup
Default hostgroup for the user. Integer, defaults to 0.
default_schema
Default schema for the user. String, defaults to ''.
schema_locked
Is the user locked in the default_schema
or not. Values 0 or 1. Defaults to 0.
transaction_persistent
Disable routing across hostgroups once a transaction has started for a specific user. Values 0 or 1. Defaults to 0.
fast_forward
Flag to determine fast forward or not. Values 0 or 1. Defaults to 0.
backend
Is this a backend user. Values 0 or 1. Defaults to 1.
frontend
Is this a frontend user. Values 0 or 1. Defaults to 1.
proxy_mysql_query_rule
proxy_mysql_query_rule
manages an entry in the ProxySQL mysql_query_rules
admin table.
ensure
Whether the resource is present. Valid values are 'present', 'absent'. Defaults to 'present'.
name
The name of the query rule entry, Must be in a 'mysql_query_rule-rule_id
' format.
load_to_runtime
Specifies whether the resource should be immediately loaded to the active runtime. Boolean, defaults to 'true'.
save_to_disk
Specifies whether the resource should be immediately save to disk. Boolean, defaults to 'true'.
rule_id
Id of the scheduler entry. Integer value, required.
active
Is the rule active or not. Boolean value 0 or 1, defaults to 0.
username
Username to apply this rule to. String, defaults to NULL.
schemaname
Schema to apply this rule to. String, defaults to NULL.
flag_in
Used to chain rules. This is the id of the previous rule to apply. Integer, defaults to 0.
flag_out
Used to chain rules. This is the id of the next rule to apply, Integer, defaults to NULL
apply
Used to chain rules.
client_addr
Match traffic from a certain address. String, defaults to NULL.
proxy_addr
Match incoming traffic on a specific local address. String, defaults to NULL.
proxy_port
Match incoming traffic on a specific local port. Integer, defaults to NULL.
digest
match queries with a specific digest, as returned by stats_mysql_query_digest
.digest
. String, defaults to NULL.
match_digest
regular expression that matches the query digest. String, defaults to NULL.
match_pattern
regular expression that matches the query text. String, defaults to NULL.
replace_pattern
this is the pattern with which to replace the matched pattern. String, defaults to NULL.
negate_match_pattern
if this is set to 1, only queries not matching the query text will be considered as a match. This acts as a NOT operator in front of the regular expression matching against match_pattern or match_digest. Boolean value 0 or 1, defaults to 0.
destination_hostgroup
The hostgroup to send this query to. Integer, defaults to NULL.
cache_ttl
The amount of miliseconds to cache the result of this query. Integer, defaults to NULL.
reconnect
feature currently not in use.
timeout
The maximum amount of miliseconds in which the matched or rewritten query should be executed. Integer, defaults to NULL.
retries
The maximum number of times a query needs to be re-executed in case of detected failure during the execution of the query. Integer, defaults to NULL.
delay
The number of milliseconds to delay the execution of the query. Integer, defaults to NULL.
error_msg
The query will be blocked, and the specified error_msg will be returned to the client. String, defaults to NULL.
log
The query will be logged. Boolean value 0 or 1, defaults to NULL.
mirror_hostgroup
see https://github.com/sysown/proxysql/blob/master/doc/mirroring.md. Integer, defaults to NULL.
mirror_flag_out
see https://github.com/sysown/proxysql/blob/master/doc/mirroring.md. Integer, defaults to NULL.
comment
Optional free form text field, usable for a descriptive comment of the query rule.
proxy_scheduler
proxy_scheduler
manages an entry in the ProxySQL scheduler
admin table.
ensure
Whether the resource is present. Valid values are 'present', 'absent'. Defaults to 'present'.
name
The name of the scheduler entry, Must be in a 'scheduler-scheduler_id
' format.
load_to_runtime
Specifies whether the resource should be immediately loaded to the active runtime. Boolean, defaults to 'true'.
save_to_disk
Specifies whether the resource should be immediately save to disk. Boolean, defaults to 'true'.
scheduler_id
Id of the scheduler entry. Integer value, required.
filename
The filename of the scheduler script to run. Required.
interval_ms
Interval in which to run this scheduler. In miliseconds, Integer, defaults to 10000 (10sec).
arg1
The 1st argument for the scheduler script to run. Optional, defaults to NULL.
arg2
The 2nd argument for the scheduler script to run. Optional, defaults to NULL.
arg3
The 3rd argument for the scheduler script to run. Optional, defaults to NULL.
arg4
The 4th argument for the scheduler script to run. Optional, defaults to NULL.
arg5
The 5th argument for the scheduler script to run. Optional, defaults to NULL.
comment
Optional comment.
proxysql\_runtime
fact
This module ships a fact that you may find useful in your profiles. It is not used by the module itself.
The proxysql_runtime
fact queries ProxySQL and returns a hash containing the contents of several of the runtime tables.
The fact will only return data if the mysql2 library is installed in your puppet agent's gem environment.
For systems using official puppet packages, (All In One packages), the following code can be used to install this gem and make the fact available.
$dev_packages = ['mariadb-devel','make','gcc']
ensure_packages($dev_packages)
package { 'mysql2 gem':
ensure => present,
name => 'mysql',
provider => 'puppet_gem',
require => Package[$dev_packages],
}
Limitations
The module requires Puppet 5.5 or above. The proxysql_runtime
fact only works when using the default value for mycnf_file_name
.
Development
This module is originally developed by Matthias Crauwels for use at Ghent University, Belgium. This module is published under the Apache 2.0 license. It is now maintained by Vox Pupuli
We are open to feature requests, bug reports, contributions, etc...
Contributors
Original author: Matthias Crauwels
Reference
Table of Contents
Classes
Public Classes
proxysql
: Install and configure ProxySQL.
Private Classes
proxysql::admin_credentials
: This class is called from proxysql for service config.proxysql::config
: This class is called from proxysql for service config.proxysql::configure
: This class is called from proxysql for all proxy configuration.proxysql::install
: This class is called from proxysql for install.proxysql::params
: It sets variables according to platform.proxysql::prerequisites
: Manage the prerequisites where the ProxySQL package might be.proxysql::reload_config
: This class is called from proxysql to update config if it changed.proxysql::repo
: Manage the repos where the ProxySQL package might be.proxysql::selinux
: Adds selinux configuration needed for logrotate to work.proxysql::service
: This class ensures that the service is running.
Resource types
proxy_cluster
: Manage a ProxySQL cluster.proxy_global_variable
: Manage a ProxySQL global variable.proxy_mysql_galera_hostgroup
: Manage a ProxySQL mysql_galera_hostgroup.proxy_mysql_group_replication_hostgroup
: Manage a ProxySQL mysql_group_replication_hostgroup.proxy_mysql_query_rule
: Manage a ProxySQL mysql_query_rules entry.proxy_mysql_replication_hostgroup
: Manage a ProxySQL mysql_replication_hostgroup.proxy_mysql_server
: Manage a ProxySQL mysql_server.proxy_mysql_server_no_hostgroup
: Manage a ProxySQL mysql_server.proxy_mysql_user
: Manage a ProxySQL mysql_user. This includes management of users password as well as privileges.proxy_scheduler
: Manage a ProxySQL scheduler entry.
Data types
Proxysql::GaleraHostgroup
: Represents an entry in the ProxySQLmysql_galera_hostgroups
admin table.Proxysql::GroupReplicationHostgroup
: Represents a ProxySQL group replication hostgroup.Proxysql::Hostgroup
: Represents a ProxySQL replication hostgroup.Proxysql::Scheduler
: Represents a ProxySQL schedulerProxysql::Server
: Represents a ProxySQL server.Proxysql::User
: Represents a ProxySQL user.
Classes
proxysql
Install and configure ProxySQL.
Parameters
The following parameters are available in the proxysql
class.
package_name
Data type: String
The name of the ProxySQL package in your package manager.
Default value: 'proxysql'
package_ensure
Data type: String
The ensure of the ProxySQL package resource.
Default value: 'installed'
package_install_options
Data type: Array[String]
An array of additional options to pass when installing a package.
Default value: []
service_name
Data type: String
The name of the ProxySQL service resource.
Default value: 'proxysql'
service_ensure
Data type: String
The ensure of the ProxySQL service resource.
Default value: 'running'
datadir
Data type: String
The directory where ProxySQL will store its data.
Default value: $proxysql::params::datadir
datadir_mode
Data type: Stdlib::Filemode
The filesystem mode for the datadir
.
Default value: '0600'
errorlog_file
Data type: Optional[Stdlib::Unixpath]
The File where ProxySQL will store its error logs. Available from ProxySQL v2.0.0
Default value: undef
errorlog_file_mode
Data type: Stdlib::Filemode
The filesystem mode for the errorlog_file
. Available from ProxySQL v2.0.0
Default value: '0600'
errorlog_file_owner
Data type: String
Owner of the errorlog_file
. Available from ProxySQL v2.0.0
Default value: 'proxysql'
errorlog_file_group
Data type: String
Group of the errorlog_file
. Available from ProxySQL v2.0.0
Default value: 'proxysql'
manage_selinux
Data type: Boolean
Whether to create the required selinux rules for logrotate to work.
This parameter also requires the puppet/selinux
module to be installed.
Default value: true
manage_mysql_client
Data type: Boolean
Whether to include the mysql::client class. You may have mysql::client included or managed with different parameters elsewhere in your catalogue.
Default value: true
listen_ip
Data type: String
The ip where the ProxySQL service will listen on.
Default value: '0.0.0.0'
listen_port
Data type: Integer
The port where the ProxySQL service will listen on.
Default value: 6033
listen_socket
Data type: String
The socket where the ProxySQL service will listen on.
Default value: $proxysql::params::listen_socket
admin_username
Data type: String
The username to connect to the ProxySQL admin interface.
Default value: 'admin'
admin_password
Data type: Sensitive[String]
The password to connect to the ProxySQL admin interface.
Default value: Sensitive('admin')
stats_username
Data type: String
The username to connect with read-only permissions to the ProxySQL admin interface.
Default value: 'stats'
stats_password
Data type: Sensitive[String]
The password to connect with read-only permissions to the ProxySQL admin interface.
Default value: Sensitive('stats')
admin_listen_ip
Data type: String
The ip where the ProxySQL admin interface will listen on.
Default value: '127.0.0.1'
admin_listen_port
Data type: Integer
The port where the ProxySQL admin interface will listen on.
Default value: 6032
admin_listen_socket
Data type: String
The socket where the ProxySQL admin interface will listen on. Changing this on a running system will result in failing runs.
Default value: $proxysql::params::admin_listen_socket
monitor_username
Data type: String
The username ProxySQL will use to connect to the configured mysql_servers.
Default value: 'monitor'
monitor_password
Data type: Sensitive[String]
The password ProxySQL will use to connect to the configured mysql_servers.
Default value: Sensitive('monitor')
config_file
Data type: String
The file where the ProxySQL configuration is saved. This will only be configured if manage_config_file
is set to true
.
Default value: '/etc/proxysql.cnf'
manage_config_file
Data type: Boolean
Determines whether this module will configure the ProxySQL configuration file.
Default value: true
mycnf_file_name
Data type: String
Path of the my.cnf file where the connections details for the admin interface is save. This is required for the providers to work.
This will only be configured if manage_mycnf_file
is set to true
.
Default value: '/root/.my.cnf'
manage_mycnf_file
Data type: Boolean
Determines whether this module will configure the my.cnf file to connect to the admin interface. This is required for the providers to work.
Default value: true
restart
Data type: Boolean
Determines whether this module will restart ProxySQL after reconfiguring the config file.
Default value: false
load_to_runtime
Data type: Boolean
Specifies whether te managed ProxySQL resources should be immediately loaded to the active runtime.
Default value: true
save_to_disk
Data type: Boolean
Specifies whether te managed ProxySQL resources should be immediately save to disk.
Default value: true
manage_repo
Data type: Boolean
Determines whether this module will manage the repositories where ProxySQL might be.
Default value: true
version
Data type: Pattern[/^[1|2]\.\d+\.\d+/]
The version of proxysql being managed. This parameter affects the repository configured when manage_repo == true
and how the service is managed.
It does not affect the package version being installed. It is used as a hint to the puppet module on how to configure proxysql. To control the exact version
deployed, use package_name
or package_source
. Currently defaults to '2.0.7' or the value of the proxysql_version
fact.
Default value: $proxysql::params::version
package_source
Data type: Optional[String[1]]
location of a proxysql package. When specified, this package will be installed with the package\_provider
and the manage_repo
setting will be ignored.
Since version 4 of this module, this defaults to undef
and needs to be specified when you don't want to use a package from a repository.
Default value: undef
package_provider
Data type: Enum['dpkg','rpm']
provider for package_source
.
Default value: $proxysql::params::package_provider
package_checksum_value
Data type: Optional[String[1]]
The checksum of the package. Optional and only applicable when package_source
is provided.
Default value: undef
package_checksum_type
Data type: Optional[String[1]]
The 'type' of package_checksum_value
. Optional and only applicable when package_checksum_value
is provided.
Default value: undef
package_dependencies
Data type: Array[String[1]]
A list of packages which should be additionally installed.
Default value: $proxysql::params::package_dependencies
sys_owner
Data type: String
Owner of the datadir and config_file.
Default value: $version
sys_group
Data type: String
Group of the datadir and config_file.
Default value: $sys_owner
override_config_settings
Data type: Hash
Which configuration variables should be overriden.
Default value: {}
node_name
Data type: String
The name of the node.
Default value: "${facts['networking']['fqdn']}:${admin_listen_port}"
cluster_name
Data type: Optional[String[1]]
If set, proxysql_servers with the same cluster_name will be automatically added to the same cluster and will synchronize their configuration parameters.
Default value: undef
cluster_username
Data type: String
The username ProxySQL will use to connect to the configured mysql_clusters
Default value: 'cluster'
cluster_password
Data type: Sensitive[String]
The password ProxySQL will use to connect to the configured mysql_clusters.
Default value: Sensitive('cluster')
mysql_client_package_name
Data type: Optional[String]
The name of the mysql client package in your package manager.
Default value: undef
manage_hostgroup_for_servers
Data type: Boolean
Determines whether this module will manage hostgroup_id for mysql_servers. If false - it will skip difference in this value between manifest and defined in ProxySQL.
Default value: true
mysql_servers
Data type: Optional[Proxysql::Server]
Array of mysql_servers, that will be created in ProxySQL.
Default value: undef
mysql_users
Data type: Optional[Proxysql::User]
Array of mysql_users, that will be created in ProxySQL.
Default value: undef
mysql_hostgroups
Data type: Optional[Proxysql::Hostgroup]
Array of mysql_hostgroups, that will be created in ProxySQL.
Default value: undef
mysql_group_replication_hostgroups
Data type: Optional[Proxysql::GroupReplicationHostgroup]
Hash of mysql_group_replication_hostgroups, that will be created in ProxySQL.
Default value: undef
mysql_galera_hostgroups
Data type: Optional[Proxysql::GaleraHostgroup]
Hash of mysql_galera_hostgroups, that will be created in ProxySQL.
Default value: undef
mysql_rules
Data type: Optional[Proxysql::Rule]
Array of mysql_rules, that will be created in ProxySQL.
Default value: undef
schedulers
Data type: Optional[Proxysql::Scheduler]
Array of schedulers, that will be created in ProxySQL.
Default value: undef
split_config
Data type: Boolean
If set, ProxySQL config file will be split in 2: main config file with admin and mysql variables and proxy config file with servers\users\hostgroups\scheduler params.
Default value: false
proxy_config_file
Data type: String
The file where servers\users\hostgroups\scheduler\rules params of ProxySQL configuration are saved
This will only be configured if split_config
is set to true
.
Default value: '/etc/proxysql_proxy.cnf'
manage_proxy_config_file
Data type: Boolean
Determines whether this module will update the ProxySQL proxy configuration file.
Default value: true
Resource types
proxy_cluster
Manage a ProxySQL cluster.
Properties
The following properties are available in the proxy_cluster
type.
comment
Valid values: %r{[\w+]}
free form comment field.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
hostname
Valid values: %r{\w+}
The hostname of the server.
port
Valid values: %r{\d+}
The port of the server.
weight
Valid values: %r{\d+}
Currently unused, but in the roadmap for future enhancements.
Parameters
The following parameters are available in the proxy_cluster
type.
load_to_runtime
Valid values: true
, false
Load this entry to the active runtime.
Default value: true
name
namevar
name for cluster to manage.
provider
The specific backend to use for this proxy_cluster
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
save_to_disk
Valid values: true
, false
Perist this entry to the disk.
Default value: true
proxy_global_variable
Manage a ProxySQL global variable.
Properties
The following properties are available in the proxy_global_variable
type.
value
Valid values: %r{.+}
variable value
Parameters
The following parameters are available in the proxy_global_variable
type.
load_to_runtime
Valid values: true
, false
Load this entry to the active runtime.
Default value: true
name
namevar
variable name
provider
The specific backend to use for this proxy_global_variable
resource. You will seldom need to specify this --- Puppet
will usually discover the appropriate provider for your platform.
save_to_disk
Valid values: true
, false
Perist this entry to the disk.
Default value: true
proxy_mysql_galera_hostgroup
Manage a ProxySQL mysql_galera_hostgroup.
Properties
The following properties are available in the proxy_mysql_galera_hostgroup
type.
active
active
comment
Valid values: %r{[\w+]}
text field can be used to store any arbitrary data.
ensure
Valid values: present
, absent
Manage the state of this type.
Default value: present
max_transactions_behind
Maximum Transaction Galera Node out-of-sync
max_writers
Maximum Writers
writer_is_also_reader
A writer is also used for reading
Parameters
The following parameters are available in the proxy_mysql_galera_hostgroup
type.
backup_writer_hostgroup
Backup Writer hostgroup.
load_to_runtime
Valid values: true
, false
, yes
, no
Load this entry to the active runtime.
Default value: true
name
namevar
name to describe the hostgroup config
offline_hostgroup
Offline hostgroup.
provider
The specific backend to use for this proxy_mysql_galera_hostgroup
resource. You will seldom need to specify this ---
Puppet will usually discover the appropriate provider for your platform.
reader_hostgroup
Reader hostgroup.
save_to_disk
Valid values: true
, false
, yes
, no
Perist this entry to the disk.
Default value: true
writer_hostgroup
Writer hostgroup.
proxy_mysql_group_replication_hostgroup
Manage a ProxySQL mysql_group_replication_hostgroup.
Properties
The following properties are available in the proxy_mysql_group_replication_hostgroup
type.
active
Valid values: %r{[01]}
Active status.
backup_writer_hostgroup
Valid values: %r{\d+}
Backup writer hostgroup.
comment
Valid values: %r{[\w+]}
text field can be used to store any arbitrary data.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
max_transactions_behind
Valid values: %r{\d+}
Max transactions behind.
max_writers
Valid values: %r{[01]}
Max writers.
offline_hostgroup
Valid values: %r{\d+}
Offline hostgroup.
reader_hostgroup
Valid values: %r{\d+}
Reader hostgroup.
writer_hostgroup
Valid values: %r{\d+}
Writer hostgroup.
writer_is_also_reader
Valid values: %r{[01]}
Writer is also a reader.
Parameters
The following parameters are available in the proxy_mysql_group_replication_hostgroup
type.
load_to_runtime
Valid values: true
, false
Load this entry to the active runtime.
Default value: true
name
namevar
name to describe the hostgroup config
provider
The specific backend to use for this proxy_mysql_group_replication_hostgroup
resource. You will seldom need to specify
this --- Puppet will usually discover the appropriate provider for your platform.
save_to_disk
Valid values: true
, false
Perist this entry to the disk.
Default value: true
proxy_mysql_query_rule
Manage a ProxySQL mysql_query_rules entry.
Properties
The following properties are available in the proxy_mysql_query_rule
type.
active
Valid values: %r{[01]}
Is the rule active or not.
apply
Valid values: %r{[01]}
Used to chain rules.
cache_ttl
Valid values: %r{\d+}
The amount of miliseconds to cache the result of this query.
client_addr
Valid values: %r{\w+}
Match traffic from a certain address.
comment
Valid values: %r{[\w+]}
free form text field, usable for a descriptive comment of the query rule.
delay
Valid values: %r{\d+}
number of milliseconds to delay the execution of the query.
destination_hostgroup
Valid values: %r{\d+}
The hostgroup to send this query to.
digest
Valid values: %r{\w+}
match queries with a specific digest, as returned by stats_mysql_query_digest.digest
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
error_msg
Valid values: %r{\w+}
query will be blocked, and the specified error_msg will be returned to the client.
flag_in
Valid values: %r{\d+}
Used to chain rules. This is the id of the previous rule to apply
flag_out
Valid values: %r{\d+}
Used to chain rules. This is the id of the next rule to apply
log
Valid values: %r{[01]}
query will be logged.
match_digest
Valid values: %r{\w+}
regular expression that matches the query digest
match_pattern
Valid values: %r{\w+}
regular expression that matches the query text
mirror_flag_out
Valid values: %r{\d+}
see https://github.com/sysown/proxysql/blob/master/doc/mirroring.md
mirror_hostgroup
Valid values: %r{\d+}
see https://github.com/sysown/proxysql/blob/master/doc/mirroring.md.
negate_match_pattern
Valid values: %r{[01]}
if this is set to 1, only queries not matching the query text will be considered as a match. This acts as a NOT operator in front of the regular expression matching against match_pattern or match_digest.
proxy_addr
Valid values: %r{\w+}
Match incoming traffic on a specific local address.
proxy_port
Valid values: %r{\d+}
Match incoming traffic on a specific local port.
reconnect
Valid values: %r{[01]}
feature currently not in use.
replace_pattern
Valid values: %r{\w+}
this is the pattern with which to replace the matched pattern.
retries
Valid values: %r{\d+}
the maximum number of times a query needs to be re-executed in case of detected failure during the execution of the query.
rule_id
Valid values: %r{\d+}
The id of the query rule.
schemaname
Valid values: %r{\w+}
Schema to apply this rule to.
timeout
Valid values: %r{\d+}
The maximum amount of miliseconds in which the matched or rewritten query should be executed.
username
Valid values: %r{\w+}
Username to apply this rule to.
Parameters
The following parameters are available in the proxy_mysql_query_rule
type.
load_to_runtime
Valid values: true
, false
Load this entry to the active runtime.
Default value: true
name
namevar
query rule name
provider
The specific backend to use for this proxy_mysql_query_rule
resource. You will seldom need to specify this --- Puppet
will usually discover the appropriate provider for your platform.
save_to_disk
Valid values: true
, false
Perist this entry to the disk.
Default value: true
proxy_mysql_replication_hostgroup
Manage a ProxySQL mysql_replication_hostgroup.
Properties
The following properties are available in the proxy_mysql_replication_hostgroup
type.
comment
Valid values: %r{[\w+]}
text field can be used to store any arbitrary data.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
reader_hostgroup
Valid values: %r{\d+}
Reader hostgroup.
writer_hostgroup
Valid values: %r{\d+}
Writer hostgroup.
Parameters
The following parameters are available in the proxy_mysql_replication_hostgroup
type.
load_to_runtime
Valid values: true
, false
Load this entry to the active runtime.
Default value: true
name
namevar
name to describe the hostgroup config
provider
The specific backend to use for this proxy_mysql_replication_hostgroup
resource. You will seldom need to specify this
--- Puppet will usually discover the appropriate provider for your platform.
save_to_disk
Valid values: true
, false
Perist this entry to the disk.
Default value: true
proxy_mysql_server
Manage a ProxySQL mysql_server.
Properties
The following properties are available in the proxy_mysql_server
type.
comment
Valid values: %r{[\w+]}
text field that can be used for any purposed defined by the user. Could be a description of what the host stores, a reminder of when the host was added or disabled, or a JSON processed by some checker script.
compression
Valid values: %r{\d+}
if the value is greater than 0, new connections to that server will use compression
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
hostgroup_id
Valid values: %r{\d+}
The hostgroup of the server.
Default value: 0
hostname
Valid values: %r{\w+}
The hostname of the server.
Default value: localhost
max_connections
Valid values: %r{\d+}
the maximum number of connections ProxySQL will open to this backend server. Even though this server will have the highest weight, no new connections will be opened to it once this limit is hit. Please ensure that the backend is configured with a correct value of max_connections to avoid that ProxySQL will try to go beyond that limit
max_latency_ms
Valid values: %r{[\d+]}
ping time is regularly monitored. If a host has a ping time greater than max_latency_ms it is excluded from the connection pool (although the server stays ONLINE)
max_replication_lag
Valid values: %r{\d+}
if greater and 0, ProxySQL will reguarly monitor replication lag and if it goes beyond such threshold it will temporary shun the host until replication catch ups
port
Valid values: %r{\d+}
The port of the server.
Default value: 3306
status
Valid values: ONLINE
, SHUNNED
, OFFLINE_SOFT
, OFFLINE_HARD
Server status.
use_ssl
Valid values: %r{[01]}
if set to 1, connections to the backend will use SSL
weight
Valid values: %r{\d+}
the bigger the weight of a server relative to other weights, the higher the probability of the server to be chosen from a hostgroup
Parameters
The following parameters are available in the proxy_mysql_server
type.
load_to_runtime
Valid values: true
, false
Load this entry to the active runtime.
Default value: true
name
namevar
name for server to manage.
provider
The specific backend to use for this proxy_mysql_server
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
save_to_disk
Valid values: true
, false
Perist this entry to the disk.
Default value: true
proxy_mysql_server_no_hostgroup
Manage a ProxySQL mysql_server.
Properties
The following properties are available in the proxy_mysql_server_no_hostgroup
type.
comment
Valid values: %r{[\w+]}
text field that can be used for any purposed defined by the user. Could be a description of what the host stores, a reminder of when the host was added or disabled, or a JSON processed by some checker script.
compression
Valid values: %r{\d+}
if the value is greater than 0, new connections to that server will use compression
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
hostname
Valid values: %r{\w+}
The hostname of the server.
Default value: localhost
max_connections
Valid values: %r{\d+}
the maximum number of connections ProxySQL will open to this backend server. Even though this server will have the highest weight, no new connections will be opened to it once this limit is hit. Please ensure that the backend is configured with a correct value of max_connections to avoid that ProxySQL will try to go beyond that limit
max_latency_ms
Valid values: %r{[\d+]}
ping time is regularly monitored. If a host has a ping time greater than max_latency_ms it is excluded from the connection pool (although the server stays ONLINE)
max_replication_lag
Valid values: %r{\d+}
if greater and 0, ProxySQL will reguarly monitor replication lag and if it goes beyond such threshold it will temporary shun the host until replication catch ups
port
Valid values: %r{\d+}
The port of the server.
Default value: 3306
status
Valid values: ONLINE
, SHUNNED
, OFFLINE_SOFT
, OFFLINE_HARD
Server status.
use_ssl
Valid values: %r{[01]}
if set to 1, connections to the backend will use SSL
weight
Valid values: %r{\d+}
the bigger the weight of a server relative to other weights, the higher the probability of the server to be chosen from a hostgroup
Parameters
The following parameters are available in the proxy_mysql_server_no_hostgroup
type.
hostgroup_id
Valid values: %r{\d+}
The hostgroup of the server.
Default value: 0
load_to_runtime
Valid values: true
, false
Load this entry to the active runtime.
Default value: true
name
namevar
name for server to manage.
provider
The specific backend to use for this proxy_mysql_server_no_hostgroup
resource. You will seldom need to specify this
--- Puppet will usually discover the appropriate provider for your platform.
save_to_disk
Valid values: true
, false
Perist this entry to the disk.
Default value: true
proxy_mysql_user
Manage a ProxySQL mysql_user. This includes management of users password as well as privileges.
Properties
The following properties are available in the proxy_mysql_user
type.
active
Valid values: %r{[01]}
Is the user active or not.
backend
Valid values: %r{[01]}
Backend or not.
Default value: 1
default_hostgroup
Valid values: %r{\d+}
Default hostgroup for the user.
default_schema
Valid values: %r{\w+}
Default schema for the user.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
fast_forward
Valid values: %r{[01]}
Use fast forwrd or not.
frontend
Valid values: %r{[01]}
Frontend or not.
Default value: 1
max_connections
Valid values: %r{\d+}
Max concurrent connections for the user.
password
Valid values: %r{\w*}
The password of the user. You can use mysql_password() for creating a hashed password.
schema_locked
Valid values: %r{[01]}
Is the user locked in the default schema or not.
transaction_persistent
Valid values: %r{[01]}
Disable routing across hostgroups once a transaction has started for a specific user.
use_ssl
Valid values: %r{[01]}
Use ssl or not.
Parameters
The following parameters are available in the proxy_mysql_user
type.
encrypt_password
Valid values: true
, false
Encrypt the users password (requires ProxySQL setting admin-hash_password
= true
)
Default value: true
load_to_runtime
Valid values: true
, false
Load this entry to the active runtime.
Default value: true
name
namevar
The name of the user to manage.
provider
The specific backend to use for this proxy_mysql_user
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
save_to_disk
Valid values: true
, false
Perist this entry to the disk.
Default value: true
proxy_scheduler
Manage a ProxySQL scheduler entry.
Properties
The following properties are available in the proxy_scheduler
type.
active
Valid values: %r{[01]}
Is the scheduler active or not.
arg1
Valid values: %r{[\w+]}
optional argument to pass to the script.
arg2
Valid values: %r{[\w+]}
optional argument to pass to the script.
arg3
Valid values: %r{[\w+]}
optional argument to pass to the script.
arg4
Valid values: %r{[\w+]}
optional argument to pass to the script.
arg5
Valid values: %r{[\w+]}
optional argument to pass to the script.
comment
Valid values: %r{[\w+]}
optional comment.
ensure
Valid values: present
, absent
The basic property that the resource should be in.
Default value: present
filename
Valid values: %r{\w+}
Filename of the script to run. (required)
interval_ms
Valid values: %r{\d+}
How often (in millisecond) the job will be started.
scheduler_id
Valid values: %r{\d+}
The id of the scheduler entry.
Parameters
The following parameters are available in the proxy_scheduler
type.
load_to_runtime
Valid values: true
, false
Load this entry to the active runtime.
Default value: true
name
namevar
scheduler name
provider
The specific backend to use for this proxy_scheduler
resource. You will seldom need to specify this --- Puppet will
usually discover the appropriate provider for your platform.
save_to_disk
Valid values: true
, false
Perist this entry to the disk.
Default value: true
Data types
Proxysql::GaleraHostgroup
Represents an entry in the ProxySQL mysql_galera_hostgroups
admin table.
Alias of Array[Hash[String, Struct[{ writer => Integer[0], backup => Integer[0], reader => Integer[0], offline => Integer[0], Optional[active] => Integer[0,1], Optional[writers] => Integer[0], Optional[writer_is_reader] => Integer[0,2], Optional[max_transactions] => Integer[0], }],1,1]]
Proxysql::GroupReplicationHostgroup
Represents a ProxySQL group replication hostgroup.
Alias of Array[Hash[String, Struct[{ writer => Integer, backup => Integer, reader => Integer, offline => Integer, Optional[active] => Integer[0,1], Optional[writers] => Integer, Optional[writer_is_reader] => Integer[0,1], Optional[max_transactions] => Integer, }],1,1]]
Proxysql::Hostgroup
Represents a ProxySQL replication hostgroup.
Alias of Array[Hash[String, Struct[{ writer => Integer, reader => Integer, }],1,1]]
Proxysql::Scheduler
Represents a ProxySQL scheduler
Alias of Array[Hash[String, Struct[{ scheduler_id => Integer, active => Integer, Optional[interval_ms] => Integer, filename => String[1], Optional[arg1] => String[1], Optional[arg2] => String[1], Optional[arg3] => String[1], Optional[arg4] => String[1], Optional[arg5] => String[1] }],1,1]]
Proxysql::Server
Represents a ProxySQL server.
Alias of Array[Hash[String, Struct[{ Optional[port] => Integer, hostgroup_id => Integer, Optional[status] => String[1], Optional[weight] => Integer, Optional[compression] => Integer, Optional[max_connections] => Integer, Optional[max_replication_lag] => Integer, Optional[use_ssl] => Integer[0,1], Optional[max_latency_ms] => Integer, Optional[comment] => String[1], }],1,1]]
Proxysql::User
Represents a ProxySQL user.
Alias of Array[Hash[String, Struct[{ password => String[1], default_hostgroup => Integer, Optional[active] => Integer[0,1], Optional[use_ssl] => Integer[0,1], Optional[default_schema] => String[1], Optional[schema_locked] => Integer[0,1], Optional[transaction_persistent] => Integer[0,1], Optional[fast_forward] => Integer[0,1], Optional[backend] => Integer[0,1], Optional[frontend] => Integer[0,1], Optional[max_connections] => Integer, }],1,1]]
Changelog
All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module.
v6.0.0 (2021-06-14)
Breaking changes:
- Drop EoL Ubuntu 16.04 support #170 (bastelfreak)
- Drop EoL Debian 8 support #169 (bastelfreak)
- Drop EoL Puppet 5 support #168 (bastelfreak)
- Drop EoL CentOS from metadata.json #167 (bastelfreak)
Implemented enhancements:
- Enable Puppet 7 support #171 (bastelfreak)
- puppetlabs/apt: Allow 8.x #165 (bastelfreak)
- puppetlabs/stdlib: Allow 7.x #163 (bastelfreak)
- camptocamp/systemd: allow 3.x #162 (bastelfreak)
Merged pull requests:
- puppetlabs/mysql: Allow 12.x #164 (bastelfreak)
- Add puppet-strings docs #156 (baurmatt)
- Move static defaults out of params.pp #155 (alexjfisher)
v5.1.0 (2020-09-01)
Implemented enhancements:
- Add ability to configure errorlog file path and mode #153 (Anirudhra10)
Merged pull requests:
- Release 5.1.0 version #154 (Anirudhra10)
v5.0.3 (2020-08-25)
Implemented enhancements:
- Introduce
manage_mysql_client
boolean to toggle whether or not to include mysql::client #149 (walkleyn) - Add support for changing stat user's credentials #145 (Goorzhel)
v5.0.2 (2020-05-23)
Fixed bugs:
- Fixup Amazon 2016 issues #148 (alexjfisher)
- provider: explicitly stringify output of mysql query #142 (SimonPe)
- Stop creating spurious files #141 (saz)
Merged pull requests:
v5.0.1 (2020-03-05)
Fixed bugs:
- ProxySQL 2 gets restarted as root #134
- Use distinct names for yum repos #138 (alexjfisher)
Closed issues:
Merged pull requests:
- Avoid reloading proxysql 2 as root #135 (alexjfisher)
v5.0.0 (2019-12-18)
Breaking changes:
- drop Ubuntu 14.04 support #123 (bastelfreak)
Implemented enhancements:
- Manage SELinux rules to allow logrotate to work #126 (alexjfisher)
Merged pull requests:
- Run acceptance tests on CentOS 7.6 #129 (alexjfisher)
- Remove default
config_settings
from params.pp #128 (alexjfisher) - Remove duplicate CONTRIBUTING.md file #124 (dhoppe)
- Replace
anchor
pattern withcontain
#122 (alexjfisher)
v4.0.0 (2019-11-06)
Breaking changes:
- Replace
repo_version
withversion
, default to installing ProxySQL 2 and fixrestart => true
#116 (alexjfisher) - Don't install from github when
manage_repo
is false and remove unusedrepo
parameter #112 (alexjfisher)
Implemented enhancements:
- Add debian 10 support #119 (alexjfisher)
- Add
proxysql_runtime
fact #117 (alexjfisher)
Fixed bugs:
- Service management broken with ProxySQL 2 when
restart => true
#115 - Bugfix: Make classes dependent on the mysql package #113 (theosotr)
Closed issues:
- Debian 10 Buster support #114
Merged pull requests:
v3.1.0 (2019-07-17)
Implemented enhancements:
- Add
datadir_mode
parameter #109 (alexjfisher)
v3.0.0 (2019-07-09)
Breaking changes:
- modulesync 2.5.1 & drop Puppet 4 #86 (bastelfreak)
Implemented enhancements:
- Add proxy_mysql_galera_hostgroup type #103 (alexjfisher)
- Added the ability to forcibly set NULL for fields in settings proxy_mysql_query_rule #98 (identw)
- add repo for 2.0.x #94 (kubicgruenfeld)
- Support for Group Replication Hostgroups #68 (CyberLine)
Fixed bugs:
- Fix
Proxysql::GroupReplicationHostgroup
type #105 (alexjfisher) - Fix and refactor install.pp relationships #93 (alexjfisher)
- Bugfix: Add missing dependencies #91 (theosotr)
- fix bug in types that int[0,1] were boolean #81 (MaxFedotov)
Closed issues:
- Ubuntu 18.04 Bionic Beaver support #75
- Installation failure on deb 9.5 #69
- readd stdlib dependency; bump mysql/apt dependency #65
Merged pull requests:
- Allow puppetlabs/stdlib 6 and puppetlabs/mysql 10 #107 (alexjfisher)
- Fix RedHat yum repo baseurls #106 (alexjfisher)
- readd stdlib module; allow puppetlabs/mysql 8.x #104 (bastelfreak)
- Support Ubuntu 18.04 with proxysql 2.0 #102 (alexjfisher)
- Allow puppetlabs/apt 7.x #100 (dhoppe)
- Fix
Proxysql::User
data type to match what's expected byproxy_mysql_user
resource type #88 (CyberLine) - Allow puppetlabs-mysql 7.x #87 (ekohl)
- modulesync 2.2.0 and allow puppet 6.x #79 (bastelfreak)
- Minor doc update #73 (mcrauwel)
- Update Readme me and add a link to our CoC #72 (mcrauwel)
- implemented more extensive acceptance tests than just "include proxysql" #71 (mcrauwel)
- allow puppetlabs/apt 6.x #70 (bastelfreak)
v2.0.0 (2018-09-10)
Breaking changes:
Implemented enhancements:
- Enable acceptance tests on travis; add debian 9 support #64 (bastelfreak)
- Allow puppetlabs/stdlib 5.x, puppetlabs/apt 6.x and puppetlabs/mysql 6.x #63 (bastelfreak)
- Support to add resource via class parameters. Add manage_hostgroup_fo… #62 (MaxFedotov)
- add ability to split config into 2 files #60 (MaxFedotov)
- Declare passwords as Sensitive #51 (jfroche)
- Adding Repo Management for Centos, Redhat, LinuzAmazon #16 (alexvaque)
Fixed bugs:
- Proxysql on Debian should now run under the proxysql user account #43
- Default weight 0 causes issue #28
- Module push 'OFFLINE_SOFT' back online #25
- changing the admin-admin_credentials results in failing puppet runs #22
- Unwrap passwords before writing to file #53 (jjspark)
- Override all settings #52 (jjspark)
- Fixed managing admin credentials #34 (mcrauwel)
- proxy_mysql_server needs a default for status in order for the insert to succeed #33 (mcrauwel)
Closed issues:
- puppet 5 compatibility (bump dependencies for puppetlabs-apt to something more modern) #66
- New versions of proxysql #38
- Please, could you add a release/tag for new RPM features? #29
- Mysql query rule changed #24
- Ubuntu support #20
Merged pull requests:
- add support for Proxysql cluster #58 (MaxFedotov)
- Remove docker nodesets #50 (bastelfreak)
- drop EOL OSs; fix puppet version range #48 (bastelfreak)
- bump puppet to latest supported version 4.10.0 #46 (bastelfreak)
- bump puppet version dependency to >= 4.7.1 \< 6.0.0 #40 (bastelfreak)
- fixed doc error #36 (mcrauwel)
- fixed parsing of prefetched data (fix #24) #30 (mcrauwel)
- config file: owner and group configurable (fix) #27 (FrankVanDamme)
- Fixes for ubuntu support #23 (mcrauwel)
- Fix contributors typo #21 (rgomezcasas)
- Deleting non UTF8-char #18 (narcisbcn)
- Add option to define install options #15 (jfroche)
v1.1.2 (2017-02-12)
Implemented enhancements:
Merged pull requests:
v1.1.1 (2017-02-12)
v1.1.0 (2017-02-11)
Fixed bugs:
- Unable to publish to forge because of vendor/ #10
Merged pull requests:
- Gitignore ruby version #9 (mcrauwel)
- [release testing] #8 (bastelfreak)
- proper Markdown formatting for release regex to pass #7 (mcrauwel)
- create 1.1.0 release #6 (mcrauwel)
- update metadata to point to voxpupuli repo #5 (mcrauwel)
- updated docs #3 (mcrauwel)
- manage repo's #2 (mcrauwel)
1.0.0 (2017-02-07)
Merged pull requests:
* This Changelog was automatically generated by github_changelog_generator
Dependencies
- puppetlabs-mysql (>= 2.5.0 < 12.0.0)
- puppetlabs-apt (>= 2.1.0 < 9.0.0)
- puppetlabs-stdlib (>= 5.2.0 < 8.0.0)
- puppet-extlib (>= 2.1.0 < 6.0.0)
- camptocamp-systemd (>= 1.1.0 < 4.0.0)
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.