今天 linux 系统下做了 mycat 的数据库分片,虚拟机启动 mycat 服务后,win7 下远程连接 mycat。
发现 mycat 启动以后使用 Navicat for mysql 连接报了下列错误
ERROR 2003 (HY000): Can't connect to MySQL server on x.x.x.x
于是回去看了一下mycat的服务居然自动挂了
./mycat status
看了一下mycat的日志
./mycat console
出现下列信息
[code]wrapper | --> Wrapper Started as Console
wrapper | Launching a JVM...
wrapper | JVM exited while loading the application.
jvm 1 | OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=64M; support was removed in 8.0
jvm 1 | OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000aaaa0000, 1431699456, 0) failed; error='Cannot allocate memory' (errno=12)
jvm 1 | #
jvm 1 | # There is insufficient memory for the Java Runtime Environment to continue.
jvm 1 | # Native memory allocation (mmap) failed to map 1431699456 bytes for committing reserved memory.
jvm 1 | # An error report file with more information is saved as:
jvm 1 | # /usr/local/mycat/hs_err_pid49051.log
wrapper | Launching a JVM...
wrapper | JVM exited while loading the application.
翻译了一下大概说是jvm没法分配内存了
于是去度娘了一下!
发现网上说需要开启系统的 Over-commit,跳过系统的可用内存检查直接分配。
为了避免重启服务器以后 搭建的zk集群solr集群redis集群 需要重新启动
执行了临时操作
临时更改: echo 1 > /proc/sys/vm/overcommit_memory
永久更改: 编辑 /etc/sysctl.conf,修改参数 vm.overcommit_memory = 1,重启服务器或者用户重新登录
执行完以后发现Navicat可以正常连接mycat的端口了
记录每一个坑!