This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux:databases:mysql [2016/08/23 16:02] tkilla |
linux:databases:mysql [2017/11/22 01:10] (current) tkilla |
||
---|---|---|---|
Line 80: | Line 80: | ||
| | ||
+ | |||
+ | |||
+ | If you get "error 34 too many open files" | ||
+ | |||
+ | open_files_limit = 50000 | ||
+ | |||
+ | |||
+ | Restart mysql and check to see current setting: | ||
+ | SHOW VARIABLES LIKE ' | ||
+ | |||
+ | |||
+ | |||
+ | interesting parameters for replication: | ||
+ | |||
+ | --lock-tables - READ LOCK (no writes) for currently dumped database: ensures consitent dump instead of | ||
+ | --single-transaction | ||
+ | will give you an exact point-in-time snapshot of the data | ||
+ | --single-transaction produces a checkpoint that allows the dump to capture all data prior to the | ||
+ | checkpoint while receiving incoming changes. | ||
+ | Those incoming changes do not become part of the dump. That ensures the same point-in-time for all tables. | ||
+ | USE IF ALL TABLES ARE INNODB | ||
+ | |||
+ | --opt includes --lock-tables | ||
---- | ---- | ||
Line 88: | Line 111: | ||
mysql --host=127.0.0.1 | mysql --host=127.0.0.1 | ||
+ | |||
---- | ---- | ||
Line 152: | Line 176: | ||
-- | -- | ||
+ | |||
+ | == Convert MyISM to INNODB | ||
+ | |||
+ | .. because it's better :) | ||
+ | |||
+ | a little script to get all required alter table statements | ||
+ | |||
+ | mysql -u root --password=xxxxx -e " | ||
+ | |||
+ | then execute the file via mysql command: mysql -u ... < / | ||
+ | |||
+ | read this great article: http:// | ||
+ | |||
== SSL Connection | == SSL Connection | ||
+ | |||
+ | **This setup does not require all users to use ssl, you need to update your mysql.users with REQUIRE_SSL!** | ||
First generate all certs. You need to adjust days and set some hostnames (seems unimportant here) | First generate all certs. You need to adjust days and set some hostnames (seems unimportant here) | ||
Line 180: | Line 219: | ||
Edit / | Edit / | ||
- | [client] | + | |
- | #... | + | #... |
- | # SSL: | + | # SSL: |
- | ssl-ca=/ | + | ssl-ca=/ |
- | + | ||
- | [mysqld]: | + | [mysqld]: |
- | # ... | + | # ... |
- | # SSL: | + | # SSL: |
- | ssl-ca=/ | + | ssl-ca=/ |
- | ssl-cert=/ | + | ssl-cert=/ |
- | ssl-key=/ | + | ssl-key=/ |
Restart mysqld: | Restart mysqld: | ||
Line 207: | Line 246: | ||
* Excellent tutorial on replication and SSL: https:// | * Excellent tutorial on replication and SSL: https:// | ||
+ | |||
+ | == Bugfixes / Troubleshooting | ||
+ | |||
+ | After Upgrade to 10.1 SSL connection does not work anymore. Client cannot login and repication is broken: | ||
+ | |||
+ | ERROR 2026 (HY000): SSL connection error: error: | ||
+ | |||
+ | Regenerating certs fixes the prob! | ||
+ | |||
+ | Used this tutorial to create new certs: | ||
+ | |||
+ | * https:// | ||
+ | |||
+ | |||
+ | \\ | ||
+ | |||
+ | **OOM - out of memory crashs** | ||
+ | |||
+ | .. is the most common reason for crashs | ||
+ | |||
+ | check the logs - usually syslog - and | ||
+ | |||
+ | dmesg | ||
+ | |||
+ | if you find oom messages like: | ||
+ | [755193.018154] Out of memory: Kill process 3328 (mysqld) score 6 or sacrifice child | ||
+ | [755193.018224] Killed process 3328 (mysqld) total-vm: | ||
+ | |||
+ | the mysql process was killed. | ||
+ | |||
+ | watch memory usage: | ||
+ | |||
+ | watch -n 30 "ps aux | grep / | ||
+ | |||
+ | |||
+ | the most important parameter in my.cnf is this (but there are many others..): | ||
+ | |||
+ | innodb_buffer_pool_size = 2G | ||
+ | |||
+ | |||
+ | OOM troubleshooting infos: | ||
+ | * https:// | ||
+ | |||
+ | |||
+ | If you suspect RAM problems and you cannot run memtest on a remote server, try this trick: | ||
+ | |||
+ | fallocate -l 24G largefile | ||
+ | md5sum largefile; md5sum largefile; md5sum largefile; | ||
+ | |||
+ | This uses up all RAM, because the file is read into memory. the md5 sum should be always the same. | ||
+ | |||
+ | found this trick here: https:// | ||
+ | |||