MySQL umstellen von myISAM auf InnoDB

meddie

New Member
Hallo Leute,

ich habe heute versucht Zaraf auf meinem Vserver von Strato mit OpenSUSE 11.1 und Plesk 9.5.2 zu installieren. Dabei riet mir der Herr von Zarafa die SLES 11 Version zu nehmen.

Installieren klappte hervorragend. Nur starten zut der Zarafa Server nicht.
In der Log steth drin, dass der SQL Server nicht im InnoDB Modus läuft.

Wie könnte ich den von myisam auf innodb umstellen. Vorallem ich habe bereits mehrere Datenbanken angelegt.

Für eine ausführliche Antwort wäre ich sehr dankbar
Gruß Eddie
 
Wie könnte ich den von myisam auf innodb umstellen. Vorallem ich habe bereits mehrere Datenbanken angelegt.

Der eigentliche Befehl lautet:


ALTER TABLE `<tabellenname>` ENGINE = InnoDB

Die Information über existente Tabellen und Zugehörogkeit bekommst Du aus der Tabelle:

information_schema.tables.

-> Achtung hier sind alle Tabellen enthalten auch die des Systemes also auf Feld TABLE_SCHEMA eingrenzen, welche Schemas betrachtet werden sollen. Schema mysql und information_schema sind für Deine Operation tabu!

-> Schema entspricht der Datenbank.

Ein Script um daraus nun obiges alter zu generieren solltest Du ggf. selbst hin bekommen.
Wenn Du als "root" arbeitest bitte beachten, dass beim obigen Statement (alter table `schema`.`tabelle` ENGINE = InnoDB) auch das Schema angegeben muss in welchem sich die Tabelle befindet.
 
Last edited by a moderator:
Muss ich da in der my.cfg nichts anpassen? Schon oder?

Ja, Du musst natürlich InnoDB aktivieren.

http://dev.mysql.com/doc/refman/5.1-olh/de/innodb.html
http://dev.mysql.com/doc/refman/5.1-olh/de/innodb-configuration.html

Es gibt auch ggf. einige Punkte zu berücksichtigen im Bezug auf optimale Performance.
http://www.mysqlperformanceblog.com/?s=innodb

-> Das ist leider etwas zu umfangreich um es ad hoc abzukopfen.
Deshalb selber lesen.

BTW: Wie hast Du den Zafara installiert? Mit den Paketen sollte das zumindest richtig geliefert werden inkl. der InnoDB Konfiguration. Habe es aber auf SLES11 noch nicht genutzt.
 
Last edited by a moderator:
Prüfe zunächst mit SHOW ENGINES, ob InnoDB überhaupt als Engine verfügbar ist. Wenn nein, suche in Deiner my.cnf nach "skip-innodb" und kommentiere diese Anweisung aus. Nach einem Neustart des mysqld sollte SHOW ENGINES InnoDB mit auflisten.

Außerdem kannst Du in der my.cnf die Standard Storage Engine festlegen: http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_default-storage-engine

Die Default Storage Engine-Einstellung hindert eine Applikation aber nicht daran, InnoDB-Tabellen anzulegen.
 
So habe jetzt die innodb in der my.cfg aktiviert habe die Speichergrenze gesetzt (ISt mir der Server innerhalb paar Minuten stehen geblieben weil der Hauptspeicher voll war)
Und nun scheint alles zu laufen.
Die anderen Datenbanken laufen auch alle.
Und Zarafa läßt sich starten.
 
Nee komando zurück.
Er sagt schon wieder nicht genügend Hauptspeicher und ich kann nicht mal mehr reboot machen. Was kann das sein.
 
Last edited by a moderator:
Poste mal die Ausgabe aus 'free' und den Inhalt aus der my.cnf.
Ich befürchte, der Bufferpool ist "zu gross" und Dir geht der Speicher aus.

Prüfen, was verfügbar ist und entsprechend die Mysql konfigurieren.
Und ruhig noch was vom Speicher frei lassen ca. grobe Faustformel 10% vom gesamten sollte nicht belegt werden.
 
Das ist kurz nach Reboot

free:
Code:
free
             total       used       free     shared    buffers     cached
Mem:       5140764      97792    5042972          0          0          0
-/+ buffers/cache:      97792    5042972
Swap:         0          0          0

Und das ist die my.cnf

Code:
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
#
# 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/lib/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
set-variable=local-infile=0
port            = 3306
socket          = /var/lib/mysql/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

# 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

# Point the following paths to different dedicated disks
#tmpdir         = /tmp/
#log-update     = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 4M
#bdb_max_lock = 10000

#skip-innodb
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql/
#innodb_log_arch_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 = 16M
innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

# The safe_mysqld script
skip-bdb

[safe_mysqld]
log-error=/var/lib/mysql/mysqld.log

skip-bdb

[mysqldump]
quick
max_allowed_packet = 16M

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

[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

[mysqld_multi]
mysqld     = /usr/bin/mysqld_safe
mysqladmin = /usr/bin/mysqladmin
log        = /var/log/mysqld_multi.log
# user       = multi_admin
# password   = secret

# If you want to use mysqld_multi uncomment 1 or more mysqld sections
# below or add your own ones.
# WARNING
# --------
# If you uncomment mysqld1 than make absolutely sure, that database mysql,
# configured above, is not started.  This may result in corrupted data!
# [mysqld1]
# port       = 3306
# datadir    = /var/lib/mysql
# pid-file   = /var/lib/mysql/mysqld.pid
# socket     = /var/lib/mysql/mysql.sock
# user       = mysql

# [mysqld2]
# port       = 3307
# datadir    = /var/lib/mysql-databases/mysqld2
# pid-file   = /var/lib/mysql-databases/mysqld2/mysql.pid
# socket     = /var/lib/mysql-databases/mysqld2/mysql.sock
# user       = mysql

# [mysqld3]
# port       = 3308
# datadir    = /var/lib/mysql-databases/mysqld3
# pid-file   = /var/lib/mysql-databases/mysqld3/mysql.pid
# socket     = /var/lib/mysql-databases/mysqld3/mysql.sock
# user       = mysql

# [mysqld6]
# port       = 3309
# datadir    = /var/lib/mysql-databases/mysqld6
# pid-file   = /var/lib/mysql-databases/mysqld6/mysql.pid
# socket     = /var/lib/mysql-databases/mysqld6/mysql.sock
# user       = mysql
 
Mmmh, da sind einige Werte gar nicht gesetz andere wiederum pauschal betrachtet viel zu hoch.

In Verbindung mit den Connections läuft dir dabei der RAM voll.
-> 5 GB ....

handelt es sich um einen vHost? Und falls ja, wieviel RAM ist garantiert.
* Habs überlesen vServer.
Dann muss die Konfiguration für den garantierten RAM eingestellt werden.
Aber mit zarafa wirst Du auf dem Host vermutlich nicht glücklich.

Ansonsten nutz am besten mal tuning-primer.sh
Macht die Sache einfacher um mal schnell vernünftige Parameter zu erhalten.
Zum Rest komme ich ggf. später nochmals und poste eine Konfig die fürs erste besser sein dürfte.
 
Ja das ist ein vServer von Strato garantier sind glaube 256. Ich weiss es nciht mehr so genau.

Zu wenig.
Wie oben geschireben / editiert.
Hier wird schon der tomcat die 265 MB aufbrauchen.
Eigentlich ist da jeder Konfigurationsversuch verschenkte Liebsmühe.
-> Strato spricht von garantierten 2 BG -4 GB garantiertem RAM je nach VServer Produkt.

Entspricht das auch Deinem Produkt?
 
Last edited by a moderator:
Das hat mir das Script vorgeschlagen:

Code:
hostname:/usr/bin # ./tuning-primer.sh

        -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

MySQL Version 5.0.67 i686

./tuning-primer.sh: line 497: bc: command not found
./tuning-primer.sh: line 498: bc: command not found
./tuning-primer.sh: line 499: bc: command not found
./tuning-primer.sh: line 500: bc: command not found
./tuning-primer.sh: line 501: bc: command not found
./tuning-primer.sh: line 502: bc: command not found
Uptime =  days  hrs  min  sec
Avg. qps = 2
Total Questions = 1502
Threads Connected = 10

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 0 out of 1523 that take longer than 10 sec. to complete
./tuning-primer.sh: line 403: bc: command not found
./tuning-primer.sh: line 606: [: -gt: unary operator expected
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 0
Current threads_cached = 0
Current threads_per_sec = 1
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 100
Current threads_connected = 10
Historic max_used_connections = 10
The number of used connections is 10% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

INNODB STATUS
./tuning-primer.sh: line 440: bc: command not found
Current InnoDB index space =  K
./tuning-primer.sh: line 440: bc: command not found
Current InnoDB data space =  K
Current InnoDB buffer pool free = 90 %
./tuning-primer.sh: line 440: bc: command not found
Current innodb_buffer_pool_size =  M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
./tuning-primer.sh: line 1321: bc: command not found
./tuning-primer.sh: line 1322: bc: command not found
./tuning-primer.sh: line 1346: bc: command not found
./tuning-primer.sh: line 1349: bc: command not found
./tuning-primer.sh: line 1350: bc: command not found
./tuning-primer.sh: line 1352: bc: command not found
./tuning-primer.sh: line 1354: [: -gt: unary operator expected
./tuning-primer.sh: line 459: [: max_memoryHR: integer expression expected
./tuning-primer.sh: line 465: [: max_memoryHR: integer expression expected
./tuning-primer.sh: line 471: [: max_memoryHR: integer expression expected
./tuning-primer.sh: line 478: export: `=max_memoryHR': not a valid identifier
Max Memory Ever Allocated :  bytes
./tuning-primer.sh: line 459: [: per_thread_buffersHR: integer expression expect                                                                             ed
./tuning-primer.sh: line 465: [: per_thread_buffersHR: integer expression expect                                                                             ed
./tuning-primer.sh: line 471: [: per_thread_buffersHR: integer expression expect                                                                             ed
./tuning-primer.sh: line 478: export: `=per_thread_buffersHR': not a valid ident                                                                             ifier
Configured Max Per-thread Buffers :  bytes
./tuning-primer.sh: line 459: [: global_buffersHR: integer expression expected
./tuning-primer.sh: line 465: [: global_buffersHR: integer expression expected
./tuning-primer.sh: line 471: [: global_buffersHR: integer expression expected
./tuning-primer.sh: line 478: export: `=global_buffersHR': not a valid identifie                                                                             r
Configured Max Global Buffers :  bytes
./tuning-primer.sh: line 459: [: total_memoryHR: integer expression expected
./tuning-primer.sh: line 465: [: total_memoryHR: integer expression expected
./tuning-primer.sh: line 471: [: total_memoryHR: integer expression expected
./tuning-primer.sh: line 478: export: `=total_memoryHR': not a valid identifier
Configured Max Memory Limit :  bytes
./tuning-primer.sh: line 440: bc: command not found
Physical Memory :  G
Max memory limit seem to be within acceptable norms

KEY BUFFER
./tuning-primer.sh: line 754: bc: command not found
./tuning-primer.sh: line 755: bc: command not found
./tuning-primer.sh: line 440: bc: command not found
Current MyISAM index space =  M
./tuning-primer.sh: line 440: bc: command not found
Current key_buffer_size =  M
Key cache miss rate is 1 : 107
Key buffer free ratio =  %
./tuning-primer.sh: line 792: [: -le: unary operator expected
./tuning-primer.sh: line 796: [: -le: unary operator expected
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is supported but not enabled
Perhaps you should set the query_cache_size

SORT OPERATIONS
./tuning-primer.sh: line 440: bc: command not found
Current sort_buffer_size =  K
./tuning-primer.sh: line 440: bc: command not found
Current read_rnd_buffer_size =  K
Sort buffer seems to be fine

JOINS
./tuning-primer.sh: line 440: bc: command not found
Current join_buffer_size =  K
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly

OPEN FILES LIMIT
Current open_files_limit = 1024 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_cache value = 64 tables
You have a total of 688 tables
You have 64 open tables.
Current table_cache hit rate is 3%
, while 100% of your table cache is in use
You should probably increase your table_cache

TEMP TABLES
./tuning-primer.sh: line 440: bc: command not found
Current max_heap_table_size =  M
./tuning-primer.sh: line 440: bc: command not found
Current tmp_table_size =  M
Of 211 temp tables, 7% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

TABLE SCANS
./tuning-primer.sh: line 440: bc: command not found
Current read_buffer_size =  K
Current table scan ratio = 4 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 1778
Your table locking seems to be fine

hostname:/usr/bin # vi /etc/my.cnf
hostname:/usr/bin # mcedit /etc/my.cnf
-bash: fork: Nicht genügend Hauptspeicher verfügbar
hostname:/usr/bin #
 
Ok, ich stelle dir später ein gepatchtes Script ein.
Hatte das gleiche Problem.

Dachte eigentlich, dass es inzwischen behoben wäre.
Achja bc installieren!

yast -i bc

Falls das nicht hilft, liefer ich gegen später eine gepatchte Version.
 
Last edited by a moderator:
Siehe Anhang erstmal das funktionierende tuning-primer.sh sowie eine opensuse my.cnf. Etwas auf Deinen geringeren RAM angepasst. entspricht aber im wesentlichen Deiner konfig.
Ist zumindest mal eine Basis von der wir uns weiter an Deine Bedürfnisse vortasten können.

Da der Speicher zuzüg aus geht, bitte die Ausgabe von
"free -m -t" posten, wenn der Speicher tatsächlich knapp wird. dann mit z.B. htop oder nur top prüfen wer sich wieviel RAM gönnt.

Bei top die Sortierreihenfolge anpassen.
-> 3 mal >
Bei htop einmal ">" und im linken Menu Mem% auswählen.

Ebenfalls mit ps -ef prüfen, wieviele Prozesse da ggf. überhaupt laufen.
Sofern sich nicht wenige Prozesse viele Speicher schnappen dann werden es eventuell viele fastcgi Prozesse sein.
Dazu bräuchten wir erstmal Apache/lighttpd, php.ini.

Habd doch heute mittag tatsächlich zafara mit zimbra verwechselt.
 

Attachments

Hallo Matzewe01

ich weiss Deine Mühe sehr zu schätzen und ich danke Dir vielmals für die mühevolle Hilfe die Du mir anbietest.

Ich kann leider Deine my.cnf nicht entpacken bzw. bneutzen, da ich dort drin nur Sonderzeichen und Müll drin habe. Ich kann es weder mit WinRAR entpacken noch am Server.

Vielleicht könntest Du einfach nur den Inhalt hier posten. Dann würde ich es eben per Copy Paste einfügen

Vielen Vielen Dank

PS

free -m -t
Code:
             total       used       free     shared    buffers     cached
Mem:          5020         95       4924          0          0          0
-/+ buffers/cache:         95       4924
Swap:            0          0          0
Total:        5020         95       4924
 
Last edited by a moderator:
Was ich jetzt gesehen habe. Ich habe 2 mal Putty Fenster offen gelassen in einem war top am Laufen und im anderen habe ich gewartet, bis die Meldung kommt das kein Hautspeicher mehr verfügbar ist. Als es so weit war zeigte mir Top das zu meinem erstaunen an:

Code:
top - 23:08:11 up 7 min,  2 users,  load average: 0.00, 0.02, 0.00
Tasks:  47 total,   1 running,  46 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   5140764k total,   114060k used,  5026704k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
24242 root      18   0 32888  28m 3140 S    0  0.6   0:01.56 spamd
24243 popuser   18   0 32888  26m 1096 S    0  0.5   0:00.00 spamd
24422 wwwrun    17   0 57240  22m 5820 S    0  0.5   0:00.45 httpd2-prefork
24218 mysql     17   0  135m  18m 4956 S    0  0.4   0:00.30 mysqld
24416 root      18   0 44648  17m  11m S    0  0.4   0:00.34 httpd2-prefork
24418 wwwrun    15   0 48968  15m 4412 S    0  0.3   0:00.77 httpd2-prefork
24482 wwwrun    16   0 46884  11m 2804 S    0  0.2   0:00.05 httpd2-prefork
24146 named     25   0 55916 9808 2032 S    0  0.2   0:00.03 named
24420 wwwrun    15   0 44916 8812 1692 S    0  0.2   0:00.00 httpd2-prefork
24421 wwwrun    17   0 44916 8812 1692 S    0  0.2   0:00.00 httpd2-prefork
24419 wwwrun    15   0 44784 8268 1264 S    0  0.2   0:00.00 httpd2-prefork
24417 wwwrun    15   0 43792 6484  480 S    0  0.1   0:00.00 httpd2-prefork
24526 root      18   0  151m 4460 3052 S    0  0.1   0:00.04 zarafa-server
25626 root      25   0 39732 3928 3360 S    0  0.1   0:00.02 zarafa-monitor
25652 root      18   0 11516 3140 2400 S    0  0.1   0:00.05 sshd
25751 root      18   0 11372 3128 2400 S    0  0.1   0:00.05 sshd
25636 root      15   0 22628 2928 2212 S    0  0.1   0:00.01 zarafa-spooler
25872 root      15   0  5368 2444 1716 S    0  0.0   0:00.16 bash
25715 root      15   0  5244 2404 1676 S    0  0.0   0:00.09 bash
24478 sw-cp-se  15   0  4920 2156 1396 S    0  0.0   0:00.02 sw-cp-serverd
26527 root      18   0 24820 1520 1220 S    0  0.0   0:00.00 authpsa
25757 root      15   0 24792 1488 1188 S    0  0.0   0:00.00 authpsa
24174 root      25   0  2940 1292 1104 S    0  0.0   0:00.00 mysqld_safe
24004 root      18   0 44532 1156  796 S    0  0.0   0:00.07 rsyslogd
25602 root      18   0 11000 1104  604 S    0  0.0   0:00.00 zarafa-ical
24078 root      15   0  6488 1096  664 S    0  0.0   0:00.01 sshd
25749 root      15   0  2436 1080  852 R    0  0.0   0:00.43 top
25637 root      18   0 12256 1076  504 S    0  0.0   0:00.00 zarafa-spooler
25603 root      25   0 11004  972  464 S    0  0.0   0:00.00 zarafa-ical
25616 root      25   0 18952  916  512 S    0  0.0   0:00.00 zarafa-licensed
24086 root      18   0  2580  888  720 S    0  0.0   0:00.00 xinetd
24033 root      18   0  3636  856  664 S    0  0.0   0:00.00 courierlogger
24065 root      18   0  3636  856  664 S    0  0.0   0:00.00 courierlogger
24052 root      18   0  5060  788  560 S    0  0.0   0:00.00 couriertcpd
24094 root      18   0  2340  784  628 S    0  0.0   0:00.00 cron
24031 root      21   0  5060  756  532 S    0  0.0   0:00.00 couriertcpd
24042 root      25   0  5060  744  520 S    0  0.0   0:00.00 couriertcpd
24064 root      25   0  5060  744  520 S    0  0.0   0:00.00 couriertcpd
24067 root      25   0  3504  692  512 S    0  0.0   0:00.00 courierlogger
24045 root      25   0  3504  688  512 S    0  0.0   0:00.00 courierlogger
21976 root      20  -4  2352  656  384 S    0  0.0   0:00.00 udevd
24295 qmaill    18   0  1780  488  416 S    0  0.0   0:00.00 splogger
24294 qmails    15   0  1828  404  324 S    0  0.0   0:00.00 qmail-send
24297 qmailr    16   0  1804  392  296 S    0  0.0   0:00.00 qmail-rspawn
    1 root      15   0  1012  380  324 S    0  0.0   0:00.06 init
24296 root      23   0  1808  364  276 S    0  0.0   0:00.00 qmail-lspawn
24298 qmailq    25   0  1776  348  288 S    0  0.0   0:00.00 qmail-clean

Habe die mycnf erstmal wieder so abgeändert dass der innodb part ausgeklammer ist. So wie es war. Nun läuft alles wieder. Testen wir es morgen noch mal.
 
Last edited by a moderator:
my.cnf

Code:
[client]
port		                = 3306
socket		                = /var/lib/mysql/mysql.sock

[mysqld]
port		                = 3306
socket		                = /var/lib/mysql/mysql.sock
datadir	= /var/lib/mysql
skip-locking
key_buffer                      = 16M
max_allowed_packet              = 32M
table_cache                     = 1024 
open_files_limit                = 2048
sort_buffer_size                = 512K
net_buffer_length               = 8K
read_buffer_size                = 256K
read_rnd_buffer_size            = 512K
myisam_sort_buffer_size         = 8M
query_cache_size                = 24M
thread_cache_size               = 10M
max_heap_table_size             = 64M
tmp_table_size                  = 64M
max_connections                 = 50

long_query_time                 = 5
expire_logs_days                = 60
log-bin=mysql-bin

skip-slave-start                = 1
server-id=1
#binlog_format                   = mixed
innodb_file_per_table           = 1
innodb_buffer_pool_size         = 500M
innodb_additional_mem_pool_size = 32M
innodb_data_home_dir            = /var/lib/mysql/
innodb_data_file_path           = ibdata1:10M:autoextend
innodb_autoextend_increment     = 10
innodb_log_group_home_dir       = /var/lib/mysql/
innodb_log_files_in_group       = 3
innodb_log_file_size            = 250M
innodb_log_buffer_size          = 16M
innodb_flush_log_at_trx_commit  = 1
innodb_flush_method             = O_DIRECT
innodb_thread_concurrency       = 5


# The safe_mysqld script
[safe_mysqld]
log-error                       = /var/log/mysqld.log
datadir	                        = /var/lib/mysql
socket		                = /var/lib/mysql/mysql.sock

[mysqldump]
socket		                = /var/lib/mysql/mysql.sock
quick
max_allowed_packet              = 16M

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

[isamchk]
key_buffer                     = 20M
sort_buffer_size               = 20M
read_buffer                    = 2M
write_buffer                   = 2M

[myisamchk]
key_buffer                     = 20M
sort_buffer_size               = 20M
read_buffer                    = 2M
write_buffer                   = 2M

[mysqlhotcopy]
interactive-timeout

[mysqld_multi]
mysqld                         = /usr/bin/mysqld_safe
mysqladmin                     = /usr/bin/mysqladmin
log                            = /var/log/mysqld_multi.log
 
tuning-primer.sh Part1

Code:
#!/usr/bin/env bash

#########################################################################
#									#
#	MySQL performance tuning primer script				#
#	Writen by: Matthew Montgomery <mmontgomery@mysql.com>		#
#	Inspired by: MySQLARd (http://gert.sos.be/demo/mysqlar/)	#
#	Version: 1.3-r3		Released: 2007-02-15			#
#	Licenced under GPLv2                                            #
#									#
#########################################################################

#########################################################################
#									#
# Little known feature: 1st argument is execution mode			#
#									#
#	Usage: ./tuning-primer.sh [ mode ] 				#
#									#
#	Available Modes: 						#
#		all : 		perform all checks			#
#		prompt : 	prompt for login credintials and socket	#
#				and execution mode			#
# 		mem, memory : 	run checks for tunable options which	#
#				effect memory usage			#
#		disk, file :	run checks for options which effect	#
#				i/o performance or file handle limits	#
#		innodb :	run InnoDB checks /* to be improved */	# 
#		misc : 		run checks for that don't categorise	#
#				well Slow Queries, Used Connections,	#
#				and Worker Threads			#
#########################################################################
#									#
# Set this socket variable ONLY if you have multiple instances running	# 
# or we are unable to find your socket, and you don't want to to be	#
# prompted for input each time you run this script.			#
#									#
#########################################################################
socket=

function cecho ()		

## -- Function to easliy print colored text -- ##

				# Color-echo.
				# Argument $1 = message
				# Argument $2 = color
{
export black='\E[0m\c'
export boldblack='\E[1;0m\c'
export red='\E[31m\c'
export boldred='\E[1;31m\c'
export green='\E[32m\c'
export boldgreen='\E[1;32m\c'
export yellow='\E[33m\c'
export boldyellow='\E[1;33m\c'
export blue='\E[34m\c'
export boldblue='\E[1;34m\c'
export magenta='\E[35m\c'
export boldmagenta='\E[1;35m\c'
export cyan='\E[36m\c'
export boldcyan='\E[1;36m\c'
export white='\E[37m\c'
export boldwhite='\E[1;37m\c'

local default_msg="No message passed."
				# Doesn't really need to be a local variable.

message=${1:-$default_msg}	# Defaults to default message.
color=${2:-$black}		# Defaults to black, if not specified.

  echo -e "$color"
  echo -e "$message"
  tput sgr0			# Reset to normal.
  echo -e "$black"
  return
} 

function print_banner () {

## -- Banner -- ##

cecho "\t\c " $black
cecho "-- MYSQL PERFORMANCE TUNING PRIMER --" $boldblue
cecho "\t     - By: Matthew Montgomery -" $black

}

## -- Find the location of the mysql.sock file -- ##

function check_for_socket () {
	if [ -z "$socket" ] ; then
		if [ -S /var/lib/mysql/mysql.sock ] ; then
			socket=/var/lib/mysql/mysql.sock
		elif [ -S /tmp/mysql.sock ] ; then
			socket=/tmp/mysql.sock
		else
			ps_socket=`netstat -ln | egrep "mysql(d)?\.sock" | awk '{ print $9 }'`
			if [ -S "$ps_socket" ] ; then
			socket=$ps_socket
			fi
		fi
	fi
	if [ -S "$socket" ] ; then
		echo UP > /dev/null
	else
		cecho "\c"
		cecho "No valid socket file \"$socket\" found!" $boldred
		cecho "The mysqld process is not running or it is installed in a custom location." $red
		cecho "If you are sure mysqld is running, execute script in \"prompt\" mode or set " $red
		cecho "the socket= variable at the top of this script" $red
		exit 1
	fi
}


function check_for_plesk_passwords () {

## -- Check for the existance of plesk and login using it's credentials -- ##

	if [ -f /etc/psa/.psa.shadow ] ; then
	        mysql="mysql -S $socket -u admin -p`cat /etc/psa/.psa.shadow`"
	        mysqladmin="mysqladmin -S $socket -u admin -p`cat /etc/psa/.psa.shadow`"
	else
	        mysql="mysql -S $socket"
	        mysqladmin="mysqladmin -S $socket"
	fi
}

function check_mysql_login () {

## -- Test for running mysql -- ##

	is_up=`$mysqladmin ping 2>&1`
	if [ "$is_up" = "mysqld is alive" ] ; then
		echo UP > /dev/null
	elif [ "$is_up" != "mysqld is alive" ] ; then
		cecho "\n\c"
		cecho "- INITIAL LOGIN ATTEMPT FAILED -\n" $boldred
		if [ -z $prompted ] ; then
		find_webmin_passwords
		else
			return 1
		fi
		
	else 
		cecho "Unknow exit status" $red
		exit -1
	fi
}

function final_login_attempt () {
        is_up=`$mysqladmin ping 2>&1`
        if [ "$is_up" = "mysqld is alive" ] ; then
                echo UP > /dev/null
        elif [ "$is_up" != "mysqld is alive" ] ; then
                cecho "- FINAL LOGIN ATTEMPT FAILED -\n" $boldred
		cecho "Unable to log into socket: $socket" $boldred
                exit 1
        fi
}

function second_login_failed () {

## -- create a ~/.my.cnf and exit when all else fails -- ##

	cecho "- RETRY LOGIN ATTEMPT FAILED -\n" $boldred
	cecho "Could not auto detect login info!\n"
	read -p "Do you have your login handy ? [y/N] : "
	case $REPLY in 
		yes | y | Y | YES)
		answer1='yes'
		read -p "User: " user
		read -rsp "Password: " pass
		export mysql="$mysql -u$user -p$pass"
		export mysqladmin="$mysqladmin -u$user -p$pass"
		;;
		*)
		cecho "\nPlease create a valid login to MySQL"
		cecho "Or, set correct values for  'user=' and 'password=' in ~/.my.cnf"
		;;
	esac
	cecho "\n\c"
	read -p "Would you like me to create a ~/.my.cnf file for you? [y/N] : "
        case $REPLY in
	        yes | y | Y | YES)
		answer2='yes'
		if [ ! -f ~/.my.cnf ] ; then
			umask 077
			echo -e "[client]\nuser=$user\npassword=$pass" > ~/.my.cnf
			if [ "$answer1" != 'yes' ] ; then
				exit 1
			else
				final_login_attempt
				return 0
			fi
		else
			cecho "\n~/.my.cnf already exists!\n" $boldred
			read -p "Replace ? [y/N] : "
			if [ "$REPLY" = 'y' ] || [ "$REPLY = 'Y' " ] ; then 
			echo -e "[client]\nuser=$user\npassword=$pass" > ~/.my.cnf
				if [ "$answer1" != 'yes' ] ; then
					exit 1
				else
					final_login_attempt
					return 0
				fi
			else
				cecho "Please set the 'user=' and 'password=' values in ~/.my.cnf"
				exit 1
			fi
		fi
		;;
		*)
		if [ "$answer1" != 'yes' ] ; then
			exit 1
		else
			final_login_attempt
			return 0
		fi
		;;
	esac
}

function find_webmin_passwords () {

## -- populate the .my.cnf file using values harvested from Webmin -- ##

	cecho "Testing Stored for passwords:\c"
	if [ -f /etc/webmin/mysql/config ] ; then
		user=`grep ^login= /etc/webmin/mysql/config | cut -d "=" -f 2`
		pass=`grep ^pass= /etc/webmin/mysql/config | cut -d "=" -f 2`
		if [  $user ] && [ $pass ] && [ ! -f ~/.my.cnf  ] ; then
			cecho "Setting login info as User: $user Password: $pass"
			touch ~/.my.cnf
			chmod 600 ~/.my.cnf
			echo -e "[client]\nuser=$user\npassword=$pass" > ~/.my.cnf 
			cecho "Retrying login"
			is_up=`$mysqladmin ping 2>&1`
			if [ "$is_up" = "mysqld is alive"  ] ; then
				echo UP > /dev/null
			else
				second_login_failed
			fi
		echo
		else
			second_login_failed
		echo
		fi
	else
	cecho " None Found\n" $boldred
		second_login_failed
	fi
}

#########################################################################
#									#
#  Function to pull MySQL status variable				#
#									#
#  Call using :								#
#	mysql_status \'Mysql_status_variable\' bash_dest_variable	#
#									#
#########################################################################

function mysql_status () {
	local status=`$mysql -Bse "show /*!50000 global */ status like $1" | 
		awk '{ print $2 }'`
	export "$2"=$status
}
 
Back
Top