数据库
首页 > 数据库> > 在做MySQL的主从复制和读写分离时,出现的各种小错误

在做MySQL的主从复制和读写分离时,出现的各种小错误

作者:互联网

在做MySQL的主从复制和读写分离时,出现的各种小错误

问题一

问题:/var/run/yum.pid已被锁定,PID为79393的另一个程序正在运行。

在从服务器设置时,安装ntp和ntpdate,出现/var/run/yum.pid已被锁定,PID为79393的另一个程序正在运行的问题。
在这里插入图片描述

分析原因

出现错误的原因时因为进程号79393的进程正在被其他服务占用,所以,我们要把它杀死就可以了

解决问题

kill -9 79393

在这里插入图片描述

问题二

问题:在配置从服务器的mysql配置时,查看 Slave 状态,Slave_IO_Running: No   Slave_SQL_Running: Yes

在这里插入图片描述

分析原因

一般 Slave_IO_Running: No 的可能性:
1、网络不通
2、my.cnf配置有问题
3、密码、file文件名、pos偏移量不对
4、防火墙没有关闭

所以,让我们一一检查一下

解决问题

在检查上述的问题时,发现了自己的file文件名、pos偏移量和主服务器的配置的不同,所以从新在从服务器上配置了以下。如图:
在这里插入图片描述

问题三

问题:在amoeba服务器配置amoeba服务时,netstat -anpt | grep java没有反应,端口没有开启

[root@localhost conf]# /usr/local/amoeba/bin/amoeba start&
[4] 33191
[root@localhost conf]# log4j:WARN log4j config load completed from file:/usr/local/amoeba/conf/log4j.xml
2021-03-09 11:19:47,145 INFO  context.MysqlRuntimeContext - Amoeba for Mysql current versoin=5.1.45-mysql-amoeba-proxy-2.2.0
Exception in thread "main" com.meidusa.amoeba.config.ConfigurationException: Initialisation bean=com.meidusa.amoeba.mysql.parser.MysqlQueryRouter@16290fbc error
    with nested exception 
com.meidusa.amoeba.util.InitialisationException: cannot found Pool=mater
	at com.meidusa.amoeba.context.ProxyRuntimeContext.initAllInitialisableBeans(ProxyRuntimeContext.java:336)
	at com.meidusa.amoeba.context.ProxyRuntimeContext.init(ProxyRuntimeContext.java:291)
	at com.meidusa.amoeba.server.AmoebaProxyServer.main(AmoebaProxyServer.java:161)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
	at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:461)
with nested exception com.meidusa.amoeba.util.InitialisationException: cannot found Pool=mater
com.meidusa.amoeba.util.InitialisationException: cannot found Pool=mater
	at com.meidusa.amoeba.route.AbstractQueryRouter.init(AbstractQueryRouter.java:483)
	at com.meidusa.amoeba.context.ProxyRuntimeContext.initAllInitialisableBeans(ProxyRuntimeContext.java:331)
	at com.meidusa.amoeba.context.ProxyRuntimeContext.init(ProxyRuntimeContext.java:291)
	at com.meidusa.amoeba.server.AmoebaProxyServer.main(AmoebaProxyServer.java:161)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.codehaus.classworlds.Launcher.launchStandard(Launcher.java:410)
	at org.codehaus.classworlds.Launcher.launch(Launcher.java:344)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:461)

[root@localhost conf]# netstat -anpt | grep java
[root@localhost conf]# netstat -anpt | grep 8066
[root@localhost conf]# netstat -anpt | grep java
[root@localhost conf]# netstat -anpt | grep java

分析原因

第一时间,我先想到了是不是我在前面的配置文件中的内容配错了,所以,我首先查看了amoeba服务器配置文件
amoeba.xml 、 dbServers.xml

解决问题

查看修改配置文件,配置文件的具体内容可以看我上一篇的博客MySQL主从复制与读写分离里面的二、搭建 MySQL 读写分离的amoeba服务器配置amoeba服务(192.168.28.20)部分。

vim amoeba.xml	

vim dbServers.xml

结果真的是配置文件错了,不是少打就是错打了字母
所以,朋友们,在修改配置文件时,一定要小心、仔细的检查一下,不然就会很费时间和精力的
在这里插入图片描述

标签:主从复制,java,Launcher,读写,meidusa,reflect,amoeba,MySQL,com
来源: https://blog.csdn.net/weixin_51725822/article/details/114579780