my.cnfの設定について
- 評価
- クリップ 0
- VIEW 5,899
Mysql Cominity Server 5.7.11にてmy.cnfの設定をしています。
・max_connections = 500
・文字コード:UTF8
・DBファイルシステム領域について(1000M)自動作成をする
・log_timestamps = 'system'
・lower_case_table_names = 2
事をしたいと思います。my.cnfを下記のように設定しました。
ログ時刻は現在の時刻になっているみたいなのですが、最初の1行だけ時刻がずれているのは
何故でしょうか?デーモンユーザで起動しているのでしょうか?
lower_case_table_names = 2にしてもmysqlに反映されません。記述が間違っているのでしょうか?
また、起動ログで注意、エラーが多い気がするのですが、問題ないでしょうか?
必要のない記述があれば教えて下さい。
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
log_timestamps = 'system'
lower_case_table_names = 2
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server = utf8
skip-character-set-client-handshake
# --------------------------------------------------
# Network
# --------------------------------------------------
max_connections = 500
# --------------------------------------------------
# Logging
# --------------------------------------------------
general_log=1
general_log_file=/var/log/mysql_query.log
# --------------------------------------------------
# Cache & Memory
# --------------------------------------------------
# Global
thread_cache_size = 30
table_open_cache = 400
query_cache_size = 16M
query_cache_limit = 1M
# Global, Session
max_heap_table_size = 16M
tmp_table_size = 16M
sort_buffer_size = 2M
read_buffer_size = 131072
join_buffer_size = 131072
read_rnd_buffer_size = 262144
# --------------------------------------------------------------------
# InnoDB behavior
# --------------------------------------------------------------------
# Global
innodb_file_format = Barracuda
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_stats_on_metadata = 1
innodb_max_dirty_pages_pct = 90
innodb_adaptive_hash_index = 1
innodb_adaptive_flushing = 1
innodb_strict_mode = 1
innodb_io_capacity = 200
innodb_autoinc_lock_mode = 1
innodb_change_buffering = inserts
innodb_old_blocks_time = 500
# --------------------------------------------------------------------
# InnoDB base
# --------------------------------------------------------------------
# Global
innodb_buffer_pool_size = 256M
innodb_data_home_dir = /var/lib/mysql
innodb_data_file_path = ibdata1:1000M:autoextend
innodb_file_per_table = 1
innodb_autoextend_increment = 64M
innodb_log_group_home_dir = /var/lib/mysql
innodb_fast_shutdown = 0
innodb_log_file_size = 64M
innodb_log_files_in_group = 2
innodb_log_buffer_size = 8M
#innodb_additional_mem_pool_size = 8M
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 1
innodb_force_recovery = 0
innodb_doublewrite = 1
innodb_sync_spin_loops = 20
innodb_thread_sleep_delay = 1000
innodb_commit_concurrency = 0
innodb_concurrency_tickets = 500
# Global, Session
innodb_support_xa = FALSE
innodb_lock_wait_timeout = 50
innodb_table_locks = 1
[client]
default-character-set = utf8
[mysqldump]
default-character-set = utf8
[mysql]
default-character-set = utf8
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
-----------------/var/log/mysqld.log-------------------
2016-03-08T08:54:41.930740Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2016-03-08T17:54:42.139845+09:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-03-08T17:54:42.140663+09:00 0 [Note] /usr/sbin/mysqld (mysqld 5.7.11-log) starting as process 21803 ...
2016-03-08T17:54:42.146232+09:00 0 [Warning] option 'innodb-autoextend-increment': unsigned value 67108864 adjusted to 1000
2016-03-08T17:54:42.146718+09:00 0 [Warning] InnoDB: Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
2016-03-08T17:54:42.146740+09:00 0 [Warning] InnoDB: Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
2016-03-08T17:54:42.146833+09:00 0 [Note] InnoDB: PUNCH HOLE support available
2016-03-08T17:54:42.146867+09:00 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-03-08T17:54:42.146880+09:00 0 [Note] InnoDB: Uses event mutexes
2016-03-08T17:54:42.146890+09:00 0 [Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
2016-03-08T17:54:42.146900+09:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-03-08T17:54:42.146912+09:00 0 [Note] InnoDB: Using Linux native AIO
2016-03-08T17:54:42.147453+09:00 0 [Note] InnoDB: Number of pools: 1
2016-03-08T17:54:42.147610+09:00 0 [Note] InnoDB: Not using CPU crc32 instructions
2016-03-08T17:54:42.157075+09:00 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2016-03-08T17:54:42.180181+09:00 0 [Note] InnoDB: Completed initialization of buffer pool
2016-03-08T17:54:42.184575+09:00 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-03-08T17:54:42.197089+09:00 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-03-08T17:54:42.223241+09:00 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-03-08T17:54:42.223353+09:00 0 [Note] InnoDB: Setting file '/var/lib/mysql/ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-03-08T17:54:42.364921+09:00 0 [Note] InnoDB: File '/var/lib/mysql/ibtmp1' size is now 12 MB.
2016-03-08T17:54:42.366681+09:00 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-03-08T17:54:42.366707+09:00 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-03-08T17:54:42.368574+09:00 0 [Note] InnoDB: Waiting for purge to start
2016-03-08T17:54:42.418823+09:00 0 [Note] InnoDB: 5.7.11 started; log sequence number 1209999
2016-03-08T17:54:42.420939+09:00 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-03-08T17:54:42.421367+09:00 0 [Note] Plugin 'FEDERATED' is disabled.
2016-03-08T17:54:42.421368+09:00 0 [Note] InnoDB: Buffer pool(s) load completed at 160308 17:54:42
2016-03-08T17:54:42.421969+09:00 0 [Warning] InnoDB: Cannot open table mysql/plugin from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.
mysqld: Table 'mysql.plugin' doesn't exist
2016-03-08T17:54:42.422038+09:00 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
mysqld: File '/var/log/mysql_query.log' not found (Errcode: 13 - Permission denied)
2016-03-08T17:54:42.422293+09:00 0 [ERROR] Could not use /var/log/mysql_query.log for logging (error 13 - Permission denied). Turning logging off for the server process. To turn it on again: fix the cause, then either restart the query logging by using "SET GLOBAL GENERAL_LOG=ON" or restart the MySQL server.
2016-03-08T17:54:42.423054+09:00 0 [Warning] InnoDB: Cannot open table mysql/gtid_executed from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.
mysqld: Table 'mysql.gtid_executed' doesn't exist
2016-03-08T17:54:42.423118+09:00 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-03-08T17:54:42.423163+09:00 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2016-03-08T17:54:42.423544+09:00 0 [Warning] CA certificate ca.pem is self signed.
2016-03-08T17:54:42.426320+09:00 0 [Note] Server hostname (bind-address): '*'; port: 3306
2016-03-08T17:54:42.427687+09:00 0 [Note] IPv6 is not available.
2016-03-08T17:54:42.427748+09:00 0 [Note] - '0.0.0.0' resolves to '0.0.0.0';
2016-03-08T17:54:42.427769+09:00 0 [Note] Server socket created on IP: '0.0.0.0'.
2016-03-08T17:54:42.431671+09:00 0 [Warning] InnoDB: Cannot open table mysql/server_cost from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.
2016-03-08T17:54:42.431711+09:00 0 [Warning] Failed to open optimizer cost constant tables
2016-03-08T17:54:42.432742+09:00 0 [Warning] InnoDB: Cannot open table mysql/time_zone_leap_second from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.
-----------mysqld.log----
以上、ご教授をお願い致します。
-
気になる質問をクリップする
クリップした質問は、後からいつでもマイページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
クリップを取り消します
-
良い質問の評価を上げる
以下のような質問は評価を上げましょう
- 質問内容が明確
- 自分も答えを知りたい
- 質問者以外のユーザにも役立つ
評価が高い質問は、TOPページの「注目」タブのフィードに表示されやすくなります。
質問の評価を上げたことを取り消します
-
評価を下げられる数の上限に達しました
評価を下げることができません
- 1日5回まで評価を下げられます
- 1日に1ユーザに対して2回まで評価を下げられます
質問の評価を下げる
teratailでは下記のような質問を「具体的に困っていることがない質問」、「サイトポリシーに違反する質問」と定義し、推奨していません。
- プログラミングに関係のない質問
- やってほしいことだけを記載した丸投げの質問
- 問題・課題が含まれていない質問
- 意図的に内容が抹消された質問
- 過去に投稿した質問と同じ内容の質問
- 広告と受け取られるような投稿
評価が下がると、TOPページの「アクティブ」「注目」タブのフィードに表示されにくくなります。
質問の評価を下げたことを取り消します
この機能は開放されていません
評価を下げる条件を満たしてません
質問の評価を下げる機能の利用条件
この機能を利用するためには、以下の事項を行う必要があります。
- 質問回答など一定の行動
-
メールアドレスの認証
メールアドレスの認証
-
質問評価に関するヘルプページの閲覧
質問評価に関するヘルプページの閲覧
+2
質問文にあわせて回答も編集しました
起動しない原因(推測)
このmy.cnfは前のバージョンで使用していたものでしょうか。
MySQL5.7では設定できないパラメーターが含まれているのが原因かと思われます。
できることならまるごとコピペするのではなく、まっさらな状態から一つ一つMySQL5.7で使えるパラメーターと意味を確認しながらmy.cnfを作ることをお勧めします。
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html
意地悪せずに答えを書くと「innodb_additional_mem_pool_size」が MySQL5.7.4で削除されており、そのパラメータを消さないとおそらく起動しません。
http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_additional_mem_pool_size
ちなみにmy.cnfに何も書かなくてもinnodbは(標準の設定値で)使えます。
ログファイルの時刻
ログファイルの時刻の標準はUTCになっています。
my.cnfに
log_timestamps = 'system'
を書けばOSの時刻になります。
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_log_timestamps
同時接続
以下私の理解での回答です。
「同時接続数」はmax_connectionsで制御するのでコネクションプールだろうと何だろうと共通です。
MySQLの場合はその利用シーン(接続元言語仕様)からコネクションプールせずに接続切断の連続をする方が多い気がします。
Oracle社もそれを承知していて最新版の5.7では接続切断が多くてもコストが低くなるような調整をしています。
MySQLの接続についてのパフォーマンスチューニングはmax_connectionsとthread_cacheについて行う情報が多く見つかるので参考にされるとよいかもしれません。
回答追記20160308
最初の1行だけ時刻がずれている
ずれているのではなく表現が違うだけです。あまり気にするところではないと思います。
lower_case_table_names = 2にしてもmysqlに反映されません
「反映されません」が具体的に何をして何になるのかはわかりませんが、これを設定してもInnoDBではすべて小文字になります。
https://dev.mysql.com/doc/refman/5.7/en/identifier-case-sensitivity.html
起動ログで注意、エラーが多い気がする
推測ですが、旧バージョンのデータを引き継いでますか?そうだとしてmysql_upgradeをしてますか?
これ以外については私からは一つずつ指摘しません。1行ずつ意味を調べてみてください。
無視してよいものとすべきでないものがあります。
innodbは標準の設定値でどのような仕様で使えるのでしょか?
ここのデフォルト値が書いてあります。
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html
投稿
-
回答の評価を上げる
以下のような回答は評価を上げましょう
- 正しい回答
- わかりやすい回答
- ためになる回答
評価が高い回答ほどページの上位に表示されます。
-
回答の評価を下げる
下記のような回答は推奨されていません。
- 間違っている回答
- 質問の回答になっていない投稿
- スパムや攻撃的な表現を用いた投稿
評価を下げる際はその理由を明確に伝え、適切な回答に修正してもらいましょう。
15分調べてもわからないことは、teratailで質問しよう!
- ただいまの回答率 88.20%
- 質問をまとめることで、思考を整理して素早く解決
- テンプレート機能で、簡単に質問をまとめられる
質問への追記・修正、ベストアンサー選択の依頼
dupont_kedama
2016/03/04 20:06 編集
引用部分全体を ``` と ``` で囲んでいただくと読みやすいかも。
CHERRY
2016/03/04 21:25
「サービスが開始になりません。 」というのは、設定を変更後どのようなコマンドを実行されたのでしょうか? エラーメッセージは、何か出ていませんか?
kumakumatan
2016/03/07 15:38
ご返信ありがとうございます。
少し、my.cnfファイルを修正しました。
=======my.cnf================================
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server = utf8
skip-character-set-client-handshake
# --------------------------------------------------
# Network
# --------------------------------------------------
max_connections = 500
# --------------------------------------------------
# Logging
# --------------------------------------------------
general_log=1
general_log_file=/var/log/mysql_query.log
# --------------------------------------------------
# Cache & Memory
# --------------------------------------------------
# Global
thread_cache_size = 30
table_open_cache = 400
query_cache_size = 16M
query_cache_limit = 1M
# Global, Session
max_heap_table_size = 16M
tmp_table_size = 16M
sort_buffer_size = 2M
read_buffer_size = 131072
join_buffer_size = 131072
read_rnd_buffer_size = 262144
# --------------------------------------------------------------------
# InnoDB behavior
# --------------------------------------------------------------------
# Global
innodb_file_format = Barracuda
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_stats_on_metadata = 1
innodb_max_dirty_pages_pct = 90
innodb_adaptive_hash_index = 1
innodb_adaptive_flushing = 1
innodb_strict_mode = 1
innodb_io_capacity = 200
innodb_autoinc_lock_mode = 1
innodb_change_buffering = inserts
innodb_old_blocks_time = 500
# --------------------------------------------------------------------
# InnoDB base
# --------------------------------------------------------------------
# Global
innodb_buffer_pool_size = 256M
innodb_data_home_dir = /var/lib/mysql
innodb_data_file_path = ibdata1:1000M:autoextend
innodb_file_per_table = 1
innodb_autoextend_increment = 64M
innodb_log_group_home_dir = /var/lib/mysql
innodb_fast_shutdown = 0
innodb_log_file_size = 64M
innodb_log_files_in_group = 2
innodb_log_buffer_size = 8M
innodb_additional_mem_pool_size = 8M
innodb_thread_concurrency = 8
innodb_flush_log_at_trx_commit = 1
innodb_force_recovery = 0
innodb_doublewrite = 1
innodb_sync_spin_loops = 20
innodb_thread_sleep_delay = 1000
innodb_commit_concurrency = 0
innodb_concurrency_tickets = 500
# Global, Session
innodb_support_xa = FALSE
innodb_lock_wait_timeout = 50
innodb_table_locks = 1
[client]
default-character-set = utf8
[mysqldump]
default-character-set = utf8
[mysql]
default-character-set = utf8
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
=========my.cnf===============
エラーログは
======mysqld.log=============================
2016-03-07T06:16:14.577629Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-03-07T06:16:14.583794Z 0 [Warning] option 'innodb-autoextend-increment': unsigned value 67108864 adjusted to 1000
2016-03-07T06:16:14.584335Z 0 [Warning] InnoDB: Using innodb_support_xa is deprecated and the parameter may be removed in future releases. Only innodb_support_xa=ON is allowed.
2016-03-07T06:16:14.584356Z 0 [Warning] InnoDB: Using innodb_file_format is deprecated and the parameter may be removed in future releases. See http://dev.mysql.com/doc/refman/5.7/en/innodb-file-format.html
16-03-07T06:16:17.142266Z 0 [Warning] InnoDB: New log files created, LSN=45790
16-03-07T06:16:17.434115Z 0 [Warning] InnoDB: Cannot open table mysql/plugin from the internal data dictionary of InnoDB though the .frm file for the table exists. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting.html for how to resolve the issue.
mysqld: Table 'mysql.plugin' doesn't exist
2016-03-07T06:16:17.434185Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-03-07T06:16:17.434390Z 0 [ERROR] unknown variable 'innodb_additional_mem_pool_size=8M'
2016-03-07T06:16:17.434407Z 0 [ERROR] Aborting
=========Logを一部抜粋========================
InnoDBの設定を入れてから起動しません。InnoDBの設定を外したら、正常起動できます。
ご回答宜しくお願いします。
dupont_kedama
2016/03/07 15:45
質問文本文を編集して my.conf の内容、エラーの内容それぞれの上下を ``` と ``` で囲んでください。(</>のボタンがその入力支援になっています)