Minion data cache plugin for MySQL database.
New in version 2018.3.0.
It is up to the system administrator to set up and configure the MySQL infrastructure. All is needed for this plugin is a working MySQL server.
Warning
The mysql.database and mysql.table_name will be directly added into certain queries. Salt treats these as trusted input.
The module requires the database (default salt_cache
) to exist but creates
its own table if needed. The keys are indexed using the bank
and
etcd_key
columns.
To enable this cache plugin, the master will need the python client for MySQL installed. This can be easily installed with pip:
pip install pymysql
Optionally, depending on the MySQL agent configuration, the following values could be set in the master config. These are the defaults:
mysql.host: 127.0.0.1
mysql.port: 2379
mysql.user: None
mysql.password: None
mysql.database: salt_cache
mysql.table_name: cache
Related docs can be found in the python-mysql documentation.
To use the mysql as a minion data cache backend, set the master cache
config
value to mysql
:
cache: mysql
Checks if the specified bank contains the specified key.
Fetch a key value.
Remove the key from the cache bank with all the key content.
Force a reconnection to the MySQL database, by removing the client from Salt's __context__.
Return an iterable object containing all entries stored in the specified bank.
Get a cursor and run a query. Reconnect up to retries
times if
needed.
Returns: cursor, affected rows counter
Raises: SaltCacheError, AttributeError, OperationalError
Store a key value.
Return the integer Unix epoch update timestamp of the specified bank and key.