Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

K8S configuration mysql configuration file does not take effect problem handling

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

The platform uses Rancher 2.x

The reason for the problem is that a test mysql needs to open the binlog log. I think this is quite simple.

So, configure a config, mount it to the corresponding mysql configuration file, and then redeploy ~

However, when you enter the container, you can see that the configuration file is mounted, but the configuration does not take effect.

The details are as follows:

1. Because the Rancher platform is used, the step of configuration and mount is carried out on the web side (the bane. ).

That is, add a configmap to overwrite the original configuration file:

# Open the configuration file of binlog log ~

[mysqld] pid-file = / var/run/mysqld/mysqld.pidsocket = / var/run/mysqld/mysqld.sockdatadir = / var/lib/mysql#log-error = / var/log/mysql/error.log#By default we only accept connections from localhost#bind-address = 127.0.0.1#Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0log-bin=/var/lib/mysql/mysql-binserver-id=1

Mount it to / etc/mysql/mysql.conf.d/ of mysql and overwrite mysqld.cnf

2, but the goose did not take effect, the configuration file was indeed mounted, a little skeptical about life.

3. Modify other configurations to see if it is a binlog configuration problem (doubt Life). )

That is, you randomly modify the path of the datadir:

[mysqld] pid-file = / var/run/mysqld/mysqld.pidsocket = / var/run/mysqld/mysqld.sockdatadir = / home/mysql#log-error = / var/log/mysql/error.log#By default we only accept connections from localhost#bind-address = 127.0.0.1#Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0log-bin=/var/lib/mysql/mysql-binserver-id=1

4. Then I found that the configuration file was still mounted, and this did not take effect!

5. View the yaml file as follows:

-configMap: defaultMode: 292 name: mysql-config optional: false name: vol1

Check the defaultMode of configMap:

Kubectl explain deployment.spec.template.spec.volumes.configmag

DefaultMode

Optional: mode bits to use on created files by default. Must be a value

Between 0 and 0777. Defaults to 0644. Directories within the path are not

Affected by this setting. This might be in conflict with other options that

Affect the file mode, like fsGroup, and the result can be other mode bits

Set.

6. By comparison, it is found that the default mode of Rancher is 400. after being modified to 644, it is OK to redeploy!

The previous configuration of nginx can take effect using the default mode 400, but the configuration file of mysql cannot ~

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report