mysql replication

Discussion in 'Server Operation' started by tera7, Sep 22, 2007.

  1. tera7

    tera7 New Member

    Hello i try to do a database replication as i described at:

    http://www.howtoforge.com/mysql_database_replication


    but when i type this to mycnf

    log-bin = /var/log/mysql/mysql-bin.log
    binlog-do-db=exampledb
    server-id=1


    the mysql doesnt start

    Ofcourse i have the right values at these fields.
    Any suggestion?
    Thank you.
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Do you see any error messages? Are there any errors in your logs?
     
  3. tera7

    tera7 New Member

    i think that this is from log:


    070922 19:10:25 [Note] /usr/libexec/mysqld: Normal shutdown

    070922 19:10:25 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:10:25 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:10:25 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:10:25 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:10:25 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:10:25 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:10:25 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:10:25 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:10:25 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:10:27 [Note] /usr/libexec/mysqld: Shutdown complete

    070922 19:10:27 mysqld ended

    070922 19:10:28 mysqld started
    /usr/libexec/mysqld: File '/var/log/mysql/mysql-bin.index' not found (Errcode: 2)
    070922 19:10:28 [ERROR] Aborting

    070922 19:10:28 [Note] /usr/libexec/mysqld: Shutdown complete

    070922 19:10:28 mysqld ended

    070922 19:11:10 mysqld started
    /usr/libexec/mysqld: File '/var/log/mysql/mysql-bin.index' not found (Errcode: 2)
    070922 19:11:10 [ERROR] Aborting

    070922 19:11:10 [Note] /usr/libexec/mysqld: Shutdown complete

    070922 19:11:10 mysqld ended

    070922 19:12:09 mysqld started
    070922 19:12:09 [Note] /usr/libexec/mysqld: ready for connections.
    Version: '5.0.27' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
    070922 19:18:19 [Note] /usr/libexec/mysqld: Normal shutdown

    070922 19:18:19 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:18:21 [Note] /usr/libexec/mysqld: Shutdown complete

    070922 19:18:21 mysqld ended

    070922 19:18:21 mysqld started
    error: Found option without preceding group in config file: /etc/my.cnf at line: 15
    Fatal error in defaults handling. Program aborted
    070922 19:18:22 mysqld ended

    070922 19:19:15 mysqld started
    070922 19:19:15 [Note] /usr/libexec/mysqld: ready for connections.
    Version: '5.0.27' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
    070922 19:25:01 [Note] /usr/libexec/mysqld: Normal shutdown

    070922 19:25:01 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:25:01 [ERROR] /usr/libexec/mysqld: Sort aborted
    070922 19:25:03 [Note] /usr/libexec/mysqld: Shutdown complete

    070922 19:25:03 mysqld ended

    070922 19:25:04 mysqld started
    /usr/libexec/mysqld: File '/var/log/mysqld.index' not found (Errcode: 13)
    070922 19:25:04 [ERROR] Aborting

    070922 19:25:04 [Note] /usr/libexec/mysqld: Shutdown complete

    070922 19:25:04 mysqld ended

    070922 19:25:57 mysqld started
    070922 19:25:57 [Note] /usr/libexec/mysqld: ready for connections.
    Version: '5.0.27' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
     
  4. falko

    falko Super Moderator Howtoforge Staff

    What's the output of
    Code:
    ls -l /var
    and
    Code:
    ls -l /var/log
    ? I think it could be a permissions problem.
     
  5. tera7

    tera7 New Member

    ok this is


    Code:
    Last login: Wed Sep 26 11:10:03 2007 from athedsl-258585.home.otenet.gr
    [root@GTO003 ~]# ls -l /var
    total 172
    drwxr-xr-x  2 root root  4096 Jan 23  2007 account
    drwxr-xr-x 11 root root  4096 Aug 20 19:04 cache
    drwxr-xr-x  2 root root  4096 Aug 20 19:04 crash
    drwxr-xr-x  2 root root  4096 Oct 29  2006 cvs
    drwxr-xr-x  3 root root  4096 Aug 20 18:51 db
    drwxr-xr-x  3 root root  4096 Aug 20 18:50 empty
    drwxr-xr-x  2 root root  4096 Oct 11  2006 games
    drwxr-xr-x 19 root root  4096 Aug 21 15:19 lib
    drwxr-xr-x  2 root root  4096 Oct 11  2006 local
    drwxrwxr-x  5 root lock  4096 Sep 26 05:10 lock
    drwxr-xr-x  9 root root  4096 Sep 23 05:09 log
    lrwxrwxrwx  1 root root    10 Aug 20 18:44 mail -> spool/mail
    drwxr-x---  4 root named 4096 Aug 20 19:05 named
    drwxr-xr-x  2 root root  4096 Oct 11  2006 nis
    drwxr-xr-x  2 root root  4096 Oct 11  2006 opt
    drwxr-xr-x  2 root root  4096 Oct 11  2006 preserve
    drwxr-xr-x  2 root root  4096 Oct  1  2006 racoon
    drwxr-xr-x 20 root root  4096 Sep 26 15:48 run
    drwxr-xr-x 13 root root  4096 Aug 20 18:50 spool
    drwxrwxrwt  2 root root  4096 Aug 21 18:05 tmp
    drwxr-xr-x  6 root root  4096 Jun 26 16:11 www
    drwxr-xr-x  3 root root  4096 May 10 15:33 yp
    [root@GTO003 ~]# ls -l /var/log
    total 38076
    -rw-r----- 1 root  root      2219 Sep 19 23:21 acpid
    -rw------- 1 root  root    101375 Aug 20 18:51 anaconda.log
    -rw------- 1 root  root     26898 Aug 20 18:51 anaconda.syslog
    -rw------- 1 root  root         0 Sep 23 05:09 boot.log
    -rw------- 1 root  root         0 Sep 16 05:10 boot.log.1
    -rw------- 1 root  root         0 Sep  9 05:09 boot.log.2
    -rw------- 1 root  root         0 Sep  2 05:09 boot.log.3
    -rw------- 1 root  root         0 Aug 26 05:09 boot.log.4
    -rw------- 1 root  utmp  19238784 Sep 26 16:16 btmp
    -rw------- 1 root  root    138223 Sep 26 16:20 cron
    -rw------- 1 root  root    230473 Sep 23 05:08 cron.1
    -rw------- 1 root  root    276878 Sep 16 05:10 cron.2
    -rw------- 1 root  root    279695 Sep  9 05:08 cron.3
    -rw------- 1 root  root    185262 Sep  2 05:08 cron.4
    drwxr-xr-x 2 lp    sys       4096 Sep 23 05:09 cups
    -rw-r--r-- 1 root  root     21376 Sep 19 23:18 dmesg
    -rw------- 1 root  root       672 Aug 21 15:19 faillog
    drwx------ 2 root  root      4096 Jun 26 16:11 httpd
    -rw-r--r-- 1 root  root     22776 Sep 26 16:23 lastlog
    drwxr-xr-x 2 root  root      4096 Aug 20 18:49 mail
    -rw------- 1 root  root    304830 Sep 26 15:01 maillog
    -rw------- 1 root  root    394856 Sep 23 05:09 maillog.1
    -rw------- 1 root  root    338814 Sep 16 05:10 maillog.2
    -rw------- 1 root  root    604735 Sep  9 05:09 maillog.3
    -rw------- 1 root  root   1459745 Sep  2 05:09 maillog.4
    -rw------- 1 root  root        47 Sep 23 05:09 messages
    -rw------- 1 root  root    112630 Sep 19 22:57 messages.1
    -rw------- 1 root  root    216010 Sep 14 17:50 messages.2
    -rw------- 1 root  root        47 Sep  2 05:09 messages.3
    -rw------- 1 root  root        47 Aug 26 05:09 messages.4
    -rw-r----- 1 mysql mysql    25679 Sep 26 11:16 mysqld.log
    drwx------ 2 root  root      4096 Dec  1  2006 ppp
    drwxr-xr-x 2 root  root      4096 Aug 21 13:09 prelink
    -rw-r--r-- 1 root  root     15022 Sep 26 05:12 rpmpkgs
    -rw-r--r-- 1 root  root     15022 Sep 22 05:10 rpmpkgs.1
    -rw-r--r-- 1 root  root     15022 Sep 15 05:10 rpmpkgs.2
    -rw-r--r-- 1 root  root     15022 Sep  8 05:10 rpmpkgs.3
    -rw-r--r-- 1 root  root     15022 Sep  1 05:50 rpmpkgs.4
    drwx------ 2 root  root      4096 Jun  5 16:39 samba
    -rw------- 1 root  root   1420814 Sep 26 16:23 secure
    -rw------- 1 root  root   4264096 Sep 23 05:08 secure.1
    -rw------- 1 root  root   2244942 Sep 16 03:56 secure.2
    -rw------- 1 root  root   3002081 Sep  9 05:04 secure.3
    -rw------- 1 root  root   3575088 Sep  2 03:10 secure.4
    -rw------- 1 root  root         0 Sep 23 05:09 spooler
    -rw------- 1 root  root         0 Sep 16 05:10 spooler.1
    -rw------- 1 root  root         0 Sep  9 05:09 spooler.2
    -rw------- 1 root  root         0 Sep  2 05:09 spooler.3
    -rw------- 1 root  root         0 Aug 26 05:09 spooler.4
    -rw------- 1 root  root         0 Aug 20 18:59 tallylog
    drwxr-xr-x 2 root  root      4096 Jul 19  2006 vbox
    -rw-rw-r-- 1 root  utmp     87936 Sep 26 16:23 wtmp
    -rw-rw-r-- 1 root  utmp     38016 Aug 31 12:31 wtmp.1
    -rw-r--r-- 1 root  root     12191 Aug 21 18:05 yum.log
    [root@GTO003 ~]#
    [root@GTO003 ~]#
     
  6. falko

    falko Super Moderator Howtoforge Staff

    Please try this:
    Code:
    mkdir /var/log/mysql
    touch /var/log/mysql/mysql-bin.log
    chown -R mysql:mysql /var/log/mysql
     
  7. tera7

    tera7 New Member

    OK this was the problem so i set it up BUT i come along with another problem when all was set the slave just replicated what was in the binlog 000001 and stoped but as i see my master has created other 2 binlogs 000002 and 000003 this is ok?

    Also at binlog 1 and 2 there is a stop and binolg hasn't thats why it
    is 10 times bigger.

    UPDATE:OK i see that master.info took the changes for the binlog but
    it doesn't work.
     
    Last edited: Sep 28, 2007
  8. falko

    falko Super Moderator Howtoforge Staff

    Please take a look at the logs on the slave. It should tell you if/what's wrong.
     
  9. tera7

    tera7 New Member

    Ok first of all thank you for your time.
    Now i start it again from the begining i have all set it good at master but although
    it creates binlogs can not read it through phpmyadmin (at my previous set it was readable)the log file of mysql shows nothing.
    At the slave i set as it has to be i also read other how to and a lot of things at mysql documentation.
    But at the log file shows that
    Code:
    070929 20:31:02 [Note] /usr/libexec/mysqld: Normal shutdown
    
    070929 20:31:02 [Note] Error reading relay log event: slave SQL thread was killed
    070929 20:31:02 [Note] /usr/libexec/mysqld: Shutdown complete
    
    070929 20:31:02  mysqld ended
    
    070929 20:31:04  mysqld started
    070929 20:31:04 [Warning] Neither --relay-log nor --relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-log=used-relay-bin' to avoid this problem.
    070929 20:31:04 [ERROR] Failed to open the relay log './GTO004-relay-bin.000001' (relay_log_pos 98)
    070929 20:31:04 [ERROR] Could not find target log during relay log initialization
    070929 20:31:04 [ERROR] Failed to initialize the master info structure
    070929 20:31:04 [Note] /usr/libexec/mysqld: ready for connections.
    Version: '5.0.27'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
    070929 20:49:36 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000001' at position 485, relay log './used-relay-bin.000001' position: 4
    070929 20:49:36 [Note] Slave I/O thread: connected to master '[email protected]:3306',  replication started in log 'mysql-bin.000001' at position 485
    070929 20:49:36 [ERROR] Error reading packet from server: Could not find first log file name in binary log index file ( server_errno=1236)
    070929 20:49:36 [ERROR] Got fatal error 1236: 'Could not find first log file name in binary log index file' from master when reading data from binary log
    070929 20:49:36 [Note] Slave I/O thread exiting, read up to log 'mysql-bin.000001', position 485

    Now i try to solve it from here because i have a large database and its difficult
    to start it from scratch.

    Thank you again for your attention to my problem.
     
  10. tera7

    tera7 New Member

    OK sudenly it seems that it is working i did'nt do something it just started to work THANK YOU for your help at this matter and many others that you have helped me :) .
     

Share This Page