powered by simpleCommunicator - 2.0.61     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / MySQL [игнор отключен] [закрыт для гостей] / Оптимизация mysql my.cnf
6 сообщений из 6, страница 1 из 1
Оптимизация mysql my.cnf
    #38764621
rafaello7
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Здравствуйте!
В интернете раскопал информацию о том, что файл конфигурации mysql my.cnf можно перенастраивать в зависимости от характеристик сервера, куда установлен mysql.
Согласно характеристикам моего сервера мне подходит образец my-huge.cnf
Кстати, в мануале написано, что его надо искать в /usr/share/mysql
Но я нашел его в /usr/share/doc/mysql-server-5.5/examples
А в /usr/share/mysql лежало config.huge.ini
Вот настройки моего сервера
Код: html
1.
2.
3.
4.
5.
6.
Real memory - 2GB guaranteed
Virtual memory - 2Gb total
MySQL версии 5.5.38
В MySQL System Variables
storage_engine    InnoDB
default_storage_engine    InnoDB	



Вот файл по умолчанию
my.cnf
Код: html
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port      = 3306
socket      = /var/run/mysqld/mysqld.sock
default-character-set=utf8

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice      = 0

[mysqld]
innodb_file_per_table
#
# * Basic Settings
#
user      = mysql
pid-file   = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port      = 3306
basedir      = /usr
datadir      = /var/lib/mysql
tmpdir      = /tmp
lc-messages-dir   = /usr/share/mysql
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address      = 127.0.0.1
#
# * Fine Tuning
#
key_buffer      = 16M
max_allowed_packet   = 16M
thread_stack      = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit   = 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# Here you can see queries with especially long duration
#log_slow_queries   = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id      = 1
#log_bin         = /var/log/mysql/mysql-bin.log
expire_logs_days   = 10
max_binlog_size         = 100M
#binlog_do_db      = include_database_name
#binlog_ignore_db   = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem
character-set-server=utf8
collation-server=utf8_general_ci
init-connect='SET NAMES utf8'


[mysqldump]
quick
quote-names
max_allowed_packet   = 16M

[mysql]
#no-auto-rehash   # faster start of mysql but no tab completition

[isamchk]
key_buffer      = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/


А вот
my-huge.cnf
Код: html
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
137.
138.
139.
140.
141.
142.
143.
144.
145.
146.
# Example MySQL config file for very large systems.
#
# This is for a large system with memory of 1G-2G where the system runs mainly
# MySQL.
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password   = your_password
port      = 3306
socket      = /var/run/mysqld/mysqld.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port      = 3306
socket      = /var/run/mysqld/mysqld.sock
skip-external-locking
key_buffer_size = 384M
max_allowed_packet = 1M
table_open_cache = 512
sort_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking

# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id   = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
#    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =   <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port     =  <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
#
# binary logging format - mixed recommended
#binlog_format=mixed

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 384M
#innodb_additional_mem_pool_size = 20M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 100M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout




Прошу вашей помощи, потому что столкнулся с этим впервые.
1. Просто переписать файл my.cnf, скопировав текст из my-huge.cnf или дописывать и изменять построчно в my.cnf из my-huge.cnf ?
2. А что делать с config.huge.ini ? Там информация отличается от my-huge.cnf. Куда его надо применить?
3. Надо ли раскомментировать строчки "Uncomment the following if you are using InnoDB tables" для подключения InnoDB, если установленные программы на сервере используют Типы таблиц как и InnoDB, так и MyISAM, BLACKHOLЕ, PERFORMANCE_SCHEMA, MEMORY. Правда больше всех InnoDB

Спасибо!
...
Рейтинг: 0 / 0
Оптимизация mysql my.cnf
    #38764727
alex564657498765453
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Рекомендуеться, сначала запустить сервер
и проверить что он запускаеться, и к нему можно подключиться...

потом посмотреть будет ли работать софт.

и помере возникновения проблем, гуглить по конкретной настройке.

ЗЫ
судя по тексту

1. Просто переписать файл my.cnf, скопировав текст из my-huge.cnf или дописывать и изменять построчно в my.cnf из my-huge.cnf ?
2. А что делать с config.huge.ini ? Там информация отличается от my-huge.cnf. Куда его надо применить?
3. Надо ли раскомментировать строчки "Uncomment the following if you are using InnoDB tables" для подключения InnoDB, если установленные программы на сервере используют Типы таблиц как и InnoDB, так и MyISAM, BLACKHOLЕ, PERFORMANCE_SCHEMA, MEMORY. Правда больше всех InnoDB

мои познания, человека не владевшего авто и не заглядывающего в авто, но знающего что
есть инжекторный и карбюраторный двигатель, - куда более глубокие. Но я бы не решился
перебирать авто по запчастям и думать как можно усилилить двигатель...
...
Рейтинг: 0 / 0
Оптимизация mysql my.cnf
    #38764731
alex564657498765453
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
и не надо хьюдж конфиг, взять дефолтный. по умолчанию работа с иннодб отключена, вот
те строчки разкоментировать где настройки с иннодб и собственно строка включения поддержки иннодб.
...
Рейтинг: 0 / 0
Оптимизация mysql my.cnf
    #38764734
rafaello7
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Сервер работает, но причина, по которой я решился на оптимизацию - это то, что MYSQL жрет память очень сильно.
...
Рейтинг: 0 / 0
Оптимизация mysql my.cnf
    #38766809
rafaello7
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Если я раскомментирую строку
innodb_data_file_path = ........
то сервер MYSQL не перезапускается (не стартует). Даже в том случае, если я удаляю файлы
/var/lib/ib_logfile0
и
/var/lib/ib_logfile1
Но что интересно, при проверке утилитой mysqltuner и tuning primer обе они показывают, что INNODB работают. Получается, что это лишние движения "Uncomment the following if you are using InnoDB tables"
...
Рейтинг: 0 / 0
Оптимизация mysql my.cnf
    #38766847
netwind
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
rafaello7В интернете раскопал информацию о том, что файл конфигурации mysql my.cnf можно перенастраивать в зависимости от характеристик сервера
жаль там не было написано, что не всегда нужно.

авторПолучается, что это лишние движения "Uncomment the following if you are using InnoDB tables"
они будут работать, потому что innodb все равно создает файлы и использует буфер размером даже если параметры не заданы.
Просто они маленькие.

Раз уж вы считаете, что это вам поможет, надо смотреть логи и думать в чем ошибка.
...
Рейтинг: 0 / 0
6 сообщений из 6, страница 1 из 1
Форумы / MySQL [игнор отключен] [закрыт для гостей] / Оптимизация mysql my.cnf
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]