2017-08-23 58 views
0

我想分配更多的內存到我的MariaDB服務器,但我有困難找到正確的my.cnf文件。Mariadb配置分配的內存

基本上我想要編輯的innodb_buffer_pool_size

這是my.cnf文件的/etc/my.cnf中

[mysqld] 
    bind-address = :: 
    skip_name_resolve 
    local-infile=0 
    datadir=/var/lib/mysql 
    socket=/var/lib/mysql/mysql.sock 
    # Disabling symbolic-links is recommended to prevent assorted security risks 
    symbolic-links=0 
    # Settings user and group are ignored when systemd is used. 
    # If you need to run mysqld under a different user or group, 
    # customize your systemd unit file for mariadb according to the 
    # instructions in http://fedoraproject.org/wiki/Systemd 

    [mysqld_safe] 
    log-error=/var/log/mariadb/mariadb.log 
    pid-file=/var/run/mariadb/mariadb.pid 

    # 
    # include all files from the config directory 
    !includedir /etc/my.cnf.d 

內容所以我開始檢查在/ etc中的文件/ my.cnf.d爲innodb_buffer_pool_size值,但大多數文件幾乎爲空。

我應該只添加一個我喜歡的值的字符串嗎?或者我看錯了地方?

使用的Plesk 17.5.3#18的CentOS 7和MariaDB的25年1月10日

希望有人能幫助我在這一個。

我加入了inno_db_buffer_size到my.cnf文件的建議,但磨片

嗨,我調整了值,並重新啓動該服務,但是當我運行: https://github.com/major/MySQLTuner-perl 它給了我下面的輸出:

嗨,我調整了值,並重新啓動該服務,但是當我運行: https://github.com/major/MySQLTuner-perl 它給了我下面的輸出:

Set thread_cache_size to 4 as a starting value 
    Performance should be activated for better diagnostics 
    Consider installing Sys schema from https://github.com/mysql/mysql-sys 
Variables to adjust: 
    query_cache_size (=0) 
    query_cache_type (=0) 
    query_cache_limit (> 1M, or use smaller result sets) 
    join_buffer_size (> 256.0K, or always use indexes with joins) 
    tmp_table_size (> 16M) 
    max_heap_table_size (> 16M) 
    thread_cache_size (start at 4) 
    performance_schema = ON enable PFS 
    innodb_buffer_pool_size (>= 139M) if possible. 
    innodb_log_file_size should be (=16M) if possible, so InnoDB total log files size equals to 25% of buffer pool size. 
    innodb_buffer_pool_instances (=1) 

在我看來,即使我調整了價值,也沒有反映出來。 我該如何檢查?

回答

0

沒關係,您沒有看到innodb_buffer_pool_size。大多數MySQL參數未在/etc/my.cnf中定義,而數據庫服務器使用默認參數。對於innodb_buffer_pool_size它是128M。
要設置此值不同,請在/etc/my.cnf[mysqld]中對其進行定義。例如innodb_buffer_pool_size = 512M

+0

感謝您的意見,我調整了它,但沒有反映,請參閱我的問題中的補充內容。提前致謝! – Glenn

+0

更新'/ etc/my.cnf'後應重新啓動數據庫服務器。要檢查設置了什麼值登錄到數據庫服務器並運行'SELECT @@ innodb_buffer_pool_size/1024/1024;' –

+0

我甚至重新啓動整個服務器只是爲了確保,但沒有改變。 我檢查了etc/my.cnf.d中的所有.cnf文件,但innodb_buffer_pool_size僅在/etc/my.cnf(因爲我放在那裏)中聲明爲: innodb_buffer_pool_size = 1G – Glenn