前文已经介绍了nGrinder 集群模式基本框架,本文就要涉及具体配置了!
假设大家已经对nGrinder 单一模式配置方法有所了解。
- 在nGrinder集群模式下多个Controller端使用同一DB和文件系统.所以首先要做的就是搭建好共享文件系统,确认${NGRINDER_HOME} 文件夹。
在${NGRINDER_HOME}/system.conf 也要有如下配置
# if you want to enable ngrinder controller clustering. please enable below.
ngrinder.cluster.mode = true
# cache cluster uri of all clustered controller servers.
# only the controller and agents in same region will work together.
ngrinder.cluster.uris=xx.xx.xx.xx;xx.xx.xx.xx
# cache cluster listener port.
ngrinder.cluster.listener.port=40003
- 第二步就要在每个Controller端添加本地文件夹${NGRINDER_EX_HOME} 。不像${NGRINDER_HOME},这个文件夹必须手动创建,文件system-ex.conf 配置如下
# region setting of this controller.
# When running ngrinder as cluster mode, the ${NGRINDER_HOME} should be shared by multiple controllers.
# We expect this to be done by running ${NGRINDER_HOME} on NFS.
# However this option is not to set here. Because each controller in cluster must have system-ex.conf
# which should be stored in ${NGRINDER_EX_HOME} in the local so that each node cluster looks different value.
# Please locate followings this on the ${NGRINDER_EX_HOME}(by default .ngrinder_ex)/system-ex.conf
ngrinder.cluster.region=Beijing
经过以上配置,我们只要将所有Controller 重新启动,就可以了!
在集群模式下,Agent的配置也会有所不同。Agent只有设置IP和区域(与Controller 区域相同)才能连接对应Controller。
所有Agent配置文件" ~/.ngrinder-agent"
agent.console.ip=controller ip
agent.console.port= controller port
agent.region={controller region}
如果是用户要配置自己所属Agent
agent.console.ip=controller ip
agent.console.port= controller port
agent.region={controller region}
来源:oschina
链接:https://my.oschina.net/u/939534/blog/104312