PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : mysql cluster -



netzmeister
29.07.10, 15:43
Hallo,

ich habe einen eingerichtet. Der Management Server zeigt Folgendes



ndb_mgm> show
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.5.21 (mysql-5.1.39 ndb-7.0.9, Nodegroup: 0)
id=3 @192.168.5.22 (mysql-5.1.39 ndb-7.0.9, Nodegroup: 0, Master)

[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.5.2 (mysql-5.1.39 ndb-7.0.9)

[mysqld(API)] 2 node(s)
id=4 @192.168.5.12 (mysql-5.1.39 ndb-7.0.9)
id=5 @192.168.5.11 (mysql-5.1.39 ndb-7.0.9)

ndb_mgm>


Hier die Konfigurationsdatei des Management Servers:



root@mgm:/var/lib/mysql-cluster# vi config.ini
[ndbd default]
# Options affecting ndbd processes on all data nodes:
NoOfReplicas=2 # Number of replicas
DataMemory=80M # How much memory to allocate for data storage
IndexMemory=18M # How much memory to allocate for index storage
# For DataMemory and IndexMemory, we have used the
# default values. Since the "world" database takes up
# only about 500KB, this should be more than enough for
# this example Cluster setup.

[tcp default]
# TCP/IP options:
portnumber=2202 # This the default; however, you can use any
# port that is free for all the hosts in the cluster
# Note: It is recommended that you do not specify the port
# number at all and simply allow the default value to be used
# instead

[ndb_mgmd]
# Management process options:
hostname=192.168.5.2 # Hostname or IP address of MGM node
datadir=/var/lib/mysql-cluster # Directory for MGM node log files

[ndbd]
# Options for data node "A":
# (one [ndbd] section per data node)
hostname=192.168.5.21 # Hostname or IP address
datadir=/var/lib/mysql-cluster # Directory for this data node's data files
BackupDataDir=/var/lib/mysql-cluster/backup
DataMemory=2048M

[ndbd]
# Options for data node "B":
hostname=192.168.5.22 # Hostname or IP address
datadir=/var/lib/mysql-cluster # Directory for this data node's data files
BackupDataDir=/var/lib/mysql-cluster/backup
DataMemory=2048M

[mysqld]
# SQL node options:
hostname=192.168.5.11 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)

[mysqld]
# SQL node options:
hostname=192.168.5.12 # Hostname or IP address
# (additional mysqld connections can be
# specified for this node for various
# purposes such as running ndb_restore)


Hier die Konfiguration des ersten SQL-Nodes:



[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

# 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]
#
# * Basic Settings
#

#
# * IMPORTANT
# If you make changes to these settings and your system uses apparmor, you may
# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#

user = mysql
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
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

log_error = /var/log/mysql/error.log

# 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


ndbcluster
ndb-connectstring=192.168.5.2

#
[mysql_cluster]
ndb-connectstring=192.168.5.2


[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/



Hier die Konfiguration des ersten Storagenodes:



[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

# 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]
#
# * Basic Settings
#

#
# * IMPORTANT
# If you make changes to these settings and your system uses apparmor, you may
# also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#

user = mysql
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
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

log_error = /var/log/mysql/error.log

# 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

[mysql_cluster]
ndb-connectstring=host=192.168.5.2 # IP address of the management server

[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/


Auf den Storagenodes kommen keine Dateien an. Die Datenbanken und Tabellen werden auf den SQL Nodes angelegt. Ist das richtig so?
Sieht doch alles gut aus, oder habe ich einen Denk oder Konfigurationsfehler.?

Die Doku ist etwas schwer verständlich.

Viele Grüße

Eicke

netzmeister
29.07.10, 17:05
Update:

Anscheinend ist alles in Ordnung.

Ich versuche nun einen Tabelle zu clustern:
Das mache ich auf einem der SQL Nodes!




mysql> use database
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> alter table tab engine=ndbcluster;
ERROR 1114 (HY000): The table '#sql-9dc_23a' is full
mysql>



Im Cluster Client kann ich folgende Ausgabe sehen:




ndb_mgm> show
Connected to Management Server at: localhost:1186
Cluster Configuration
---------------------
[ndbd(NDB)] 2 node(s)
id=2 @192.168.5.21 (mysql-5.1.39 ndb-7.0.9, Nodegroup: 0)
id=3 @192.168.5.22 (mysql-5.1.39 ndb-7.0.9, Nodegroup: 0, Master)

[ndb_mgmd(MGM)] 1 node(s)
id=1 @192.168.5.2 (mysql-5.1.39 ndb-7.0.9)

[mysqld(API)] 2 node(s)
id=4 @192.168.5.12 (mysql-5.1.39 ndb-7.0.9)
id=5 @192.168.5.11 (mysql-5.1.39 ndb-7.0.9)

ndb_mgm> Node 3: Index usage increased to 83%(1956 8K pages of total 2336)
Node 2: Index usage increased to 85%(2005 8K pages of total 2336)
Node 3: Index usage increased to 90%(2122 8K pages of total 2336)
Node 2: Index usage increased to 92%(2154 8K pages of total 2336)
Node 3: Index usage increased to 99%(2326 8K pages of total 2336)
Node 2: Index usage increased to 100%(2336 8K pages of total 2336)
Node 2: Index usage decreased to 12%(289 8K pages of total 2336)
Node 3: Index usage decreased to 12%(289 8K pages of total 2336)



Mit kleinen Tabellen geht es. Die große Tabelle ist etwas über ein GB groß, ..

Hier habe ich etwas dazu gefunden: http://dev.mysql.com/doc/refman/5.1/de/mysql-cluster-faq.html

Kann mir jemand helfen?

Viele Grüße

Eicke

Oliski
30.07.10, 14:24
Glückwunsch, du hast das Hauptproblem des NDB Clusters rausgefunden.

netzmeister
30.07.10, 17:02
Hallo, und Danke an Oliski!

Ich habe nun fast einen Tag mit Recherche und Test der Feineinstellungen
verbracht. Meine größte Tabelle mit über 1,5 GB konnte ich danach auch clustern.

Viele Grüße

Eicke