centos 6.5设置mysql主从同步过程记录
在centos 6.5上设置了mysql主从功能,记录一下。 服务器1(主) IP:192.168.1.201 系统版本:centos 6.5 mysql版本:mysql 5.5 服务器2(从) IP:192.168.1.202 系统版本:centos 6.5 mysql版本:mysql 5.5 这里两台服务器的系统版本和mysql版本均一致,这
在centos 6.5上设置了mysql主从功能,记录一下。
服务器1(主)
IP:192.168.1.201
系统版本:centos 6.5
mysql版本:mysql 5.5
服务器2(从)
IP:192.168.1.202
系统版本:centos 6.5
mysql版本:mysql 5.5
这里两台服务器的系统版本和mysql版本均一致,这也是官方推荐的做法。在开始设定之前,最好能确保主库和从库一致。
1、主库和从库创建同步用户
1 |
|
这里讲主从同步限制在局域网内。
2、主库配置
编辑mysql配置文件/etc/my.cnf,设定如下配置:
1 2 3 |
|
binlog_format这里选用混合模式,也是mysql 5.5安装包里的my.cnf默认的值。
3、从库配置
编辑mysql配置文件/etc/my.cnf,设定如下配置:
1 2 3 4 5 6 |
|
4、从库启动
1 2 3 4 5 |
|
开启同步
1 |
|
查看状态
1 |
|
从库查看复制状态
如果配置全都正确的话,那么主从就开始工作了。如果主从没有正常工作的话,可以通过mysql自带的命令进行调试。
出错调试
使用show slave status查看Last_IO_Error状态信息:
1 |
|
主从设置连接出错
上面这种情况表示无法正常连接到主库。因为无法连接主库,Slave_IO_State会一直显示Connecting to master。可以在从库上通过mysql客户端连接主库进行调试。
1 |
|
查看工作进程
主库上查看进程:
1 |
|
查看主库线程
从State信息可以看出主库已经发送完所有的binlog
从库上查看进程:
1 |
|
查看从库线程
其中一个是I/O线程,一个是SQL线程。
转载请注明:快乐编程 » centos 6.5设置mysql主从同步过程记录

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics





Improve HDFS performance on CentOS: A comprehensive optimization guide to optimize HDFS (Hadoop distributed file system) on CentOS requires comprehensive consideration of hardware, system configuration and network settings. This article provides a series of optimization strategies to help you improve HDFS performance. 1. Hardware upgrade and selection resource expansion: Increase the CPU, memory and storage capacity of the server as much as possible. High-performance hardware: adopts high-performance network cards and switches to improve network throughput. 2. System configuration fine-tuning kernel parameter adjustment: Modify /etc/sysctl.conf file to optimize kernel parameters such as TCP connection number, file handle number and memory management. For example, adjust TCP connection status and buffer size

CentOS will be shut down in 2024 because its upstream distribution, RHEL 8, has been shut down. This shutdown will affect the CentOS 8 system, preventing it from continuing to receive updates. Users should plan for migration, and recommended options include CentOS Stream, AlmaLinux, and Rocky Linux to keep the system safe and stable.

The CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.

Complete Guide to Checking HDFS Configuration in CentOS Systems This article will guide you how to effectively check the configuration and running status of HDFS on CentOS systems. The following steps will help you fully understand the setup and operation of HDFS. Verify Hadoop environment variable: First, make sure the Hadoop environment variable is set correctly. In the terminal, execute the following command to verify that Hadoop is installed and configured correctly: hadoopversion Check HDFS configuration file: The core configuration file of HDFS is located in the /etc/hadoop/conf/ directory, where core-site.xml and hdfs-site.xml are crucial. use

Installing MySQL on CentOS involves the following steps: Adding the appropriate MySQL yum source. Execute the yum install mysql-server command to install the MySQL server. Use the mysql_secure_installation command to make security settings, such as setting the root user password. Customize the MySQL configuration file as needed. Tune MySQL parameters and optimize databases for performance.

Steps to configure IP address in CentOS: View the current network configuration: ip addr Edit the network configuration file: sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0 Change IP address: Edit IPADDR= Line changes the subnet mask and gateway (optional): Edit NETMASK= and GATEWAY= Lines Restart the network service: sudo systemctl restart network verification IP address: ip addr

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

Common problems and solutions for Hadoop Distributed File System (HDFS) configuration under CentOS When building a HadoopHDFS cluster on CentOS, some common misconfigurations may lead to performance degradation, data loss and even the cluster cannot start. This article summarizes these common problems and their solutions to help you avoid these pitfalls and ensure the stability and efficient operation of your HDFS cluster. Rack-aware configuration error: Problem: Rack-aware information is not configured correctly, resulting in uneven distribution of data block replicas and increasing network load. Solution: Double check the rack-aware configuration in the hdfs-site.xml file and use hdfsdfsadmin-printTopo
