LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 06-11-2008, 02:28 AM   #1
linuxshadow
LQ Newbie
 
Registered: Jun 2008
Posts: 18

Rep: Reputation: 0
MySQL Master-SLave Replication??


I Followed the doc: http://members.cox.net/midian/howto/...eplication.htm for setting Up Master-Slave Replication but stuck with the following step:

Code:
mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin',MASTER_LOG_POS=/var/log/mysqld.log;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/var/log/mysqld.log' at line 1
What is the correct command for this?

Alternately I tried entering this into /etc/my.cnf on client side:

Code:
server-id=2
master-host=10.14.2.146
master-user=repl
master-password=mysql123
master-connect-retry=60
replicate-do-db=helpcore
master-port = 3306
When I run the following commad at slave side:
Code:
mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000038 |    14152 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

mysql>
The same at the Master side are:
Code:
mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000004 |     2383 |              | mysql            |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

mysql>
I followed step by step configuration but its throwing error:
Code:
mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin',MASTER_LOG_POS=/var/log/mysqld.log;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/var/log/mysqld.log' at line 1
Pls Help !!!
 
Old 06-11-2008, 05:30 AM   #2
p_s_shah
Member
 
Registered: Mar 2005
Location: India
Distribution: RHEL 3/4, Solaris 8/9/10, Fedora 4/8, Redhat Linux 9
Posts: 228
Blog Entries: 1

Rep: Reputation: 34
***************
Post was wrongly updated. So, removing post to avoid confusion.
One can still refer following links.
***************

Below links also implements the same concept of Replication in some more details.
Refer below links:

http://howtoforge.com/loadbalanced_mysql_cluster_debian
http://howtoforge.com/mysql_master_master_replication
http://howtoforge.com/mysql_database_replication

And other mysql related links on the site.

Last edited by p_s_shah; 06-16-2008 at 01:40 PM.
 
Old 06-11-2008, 07:47 AM   #3
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Actually MASTER_LOG_POS is the actual position in the log file it's currently on and the MASTER_LOG_FILE is the actual file it's currently on which would be mysql-bin.000038

This is what they should look like in your query:

MASTER_LOG_FILE='mysql-bin.000038', MASTER_LOG_POS=2383;

As for the error you are getting, you would have to wrap the /var/log/mysqld around ' ' if it was actually the correct way.

The tutorial is correct that you're following, you're just putting in the wrong values and anything that isn't just a numerical value always has to have ' ' around the value.
 
Old 06-12-2008, 09:49 AM   #4
linuxshadow
LQ Newbie
 
Registered: Jun 2008
Posts: 18

Original Poster
Rep: Reputation: 0
mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-replication.log',MASTER_LOG_POS=/var/log;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/var/log' at line 1
mysql>
 
Old 06-12-2008, 09:54 AM   #5
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
MASTER_LOG_POS needs to be an integer not wrapped in quotes like trickykid said, not a /var/log.

hth

Last edited by lord-fu; 06-12-2008 at 09:55 AM.
 
Old 06-12-2008, 04:09 PM   #6
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Quote:
Originally Posted by linuxshadow View Post
mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-replication.log',MASTER_LOG_POS=/var/log;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/var/log' at line 1
mysql>
Did you even read my reply? I even gave you the correct values from your first post and output.

This is what it should look like:

Code:
mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000038', MASTER_LOG_POS=2383;
But if you're master is still running, you'll need to rerun the:

Code:
mysql> show master status;
To get the new MASTER_LOG_FILE in use and the MASTER_LOG_POS integer value.
 
Old 06-12-2008, 11:42 PM   #7
linuxshadow
LQ Newbie
 
Registered: Jun 2008
Posts: 18

Original Poster
Rep: Reputation: 0
Thanks for the reply.I did changed the command but why its not starting the slave

mysql> CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.0000038',MASTER_LOG_POS=2383;
Query OK, 0 rows affected (0.00 sec)

mysql> start slave;
ERROR 1200 (HY000): The server is not configured as slave; fix in config file or with CHANGE MASTER TO
mysql> show slave status;
Empty set (0.00 sec)

The my.cnf file entry I made is :

Code:
server-id=2
master-host=10.14.2.146
master-user=repl
master-password=mysql123
master-connect-retry=60
replicate-do-db=helpcore
master-port = 3306

Last edited by linuxshadow; 06-12-2008 at 11:44 PM.
 
Old 06-13-2008, 09:22 AM   #8
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
Try running the same query but specifying the host, user, password which seems to help when first initializing the slave even though it's in your config but since you don't specify the LOG_POS and LOG_FILE since you wouldn't want to start from that same position after a reboot as it changes:

Code:
mysql> CHANGE MASTER TO MASTER_HOST='10.14.2.146', MASTER_USER='repl', MASTER_PASSWORD='mysql123', MASTER_PORT=3307, MASTER_LOG_FILE='mysql-bin.000038', MASTER_LOG_POS=2383;

mysql> start slave;
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LDAP in master-slave replication aravind1024004 Linux - Networking 1 04-20-2008 12:18 PM
LDAP in master-slave replication aravind1024004 Linux - Server 1 04-10-2008 10:21 PM
LDAP in master-slave replication aravind1024004 Linux - Networking 1 04-09-2008 08:54 PM
Multiple Master to one Slave for MySQL Replication Swakoo Linux - General 0 03-31-2007 04:40 AM
OpenLDAP Replication Master\Slave paul_mat Linux - Networking 3 10-18-2006 07:37 AM


All times are GMT -5. The time now is 11:59 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration