mycat启动失败

1.问题

使用mycat配置主从读写分离,启动mycat报错信息如下:

STATUS | wrapper  | 2020/06/17 17:00:11 | --> Wrapper Started as Daemon
STATUS | wrapper  | 2020/06/17 17:00:11 | Launching a JVM...
ERROR  | wrapper  | 2020/06/17 17:00:11 | JVM exited while loading the application.
INFO   | jvm 1    | 2020/06/17 17:00:11 | Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: mysql01: mysql01: Name or service not known
STATUS | wrapper  | 2020/06/17 17:00:15 | Launching a JVM...
INFO   | jvm 2    | 2020/06/17 17:00:16 | Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: mysql01: mysql01: Name or service not known
ERROR  | wrapper  | 2020/06/17 17:00:16 | JVM exited while loading the application.
STATUS | wrapper  | 2020/06/17 17:00:20 | Launching a JVM...
ERROR  | wrapper  | 2020/06/17 17:00:20 | JVM exited while loading the application.
INFO   | jvm 3    | 2020/06/17 17:00:20 | Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: mysql01: mysql01: Name or service not known
STATUS | wrapper  | 2020/06/17 17:00:25 | Launching a JVM...
ERROR  | wrapper  | 2020/06/17 17:00:25 | JVM exited while loading the application.
INFO   | jvm 4    | 2020/06/17 17:00:25 | Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: mysql01: mysql01: Name or service not known
STATUS | wrapper  | 2020/06/17 17:00:29 | Launching a JVM...
ERROR  | wrapper  | 2020/06/17 17:00:30 | JVM exited while loading the application.
INFO   | jvm 5    | 2020/06/17 17:00:30 | Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: mysql01: mysql01: Name or service not known
FATAL  | wrapper  | 2020/06/17 17:00:30 | There were 5 failed launches in a row, each lasting less than 300 seconds.  Giving up.
FATAL  | wrapper  | 2020/06/17 17:00:30 |   There may be a configuration problem: please check the logs.
STATUS | wrapper  | 2020/06/17 17:00:30 | <-- Wrapper Stopped

2.问题解决

原因:无法解析主机名

解决方法:

修改hosts文件

[mysql@mysql01 ~]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.12.60 mysql01

再次启动mycat,状态正常。

[mysql@mysql01 ~]$ mycat status
Mycat-server is running (37136).

 

上一篇:MySQL 部署分布式架构 MyCAT (一)


下一篇:1369 xth 砍树