[MDEV-26444] defaults-group-suffix not working for /etc/my.cnf.d mysqld configuration files Created: 2021-08-20  Updated: 2021-08-24  Resolved: 2021-08-24

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.5.9
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Oleg Sladkoff Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

CentOS Linux release 8.4.2105



 Description   

Hi,
I am configuring multiple mariadb instances.

I created a /etc/my.cnf.d/instance1.cnf :

[mysqld.inst1]
datadir = /opt/data/mariadb/inst1
socket = /var/lib/mysql/mysql-inst1.sock
pid-file = /run/mariadb/mariadb-inst1.pid
port = 3301
innodb_file_per_table = 1

And I also created an instance2 in /etc/my.cnf

[mysqld.inst2]
datadir = /opt/data/mariadb/inst2
socket = /var/lib/mysql/mysql-inst2.sock
pid-file = /run/mariadb/mariadb-inst2.pid
port = 3302
innodb_file_per_table = 1

It looks like only instance 2 is working as expected ( the one in /etc/my.cnf )

I tried :

]# /usr/bin/my_print_defaults --defaults-group-suffix=.inst2 mysqld
--datadir=/var/lib/mysql
--socket=/var/lib/mysql/mysql.sock
--log-error=/var/log/mariadb/mariadb.log
--pid-file=/run/mariadb/mariadb.pid
--bind_address=0.0.0.0
--datadir=/opt/data/mariadb/inst2
--socket=/var/lib/mysql/mysql-inst2.sock
--pid-file=/run/mariadb/mariadb-inst2.pid
--port=3302
--innodb_file_per_table=1

and

]# /usr/bin/my_print_defaults --defaults-group-suffix=.inst1 mysqld
--datadir=/opt/data/mariadb/inst1
--socket=/var/lib/mysql/mysql-inst1.sock
--pid-file=/run/mariadb/mariadb-inst1.pid
--port=3301
--innodb_file_per_table=1
--datadir=/var/lib/mysql
--socket=/var/lib/mysql/mysql.sock
--log-error=/var/log/mariadb/mariadb.log
--pid-file=/run/mariadb/mariadb.pid
--bind_address=0.0.0.0

It looks like /usr/bin/my_print_defaults is picking up the /etc/my.cnf.d/mariadb-server.cnf [mysqld] section , because when I removed it from the file it works.

I assume /usr/bin/my_print_defaults --defaults-group-suffix=.inst1 should only pick up [mysqld.inst1] sections ...

Thanks for having a look at this potential issue !

Best regards
Oleg



 Comments   
Comment by Daniel Black [ 2021-08-20 ]

Do you perhaps mean to use:

/usr/bin/my_print_defaults --defaults-group-suffix=.inst1 --mysqld

So --mysqld as a option rather than mysqld as a group name?

Comment by Oleg Sladkoff [ 2021-08-20 ]

Thanks Daniel you are right .

I tried with the --mysqld option , but still have the same issue

]# /usr/bin/my_print_defaults --defaults-group-suffix=.inst1 --mysqld
--datadir=/opt/data/mariadb/inst1
--socket=/var/lib/mysql/mysql-inst1.sock
--pid-file=/run/mariadb/mariadb-inst1.pid
--port=3301
--datadir=/var/lib/mysql
--socket=/var/lib/mysql/mysql.sock
--log-error=/var/log/mariadb/mariadb.log
--pid-file=/run/mariadb/mariadb.pid
--bind_address=0.0.0.0

Hope that helps understanding my issue

Oleg

Comment by Daniel Black [ 2021-08-20 ]

Thanks for checking that. It helps, and is understandable

Comment by Sergei Golubchik [ 2021-08-24 ]

I hope I understood the issue correctly. If not — please, comment and I'll reopen

See https://mariadb.com/kb/en/configuring-mariadb-with-option-files/#option-groups it says that --defaults-group-suffix=suffix means

In addition to the default option groups, also read option groups with the given suffix.

So, [mysqld] is always read. And in addition [mysqld.inst1] will be read too.

Normally you're supposed to use [mysqld] group for settings common to all servers. Like innodb_file_per_table=1. And use per-instance suffix for settings specific for this instance.

Generated at Thu Feb 08 09:45:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.