1MyCat安装及启动

MyCat:

MyCat的官方网站:

http://www.mycat.org.cn/

下载地址:

https://github.com/MyCATApache/Mycat-download

已经更换为:

http://dl.mycat.io/1.6-RELEASE/

第一步:将Mycat-server-1.4-release-20151019230038-linux.tar.gz上传至服务器

tar -xzvf Mycat-server-1.4-release-20151019230038-linux.tar.gz
mv mycat /usr/local

第二步:将压缩包解压缩。建议将mycat放到/usr/local/mycat目录下。

./mycat start

停止:第三步:进入mycat目录的bin目录,启动mycat

./mycat stop

Mycat的默认端口号为:8066mycat 支持的命令{ console | start | stop | restart | status | dump }

 

下载新版本的启动的时候会报错:

STATUS | wrapper  | 2019/09/27 10:19:53 | --> Wrapper Started as Daemon
STATUS | wrapper  | 2019/09/27 10:19:53 | Launching a JVM...
ERROR  | wrapper  | 2019/09/27 10:19:53 | JVM exited while loading the application.
INFO   | jvm 1    | 2019/09/27 10:19:53 | Invalid maximum heap size: -Xmx4G
INFO   | jvm 1    | 2019/09/27 10:19:53 | The specified size exceeds the maximum representable size.
INFO   | jvm 1    | 2019/09/27 10:19:53 | Error: Could not create the Java Virtual Machine.
INFO   | jvm 1    | 2019/09/27 10:19:53 | Error: A fatal exception has occurred. Program will exit.
STATUS | wrapper  | 2019/09/27 10:19:57 | Launching a JVM...
ERROR  | wrapper  | 2019/09/27 10:19:57 | JVM exited while loading the application.
INFO   | jvm 2    | 2019/09/27 10:19:57 | Invalid maximum heap size: -Xmx4G
INFO   | jvm 2    | 2019/09/27 10:19:57 | The specified size exceeds the maximum representable size.
INFO   | jvm 2    | 2019/09/27 10:19:57 | Error: Could not create the Java Virtual Machine.
INFO   | jvm 2    | 2019/09/27 10:19:57 | Error: A fatal exception has occurred. Program will exit.
STATUS | wrapper  | 2019/09/27 10:20:02 | Launching a JVM...
ERROR  | wrapper  | 2019/09/27 10:20:02 | JVM exited while loading the application.
INFO   | jvm 3    | 2019/09/27 10:20:02 | Invalid maximum heap size: -Xmx4G
INFO   | jvm 3    | 2019/09/27 10:20:02 | The specified size exceeds the maximum representable size.
INFO   | jvm 3    | 2019/09/27 10:20:02 | Error: Could not create the Java Virtual Machine.
INFO   | jvm 3    | 2019/09/27 10:20:02 | Error: A fatal exception has occurred. Program will exit.
STATUS | wrapper  | 2019/09/27 10:20:06 | Launching a JVM...
ERROR  | wrapper  | 2019/09/27 10:20:06 | JVM exited while loading the application.
INFO   | jvm 4    | 2019/09/27 10:20:06 | Invalid maximum heap size: -Xmx4G
INFO   | jvm 4    | 2019/09/27 10:20:06 | The specified size exceeds the maximum representable size.
INFO   | jvm 4    | 2019/09/27 10:20:06 | Error: Could not create the Java Virtual Machine.
INFO   | jvm 4    | 2019/09/27 10:20:06 | Error: A fatal exception has occurred. Program will exit.
STATUS | wrapper  | 2019/09/27 10:20:10 | Launching a JVM...
ERROR  | wrapper  | 2019/09/27 10:20:10 | JVM exited while loading the application.
INFO   | jvm 5    | 2019/09/27 10:20:10 | Invalid maximum heap size: -Xmx4G
INFO   | jvm 5    | 2019/09/27 10:20:10 | The specified size exceeds the maximum representable size.
INFO   | jvm 5    | 2019/09/27 10:20:10 | Error: Could not create the Java Virtual Machine.
INFO   | jvm 5    | 2019/09/27 10:20:10 | Error: A fatal exception has occurred. Program will exit.
FATAL  | wrapper  | 2019/09/27 10:20:10 | There were 5 failed launches in a row, each lasting less than 300 seconds.  Giving up.
FATAL  | wrapper  | 2019/09/27 10:20:10 |   There may be a configuration problem: please check the logs.
STATUS | wrapper  | 2019/09/27 10:20:10 | <-- Wrapper Stopped

    大致意思是jvm内存不够,解决方法:

    在mycat文件下conf中修改wrapper.conf文件

    删除一下两行:在第36,37行(1.6的版本)    

wrapper.java.additional.10=-Xmx4G
wrapper.java.additional.11=-Xms1G

    然后再次启动的时候,还会报错:

    

STATUS | wrapper  | 2019/09/29 23:24:33 | --> Wrapper Started as Daemon
STATUS | wrapper  | 2019/09/29 23:24:34 | Launching a JVM...
ERROR  | wrapper  | 2019/09/29 23:24:49 | JVM exited while loading the application.
INFO   | jvm 1    | 2019/09/29 23:24:49 | Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: cluster-1: cluster-1: Temporary failure in name resolution
STATUS | wrapper  | 2019/09/29 23:24:53 | Launching a JVM...
ERROR  | wrapper  | 2019/09/29 23:25:08 | JVM exited while loading the application.
INFO   | jvm 2    | 2019/09/29 23:25:08 | Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: cluster-1: cluster-1: Temporary failure in name resolution
STATUS | wrapper  | 2019/09/29 23:25:12 | Launching a JVM...
ERROR  | wrapper  | 2019/09/29 23:25:28 | JVM exited while loading the application.
INFO   | jvm 3    | 2019/09/29 23:25:28 | Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: cluster-1: cluster-1: Temporary failure in name resolution
STATUS | wrapper  | 2019/09/29 23:25:32 | Launching a JVM...
ERROR  | wrapper  | 2019/09/29 23:25:47 | JVM exited while loading the application.
INFO   | jvm 4    | 2019/09/29 23:25:47 | Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: cluster-1: cluster-1: Temporary failure in name resolution
STATUS | wrapper  | 2019/09/29 23:25:51 | Launching a JVM...
ERROR  | wrapper  | 2019/09/29 23:26:06 | JVM exited while loading the application.
INFO   | jvm 5    | 2019/09/29 23:26:06 | Error: Exception thrown by the agent : java.net.MalformedURLException: Local host name unknown: java.net.UnknownHostException: cluster-1: cluster-1: Temporary failure in name resolution
FATAL  | wrapper  | 2019/09/29 23:26:06 | There were 5 failed launches in a row, each lasting less than 300 seconds.  Giving up.
FATAL  | wrapper  | 2019/09/29 23:26:06 |   There may be a configuration problem: please check the logs.
STATUS | wrapper  | 2019/09/29 23:26:06 | <-- Wrapper Stopped

    解决方法: 

  vi     /etc/sysconfig/network

    追加一行: HOSTNAME=你的主机名

    接着修改:  vi     /etc/hosts

    添加这句后面添加 你的主机名

    127.0.0.1               localhost.localdomain localhost 你的主机名

    然后重新启动。。。。ok