I am in centos6.5 version, 32-bit system
Host IP address 192.168.234.132 slave 192.168.234.131
Install a simple MySQL cluster with a master bundle
First, yum installation version 5.1.73
Yum-y Install Mysql-server #安装mysql的服务端
Installation Complete
1.1 Configuring the primary server first
VI/ETC/MY.CNF # # #进入mysql配置文件
The statement is long and the disk changes small, it is advisable to use row for example: Update age=age+1 where id=3; Change the age of the person with ID 3
Short statement but can affect tens of thousands of lines, it is advisable to use statement for example: Update salary=slary+100; company-wide Employee payroll
Start MySQL # #初次启动默认会初始化数据库
Mysql-u root-p # #登陆mysql No password added default no person password direct enter
Grant replication client,replication slave on . to [email protected] ' 192.168.30.% ' identified by ' Suiyishu '; br/& gt;! [] (http://i2.51cto.com/images/blog/201808/26/ea0e77111ada39f4452454c679d8916f.png?x-oss-process=image/ watermark,size_16,text_qduxq1rp5y2a5a6i,color_ffffff,t_100,g_se,x_10,y_10,shadow_90,type_zmfuz3pozw5nagvpdgk=)
##@ Front is generally not recommended with root, feel free to create a better
# #[email protected] after you fill in your IP address, ifconfig view
< p="">
flush privileges; ##更新权限
Show master status; # #显示主服务器信息
The above two parameters will be used later
1.2 Configuring from MySQL server
Vi/etc/my.cnf
Service mysqld Start # #开启mysql
Mysql-u Root-p # #进入mysql
Change Master to
Master_host= ' 192.168.30.132 ',
Master_user= ' Root ',
Master_password= ' Suiyishu ',
Master_log_file= ' mysql-bin.000003 ',
master_log_pos=354;
Note the corresponding parameters, and do not less commas (,)
# # # #开启成功, # #注意防火墙与selinux的配置
If you are not successful, look at the error parameters with/var/log/mysqld.log
This time without although the actual connection did not succeed,
The connection user name does not match the actual user name by viewing the system log discovery
Reconfigure configuration Files
Host and slave plus user and password, so that the user and password will not be changed temporarily, resulting in a connection failure
Of course, do not know can go to Baidu, www.baidu.com is every programmer's destination
and reboot into the interface.
Reconfigure master-slave MySQL and connect
The final connection succeeds, the master-slave environment matches successfully, and the test succeeds
The normal test should be the primary server to create a database, from the server to see if it can be received, can not go to the log to check the error, or view the code. Because I have the wrong photos, and the environment has been deleted, it is no longer a specific demonstration.
A simple MySQL cluster