溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

K8S 配置mysql配置文件不生效問題處理

發(fā)布時間:2020-06-18 12:11:05 來源:網(wǎng)絡(luò) 閱讀:848 作者:槑槑的嫑嫑 欄目:云計算

平臺使用Rancher 2.x

問題原因是,一個測試用的mysql需要開啟binlog日志,我想著這個不是挺簡單的嘛~

于是,配置了一個config,掛載到對應(yīng)的mysql配置文件下,然后重新部署一下~
然而進(jìn)容器一看,配置文件是掛載上了,可是配置卻未生效。。

具體如下:

1、因為使用Rancher平臺,所以配置及掛載這一步是在web端進(jìn)行的(禍根。)。

即添加一個configmap,覆蓋掉原配置文件:

#開啟binlog日志的配置文件~

[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /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 risks
symbolic-links=0
log-bin=/var/lib/mysql/mysql-bin
server-id=1

掛載到mysql的/etc/mysql/mysql.conf.d/下,覆蓋掉mysqld.cnf

2、然鵝并沒生效,配置文件確實掛載了,有點懷疑人生...
3、于是修改其他配置,修改其他配置查看是不是binlog配置問題(懷疑人生。)
即隨便修改了下datadir的路徑:

[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /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 risks
symbolic-links=0
log-bin=/var/lib/mysql/mysql-bin
server-id=1

4、然后發(fā)現(xiàn)配置文件依然掛載了,這個也沒生效?。?!
5、查看yaml文件,如下:

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

查看configMap的defaultMode:
kubectl explain deployment.spec.template.spec.volumes.configmag

defaultMode <integer>
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、對照查看,發(fā)現(xiàn)Rancher默認(rèn)模式為400,修改成644后,重新部署~可以了!

之前nginx的配置使用默認(rèn)模式400可以生效,mysql的配置文件并不可以~

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI