MySQL master-slave replication/SSL encryption

Source: Internet
Author: User

Principle and topology of MySQL master-slave replication:

650) this. width = 650; "border = 0>

Preparations:
1) configure the Host Name and IP address
Node1.forman.com 172.16.220.11
Node2.forman.com 172.16.220.12
2) time synchronization and dual-host Interconnection

 
 
  1. Master:
  2. # Hwclock-s
  3. # Vim/etc/hosts
  4. Add as follows:
  5. 172.16.220.11 node1.forman.com node1
  6. 172.16.220.12 node2.forman.com node2
  7. # Ssh-keygen-t rsa
  8. # Ssh-copy-id-I. ssh/id_rsa.pub root @ node2
  9. # Ssh node2 'ifconfig'
  10.  
  11. Slave# Hwclock-s # vim/etc/hosts
  12. Add as follows:
  13. 172.16.220.11 node1.forman.com node1
  14. 172.16.220.12 node2.forman.com node2
  15. # Ssh-keygen-t rsa
  16. # Ssh-copy-id-I. ssh/id_rsa.pub root @ node1
  17. # Ssh node1 'ifconfig' 

I. Prepare two mysql servers

 
 
  1. Master Slave:
  2. # Fdisk/dev/sda
  3. ....
  4. 1 partition with a size of 20 GB type 8e, sda5
  5. ....
  6. # Partprobe/dev/sda
  7. # Pvcreate/dev/sda5
  8. # Vgcreate myvg/dev/sda5
  9. # Lvcreate-L 10G-n mydata myvg
  10. # Mke2fs-j/dev/myvg/mydata
  11. # Mkdir/data/mydata-pv
  12. # Vim/etc/fstab
  13. /Dev/myvg/mydata/data/mydata ext3 defaults 0 0
  14. # Mount-
  15. # Useradd-r mysql
  16. # Chown-R mysql: mysql/data/mydata
  17. Install mysql
  18. # Tar xf mysql-5.5.22-linux2.6-i686.tar.gz-C/usr/local
  19. # Cd/usr/local
  20. # Ln-sv mysql-5.5.22-linux2.6-i686 mysql
  21. # Cd mysql
  22. # Chown-R mysql: mysql.
  23. # Scripts/mysql_install_db-- User=Mysql -- Datadir=/Data/mydata
  24.  
  25. # Chown-R root.
  26. # Cp support-files/my-large.cnf/etc/my. cnf
  27. # Vim/etc/my. cnf
  28. [Mysqld]
  29. Thread_concurrency=2 
  30. Datadir=/Data/mydata
  31. # Cp support-files/mysql. server/etc/rc. d/init. d/mysqld
  32. # Chmod + x/etc/rc. d/init. d/mysqld
  33. # Chkconfig -- add mysqld
  34. # Service mysqld start
  • 1
  • 2
  • 3
  • 4
  • Next Page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.