-1

I want to create a master-slave replication on ubuntu servers. both(master and slave) on different servers. i made my.cnf(without coments) file on master as:

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
[mysqld]
bind-address=my_server_ip
server-id=1
log_bin=/var/log/mysql/mysql-bin.log
binlog_do_db=indicators

then i restart using sudo service mysql restart and get the following error:

Job for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details

but when i set bind-address=127.0.0.1 it works fine.

below is the reference is used which says bind-address should be the address of master server

https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql

but it contadicts with below link which says(under comments section) bind-address is the ip of slave

https://dev.mysql.com/doc/refman/5.7/en/replication-howto-masterbaseconfig.html

systemctl status mysql.service as in above error code

● mysql.service - MySQL Community Server
  Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: 
enabled)
Active: activating (start-post) (Result: exit-code) since Sat 2017-11-04 
07:12:12 UTC; 11s ago
Process: 25213 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
Process: 25205 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre 
(code=exited, status=0/SUCCESS)
Main PID: 25213 (code=exited, status=1/FAILURE);         : 25214 (mysql-
systemd-s)
   Tasks: 2
   Memory: 400.0K
   CPU: 250ms
   CGroup: /system.slice/mysql.service
       └─control
         ├─25214 /bin/bash /usr/share/mysql/mysql-systemd-start post
         └─25267 sleep 1

Nov 04 07:12:12 fundexpert-test-r systemd[1]: mysql.service: Service hold-
off time over, scheduling restart.
Nov 04 07:12:12 fundexpert-test-r systemd[1]: Stopped MySQL Community 
Server.
Nov 04 07:12:12 fundexpert-test-r systemd[1]: Starting MySQL Community 
Server...
Nov 04 07:12:14 fundexpert-test-r systemd[1]: mysql.service: Main process 
exited, code=exited, status=1/FAILURE

journalctl -xe says:

-- Subject: Unit mysql.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has failed.
--
-- The result is failed.
Nov 04 07:12:42 fundexpert-test-r systemd[1]: mysql.service: Unit entered 
failed state.
Nov 04 07:12:42 fundexpert-test-r systemd[1]: mysql.service: Failed with 
result 'exit-code'.
Nov 04 07:12:43 fundexpert-test-r systemd[1]: mysql.service: Service hold-
off time over, scheduling restart.
Nov 04 07:12:43 fundexpert-test-r systemd[1]: Stopped MySQL Community 
Server.
-- Subject: Unit mysql.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysql.service has finished shutting down.
Nov 04 07:12:43 fundexpert-test-r systemd[1]: Starting MySQL Community 
Server...
-- Subject: Unit mysql.service has begun start-up
-- Defined-By: systemd
vic
  • 29
  • 9

1 Answers1

0

below is the reference is used which says bind-address should be the address of master server

No it doesn't. It says 'replace the standard IP address with the IP address of server'. The word 'master' does not appear.

but it contadicts with below link which says(under comments section) bind-address is the ip of slave

No it doesn't. It says 'you will have to make sure that the slave's address or hostname is matched by the bind-address setting'.

You cannot bind to a non-local IP address.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • they used following ip's:12.34.56.789- Master Database 12.23.34.456- Slave Database and it used bind-address=12.34.56.789, so it meant they used masters database ip. – vic Nov 04 '17 at 09:52
  • You need to read more carefully. That is in a section entitled 'Step One—Configure the Master Database' and beginning with 'open up the mysql configuration file on the master server.' The other sections is about configuring the slave. A section about configuring the master cannot contract a section about configuring the slave. – user207421 Nov 04 '17 at 23:03