Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wondering how to make changes like datadir (and some more overrides)... #235

Open
kkplein opened this issue Nov 18, 2024 · 2 comments
Open

Comments

@kkplein
Copy link

kkplein commented Nov 18, 2024

This is my first use of roles, so far I've only written ansible playbooks without roles, and they are great! Thank you, for making this galera role available.

I added vars for almalinux-9, and I changed some bits to be able to use the stock mariadb-galera packages instead of the external MariaDB repo, and it all works so nice, and I've learned so much while doing it. Thank you!

Now my two small requests for some help.

  1. I am trying to make some small changes to the generated galera install, like datadir=/data/mysql, and no matter where I change it, it always goes to /var/lib/mysql. How to do this? (i've tried ./defaults/mail.yml, ./templates/mysql/my.cnf.j2, i've tried setting "mariadb_mysql_settings_datadir=/data/mysql" in my inventory... nothing has any effect. How to do this?

  2. I see the logic exists to create overides (./etc/mariadb_overrides.cnf.j2:{% for group, settings in mariadb_config_overrides.items() %}). How to make use of that..? What do I set, and where to best set it?

Probably the answer to both questions is related, and it's something I am missing and regular seasoned ansible role users know.

I would appreciate some short pointers. (or simple: links to working production examples that do these things, so I can learn from just reading those)

Again: thanks for making this role available!

@kkplein
Copy link
Author

kkplein commented Nov 18, 2024

Meanwhile I have discovered how to achieve overrides. Using group_vars I was able to add mariadb_config_overrides to my inventory, and they are parsed and used.

But doing the same for mariadb_mysql_settings has no effect, unfortunately:

mariadb_mysql_settings:
  datadir: "/data/mysql"
  key_buffer_size: "{{ (ansible_memtotal_mb | int * mariadb_mysql_mem_multiplier) | round | int }}M"
  log_error: "/data/log/mysql/error.log"
  max_allowed_packet: "16M"
  max_binlog_size: "100M"
  query_cache_limit: "1M"
  query_cache_size: "16M"
  thread_cache_size: 256

mariadb_config_overrides:
  mariadb:
    max_connections: 2048
    innodb_buffer_pool_size: "1G"
    query_cache_size: "64M"
    wsrep_notify_cmd: "/usr/local/bin/wsrep_notify.sh"

@kkplein
Copy link
Author

kkplein commented Nov 25, 2024

Alas, no help. :-(

I have now edited the two templates from the role (etc/my.cnf.d/server.cnf.j2 and server.cnf.temp.j2) to include this code:

{% for group, settings in mariadb_mysql_settings.items() %}

[{{ group }}]
{% for key, value in settings.items() %}
{{ key }} = {{ value }}
{% endfor %}

{% endfor %}

That works for us. Not sure why the regular galaxy-installed version of the script seems to ignore the values in mariadb_mysql_settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant