不废话,搞起
双M 模式
环境
1,java-1.8
这里有个问题,centos 安装yum install java-1.8 是只是安装的java 运行环境jre,还缺少开发包
所以在编译的时候会有问题,使用yum install yum install java-1.8.0-openjdk-devel* 这样就全部都
安装好了openjdk-1.8
设置环境变量
yum 安装的默认位置是/usr/lib/jvm/java-1.8.0-openjdk.x86_64
所以
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk.x86_64 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
source /etc/profile 即使生效
2,maven3.5.0
没什么可说的,直接官网下载apache-maven-3.5.0-bin.tar.gz 解压,然后加入环境变量就好了
export maven_home=/root/apache-maven-3.5.0/
export PATH=$maven_home/bin:$PATH
3,git
4,centos6.8
开始安装并构建
> git clone -b develop https://github.com/apache/incubator-rocketmq.git > cd incubator-rocketmq > mvn -Prelease-all -DskipTests clean install -U > cd distribution/target/apache-rocketmq
启动服务
> nohup sh bin/mqnamesrv & > tail -f ~/logs/rocketmqlogs/namesrv.log The Name Server boot success...
问题来了
先是报内存不够
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000006c0000000, 2147483648, 0) failed; error=‘Cannot allocate memory‘ (errno=12)
调整配置文件
runserver.sh
# JVM Configuration
#===========================================================================================
JAVA_OPT="${JAVA_OPT} -server -Xms128m -Xmx256m -Xmn256m -XX:PermSize=128m -XX:MaxPermSize=320m"
-Xms 的值一定要比 -Xmx 要小不让,也会报错:如下
Initial heap size set to a larger value than the maximum heap size
设置好后启动,
tail -f ~/logs/rocketmqlogs/namesrv.log
2017-05-26 13:28:27 INFO main - serverAsyncSemaphoreValue=64
2017-05-26 13:28:27 INFO main - serverChannelMaxIdleTimeSeconds=120
2017-05-26 13:28:27 INFO main - serverSocketSndBufSize=4096
2017-05-26 13:28:27 INFO main - serverSocketRcvBufSize=4096
2017-05-26 13:28:27 INFO main - serverPooledByteBufAllocatorEnable=true
2017-05-26 13:28:27 INFO main - useEpollNativeSelector=false
2017-05-26 13:28:28 INFO main - The Name Server boot success. serializeType=JSON
2017-05-26 13:28:28 INFO NettyEventExecutor - NettyEventExecutor service started
2017-05-26 13:29:28 INFO NSScheduledThread1 - --------------------------------------------------------
2017-05-26 13:29:28 INFO NSScheduledThread1 - configTable SIZE: 0
小总结:机器内存小真是头疼,小爷我的机器是700多M,这配置默认都是4G的。。。不过权当生产故障处理了,也算在测试的时候遇到是实战问题,内存不足,内存不足!
原文地址:http://wks97.blog.51cto.com/2139464/1929714