Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ Set up MySQL master and slave servers under Ubuntu 14.04     - php performance monitoring module XHProf (Linux)

- Android Studio Getting Started Hello World (Programming)

- Oracle 11g maintenance partitions - Adding Partitions (Database)

- Linux Shell Scripting multithreading (Programming)

- C ++ stderr / stdout redirected to a file (Programming)

- Linux initialization init system - UpStart (Linux)

- Linux fixes fatal error: x264.h: No such file or directo (Linux)

- Echo Command Examples (Linux)

- CentOS 6.6 command-line automatic completion (Linux)

- How to modify the SQL Server auto-increment value and the corresponding solution (Database)

- Ubuntu 15.04 install Complete Guide (Linux)

- Figlet use (Linux)

- How to ensure the Linux SSH login security with one-time password (Linux)

- Ubuntu simple method to track multiple time zones (Linux)

- Java memory analysis tool uses detailed MAT (Programming)

- Oracle SQL statement to retrieve data paging table (Database)

- Implement binary search algorithm in C language (Programming)

- Detailed Linux platform chip programming process (Programming)

- Install the Red Hat Container Development Kit on OSX (Server)

- Convert MySQL date string to a NULL value exception handling (Database)

 
         
  Set up MySQL master and slave servers under Ubuntu 14.04
     
  Add Date : 2018-11-21      
         
         
         
  MySQL master-slave replication is asynchronous, sub-master / slave, there is a thread in the master terminal IO, IO and Sql threads exist at slave.

The most important place to build the environment that will mysql binary logging feature is turned on, the details I have not noticed in the course of the ride, fucked me for a long time.

surroundings:

My two virtual machines are using bridged mode of access is not recommended nat. First two virtual machines to set a fixed ip address, and your physical machine ip address within a segment, so it is similar to your virtual machine a LAN physical work.
Set a fixed ip address:

$ Sudo vim / etc / network / interfaces

as follows:

# Interfaces (5) file used by ifup (8) and ifdown (8)

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet static

address 192.168.1.252

netmask 255.255.255.0

gateway 192.168.1.1

$ Sudo /etc/init.d/networking restart

I address to each virtual machine is set to: 192.168.1.251 192.168.1.252 Gateway IP: 192.168.1.1

After setting, first ping each other in a virtual machine, you must ensure that can pass.

Environment is ready, you can start, I did not take the rpm mode, install mysql under ubuntu direct online is very convenient, eliminating a lot of steps.

$ Sudo apt-get install mysql-server

After the default installation automatically open, so use netstat -tap | grep mysql mysql service to see if it exists

After the query is running under mysql status, service mysql status, similarly, there are other commands, service mysql start / stop / restart.

If the following message appears, it means success.

mysql start / running, process 1199

Before landing at /etc/mysql/my.cnf first comment out the bind-address, because the default can only access this machine.

Landing mysql

mysql -u root -p

grant replication slave, reload, super on *. * to slave @ 192.168.1.152 identified by '1234'

Then another Ubuntu remote testing

mysql -u slave -h 192.168.1.151 -p

Preparatory work is ready, now start the configuration:

On the master 192.168.1.251 machine to modify my.cnf, remember the following configuration information must be added to the [mysqld] module, on file elsewhere will lead to master configuration failure.

server-id = 1

log_bin = / var / log / mysql / mysql-bin.log

binlog_do_db = student

binlog_ignore_db = mysql

Under restart mysql

sudo /etc/init.d/mysql restart

If you failed in the restart process, it is recommended to look at the next my.cnf log-error log files have to correspond to the location of the error, and cat facie error message

After entering the master's mysql, first look at the binary function is on.

show variables like 'log%'

If it is not turned off on behalf of, or return to the check the next my.cnf file, whether in [mysqld] piece medium. Whether the file path

show master status; you have to be able to see the corresponding file position information, which at the time of the slave set to use.

And finally to the next salve 192.168.1.252 /etc/mysql/my.cnf configuration:

server-id = 2

log_bin = / var / log / mysql / mysql-bin.log

replicate_do_db = student

Under restart mysql

sudo /etc/init.d/mysql restart

slave enter mysql:

stop slave

Then log configuration settings from a master copy

change master to master_host = '192.168.1.151', master_user = 'slave', master_password = '1234',

master_log_file = 'log.000004', master_log_pos = 94;

log_file log_pos is in the master show master status information see the file position.

start slave;

show slave status G

Find Slave_IO_Running / Slave_SQL_Running information appears, we are YES is successful.

If there is a NO, or view the log-error log file, it would be more clear description out.
     
         
         
         
  More:      
 
- MySQL service failed to start thinking of settlement under CentOS7 (Database)
- iostat command Detailed (Linux)
- Installation JDK 1.8 under CentOS7 (Linux)
- RHEL5.8 physical opportunities to Read-only file system (Linux)
- Transfer files to Windows and Linux (Linux)
- Linux System Getting Started Tutorial: How to change the default Java version in Linux (Linux)
- Arrow keys, backspace key garbled in Python-2.7.5 Interactive Mode under CentOS 5.8 (Linux)
- VirtualBox install Windows 8.1 has encountered an error 0x000000C4 solutions (Linux)
- Linux boot process (Linux)
- HBase cluster installation and deployment (Server)
- WebLogic administrator account and reset the password (Database)
- Install Debian Linux with R on the Android system (Linux)
- SSH configuration under Linux (Linux)
- IntelliJ IDEA run in Mac10.9 and JDK7 environment (Linux)
- Deployment Kubernetes manage Docker example cluster on Ubuntu (Server)
- FreeRadius installation process record (Linux)
- Java data structures - the single linked list LinkedList linear table (Programming)
- How to use awk command in Linux (Linux)
- How to prevent page five invisible killer (Linux)
- Git use and interpretation of common commands (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.