PowerDNS Mysql Replication

Neogreen

Member
Hey,

Ich versuche grade folgende Tutorials umzusetzen:
http://www.howtoforge.com/installing-powerdns-with-mysql-backend-and-poweradmin-on-debian-squeeze
und
http://www.howtoforge.com/mysql_database_replication_p2

Beim zweiten bekomme ich das Problem sofern ich folgenden Befehl ausführen will: LOAD DATA FROM MASTER; folgt folgende Meldung:

ERROR 1218 (08S01): Error connecting to master: Master is not configured

Obwohl die Master DB extern läuft und alles durchgeführt wurde das im Tutorial steht. Dem entsprechend an powerdns angepasst allerdings kommt auch bei folgender aus gabe: SHOW MASTER STATUS; nur:
Empty set (0.00 sec)

Master /etc/mysql/my.cnf
PHP:
#
# 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

# 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
#
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
language        = /usr/share/mysql/english
skip-external-locking
log-bin = /var/log/mysql/mysql-bin.log
binlog-do-db=powerdns
server-id=1
#
# 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



[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/
Slave /etc/mysql/my.cnf
PHP:
#
# 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

# 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
#
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
language        = /usr/share/mysql/english
skip-external-locking
server-id=2
master-host=109.169.3.236
master-user=power
master-password=*****
master-connect-retry=60
replicate-do-db=powerdns
#
# 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



[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/
Kann mir wer helfen?
 
Last edited by a moderator:
Danke, nun hab ich aber noch ein problem. Der Slave versucht sich immer Local zu verbinden obwohl in der config steht er möge sich woanders hin verbinden:

mysql> LOAD DATA FROM MASTER;
ERROR 1218 (08S01): Error connecting to master: Access denied for user 'powerdns'@'37.247.52.114' (using password: YES)

Die IP müsste egtl mit 109 anfangen
 
Hilft nur bedingt... Mysql macht immer noch was es will. SLAVE Status gibt allerdings folgendes aus:

1045 | error connecting to master 'powerdns@109.169.3.236:3306' - retry-time: 60 retries: 86400 |

Passwort/Benutzer ist aber richtig...

Mit Phpmyadmin ist die anmeldung aber möglich am Master.
 
Last edited by a moderator:
Kommst du vom Slave per MySQL-Console zum Master?

Code:
mysql -u powerdns -p -h 109.169.3.236

Ist das Passwort _nicht_ länger als 32 Zeichen? (Länger wird truncated)

Wenn der Login oben auch fehlschlägt, dann prüf mal auf dem Master, ob der User 'powerdns'@'37.247.52.114' auch auf die DB zugreifen darf.

Code:
master-mysql> select User, Host from mysql.db where Db = 'powerdns';
 
Slave gibt folgendes aus:
PHP:
root@vserv08:~# mysql -u power -p -h 109.169.3.236
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 308
Server version: 5.1.66-0+squeeze1-log (Debian)

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
Es funktioniert und das Passwort ist kürzer als 32 Zeichen.

Nun wenn ich aber Local versuche oder eben dort folgendes Auszuführen:
PHP:
mysql> select User, Host from mysql.db where Db = 'powerdns';
ERROR 1142 (42000): SELECT command denied to user 'power'@'localhost' for table                                          'db'

Nicht wundern der externe user heisst power anstatt powerdns steht aber auch in der Config drin und mysql wurde neugestartet.
 
Hatte nun Select hinzugefügt nun geht es.
Ich kann dir allerdings mit deiner aussage grad nicht folgen... müssten beide Mysql Server etwa extern laufen????
 
müssten beide Mysql Server etwa extern laufen????

Nein. Nur der Master.
Aber der Slave-Host - bzw. der User 'power' muss vom Slave-Host auf die Tabelle powerdns zugreifen dürfen. Du müsstest also eine Ausgabe in etwa wie folgt bekommen:

Code:
+------+-----------+
| User | Host      |
+------+-----------+
| power | 127.0.0.1 |
| power | localhost |
| power | 37.247.52.114 |
+------+-----------+

In der Tabelle mysql.Db werden die Berechtigungen noch weiter eingeschränkt. Dort muss der User 'power' ebenfalls von '37.247.52.114' berechtigt sein. Ich kann dir nun aber aus dem Kopf nicht sagen, welche Berechtigungen der User da alles braucht für die Replikation.
 
Es kommt ja jetzt folgendes raus:

PHP:
root@vserv08:~# mysql -u power -p -h 109.169.3.236
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 438
Server version: 5.1.66-0+squeeze1-log (Debian)

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select User, Host from mysql.db where Db = 'powerdns';
+----------+---------------+
| User     | Host          |
+----------+---------------+
| powerdns | 127.0.0.1     |
| power    | 37.247.52.114 |
+----------+---------------+
2 rows in set (0.02 sec)


mysql> exit
Bye
 
Last edited by a moderator:
Nun gibt er folgendes aus, wenn ich auf den Slave denn befehl ausführe:
mysql> LOAD DATA FROM MASTER;
ERROR 1189 (08S01): Net error reading from master
 
Last edited by a moderator:
Warum willst Du eigentlich LOAD DATA FROM MASTER; verwenden? Ich persönlich finde den Import von Dumps die mit --master-data erstellt wurden sehr viel einfacher.

Ich habs mal wie Du probiert aber das wollte -warum auch immer - nicht so recht.
 
Habe ich nun auch importiert scheint aber trotzdem nicht zu funktionieren.
Ich kann auch in den logs von mysql nichts finden.

Laut Slave Status aktuell:

PHP:
mysql> show slave status \G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 109.169.3.236
                  Master_User: power
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000001
          Read_Master_Log_Pos: 1704
               Relay_Log_File: mysqld-relay-bin.000002
                Relay_Log_Pos: 703
        Relay_Master_Log_File: mysql-bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: powerdns
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 1704
              Relay_Log_Space: 859
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
1 row in set (0.00 sec)
 
Last edited by a moderator:
Nein er hatte die daten nicht rübergeschoben bzw die neuen einträge, habe nun Slave angehalten und Master Log pos neu gesetzt. Nun geht es.
Danke euch.
 
Back
Top