我要评分
获取效率
正确性
完整性
易理解

Preparing the MySQL Configuration File

If an independent drive needs to be mounted for the MySQL database, you can mount a drive to the /data or /data/mysql directory on each physical machine. This document uses three physical machines as an example.

In this document, the /etc/my.cnf files in pods mysql-1, mysql-2, and mysql-3 are mapped to /data/mysql/mysql_1/mysql_arm.cnf, /data/mysql/mysql_2/mysql_arm.cnf, and /data/mysql/mysql_3/mysql_arm.cnf on the physical machine in the YAML file, respectively.

  1. Create a /data/mysql/mysql_1/mysql_arm.cnf file on the physical machine where the mysql-1 pod is deployed.
    1
    2
    mkdir -p /data/mysql/mysql_1
    vim /data/mysql/mysql_1/mysql_arm.cnf
    
  2. Press i to enter the insert mode and edit the file:
    [mysqld_safe]
    log-error=/data/mysql/log/mysql.log
    pid-file=/data/mysql/run/mysqld.pid
     
    [client]
    socket=/data/mysql/run/mysql.sock
    default-character-set=utf8
     
    [mysqld]
    log-error=/data/mysql/log/mysql.log
    pid-file=/data/mysql/run/mysqld.pid
    socket=/data/mysql/run/mysql.sock
    tmpdir=/data/mysql/tmp
    datadir=/data/mysql/data
    default_authentication_plugin=mysql_native_password
    port=3306
    user=root
    #innodb_page_size=4k
    disabled_storage_engines=MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY
     
    max_connections=2000
    back_log=4000
    performance_schema=OFF
    max_prepared_stmt_count=128000
    #transaction_isolation=READ-COMMITTED
    sql_mode=STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION,NO_AUTO_VALUE_ON_ZERO,STRICT_ALL_TABLES
  3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Perform the preceding operations on the nodes where the mysql-2 and mysql-3 pods are located to edit the /data/mysql/mysql_2/mysql_arm.cnf and /data/mysql/mysql_3/mysql_arm.cnf files. The original content of the files is the same as that of the /data/mysql/mysql_1/mysql_arm.cnf file.