manala.maxscale
#######################################################################################################
:exclamation: 已弃用 :exclamation:
此代码库及相关角色已被弃用,建议使用 Manala Ansible Collection
您可以在 集合代码库 上找到使用信息
#######################################################################################################
Ansible 角色:Maxscale 
:exclamation: 报告问题 和 发送拉取请求 到 主 Ansible 角色代码库 :exclamation:
此角色用于设置和配置 Maxscale。
它是 Manala Ansible 堆栈 的一部分,但也可以作为独立组件使用。
需求
此角色需与 mariadb maxscale 的 Debian 包配合使用,您可以在 mariadb maxscale 代码库 中找到它们。请使用 manala.apt 角色来正确处理它。
manala_apt_preferences:
- maxscale@maxscale_2_4
依赖
无。
安装
Ansible 2+
使用 ansible galaxy 命令行:
ansible-galaxy install manala.maxscale
使用 ansible galaxy 需求文件:
- src: manala.maxscale
角色处理程序
名称 | 类型 | 描述 |
---|---|---|
maxscale restart |
服务 | 重启 Maxscale 服务 |
角色变量
名称 | 默认值 | 类型 | 描述 |
---|---|---|---|
manala_maxscale_install_packages |
~ | 数组 | 要安装的依赖包 |
manala_maxscale_install_packages_default |
['maxscale'] | 数组 | 默认的依赖包 |
manala_maxscale_config_file |
'/etc/maxscale.cnf' | 字符串 | 配置文件路径 |
manala_maxscale_config_template |
'config/_default.j2' | 字符串 | 默认配置模板路径 |
manala_maxscale_config |
~ | 数组/字符串 | 配置 |
manala_maxscale_configs_exclusive |
false | 布尔值 | 配置的独占性 |
manala_maxscale_configs_dir |
'{{ manala_maxscale_config_file }}.d' | 字符串 | 配置目录路径 |
manala_maxscale_configs_defaults |
{} | 数组 | 默认配置模板路径 |
manala_maxscale_configs |
[] | 数组 | 配置 |
manala_maxscale_users_file |
'/var/lib/maxscale/passwd' | 字符串 | 用户文件路径 |
manala_maxscale_users_template |
'users/_default.j2' | 字符串 | 默认用户模板路径 |
manala_maxscale_network_users |
~ | 数组 | 网络用户(如果为空则不修改) |
配置示例(Galera 集群配置)
配置模板
manala_maxscale_config_template: maxscale/custom_template.j2
基于内容的配置
manala_maxscale_config: |
[maxscale]
max_auth_errors_until_block = 0
[admin]
type = service
router = cli
基于字典数组的配置(已弃用)
manala_maxscale_config:
- maxscale:
- threads: auto #专用容器
- Splitter Service:
- type: service
- router: readwritesplit
- servers: mariadb-1, mariadb-2, mariadb-3
- user: maxscale
- passwd: XXXXXXXXXXXXXX
- Splitter Listener:
- type: listener
- address: "{{ ansible_eth0.ipv4.address }}" # 主机的 IP,可以省略,默认为监听所有接口
- port: 3306
- socket: /tmp/ClusterMaster
- service: Splitter Service
- protocol: MySQLClient
- mysql-1:
- type: server
- address: 172.16.X.XX
- port: 3306
- protocol: MySQLBackend
- mysql-2:
- type: server
- address: 172.16.X.XX
- port: 3306
- protocol: MySQLBackend
- mysql-3:
- type: server
- address: 172.16.X.XX
- port: 3306
- protocol: MySQLBackend
- Galera Monitor:
- type: monitor
- module: galeramon
- servers: mariadb-1, mariadb-1, mariadb-1
- user: maxscale
- passwd: XXXXXXXXXXX
- CLI:
- type: service
- router: cli
- CLI Listener:
- type: listener
- service: CLI
- protocol: maxscaled
- address: localhost
- port: 6603
配置
manala_maxscale_configs_exclusive: true
manala_maxscale_configs:
# 基于内容
- file: foo.cnf
config: |
[foo-1]
type = server
address = foo-1
port = 3306
protocol = MariaDBBackend
# 基于字典数组(已弃用)
- file: bar.cnf
config:
- foo-1:
- type: server
- address: foo-1
- port: 3306
- protocol: MariaDBBackend
# 字典数组(已弃用)
- file: bar.cnf
config:
- foo-1:
- type: server
- address: foo-1
- port: 3306
- protocol: MariaDBBackend
# 模板 cnf
- file: template.cnf
template: my_maxscale_template.cnf.j2
config:
Foo: bar
# 确保配置不存在
- file: absent.cnf
state: absent # 默认为 "present"
# 忽略配置
- file: ignore.cnf
state: ignore
# 扁平配置
- "{{ my_custom_configs_array }}"
用户
manala_maxscale_network_users:
- name: foo
password: $1$MXS$ilOCSZPnjmHjTz6B96SiJ1 # "foo"(由 maxpasswd 生成)
- name: bar
password: $1$MXS$M.YZOr2pNTgW87l7KQWLU/ # "bar"(由 maxpasswd 生成)
示例剧本
- hosts: servers
roles:
- role: manala.maxscale
许可证
MIT
作者信息
Manala (http://www.manala.io/)
关于项目
Installation and configuration of Maxscale (MySQL/MariaDB Proxy)
安装
ansible-galaxy install manala.maxscale
许可证
Unknown
下载
3.5k
拥有者
Manala is an open source project supported by the french web agency ELAO providing advanced ansible roles for website's infrastructures and far more.