Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

将Windows下NGRINDER_AGENT_HOME默认指到安装目录下 #25

Closed
wants to merge 1 commit into from

Conversation

higkoo
Copy link
Contributor

@higkoo higkoo commented Oct 28, 2013

Windows下不允许建立 .ngrinder_agent 的目录或文件(属于没有文件名,只有后缀)。
官网的文档也要改 :www.cubrid.org/wiki_ngrinder/entry/installation-guide
直接把这个配置指向到安装目录最好了,简单易用!然后给个默认的配置,降低使用门槛。

Windows下不允许建立 .ngrinder_agent 的目录或文件(属于没有文件名,只有后缀)。
官网的文档也要改 :www.cubrid.org/wiki_ngrinder/entry/installation-guide
直接把这个配置指向到安装目录最好了,简单易用!然后给个默认的配置,降低使用门槛。
@Mavlarn
Copy link
Contributor

Mavlarn commented Oct 29, 2013

将ngrinder的文件目录放到user home里面,是当时有意这样设计的。原因是:
如果把文件目录放在安装目录的话,在更新ngrinder时,就需要手动的修改,例如把这些文件拷贝到新的目录。按我们的设计,就不需要做任何修改,就可以直接用新的文件替换。
而且,将程序文件跟一般文件分开也是绝大多数软件系统的做法,大都是为了更新升级的方便。也有助于在多用户的系统下,可以独立的使用而不相互影响。
将软件的配置等文件放在用户的home目录中,也是现在大多数软件系统采用的方式。不管是windows还是linux,在home目录下面都能看到很多.***的文件夹。

说到更新,由于在我们公司,ngrinder的测试平台包括测试环境和生产环境,有差不多10台左右的controller运行在cluster模式下,agent就更多了。如果要把文件目录放在安装目录下,更新就会非常繁琐。现在我们更新controller只需要使用集中部署工具,依次停止、更新war包、启动controller。对于agent端,就是直接更新文件,我们也正在开发自动从controller更新的功能。

至于默认的配置,对于controller,直接解压就可以使用。对于agent,如果controller和agent在同一台机器,也是解压就可以使用。在第一次运行的时候,配置文件夹会自动被创建,相应文件也被复制到里面。

如果想在第一次运行之前就自己配置的话,在windows下,要创建.ngrinder目录,只能使用命令行方式。

所以,默认情况下,还是就使用现有的方式,如果用户需要,可以像你的这种方式,在启动脚本里面定义HOME目录,或者设置系统变量。

@higkoo
Copy link
Contributor Author

higkoo commented Oct 29, 2013

原来是这样,看来是我理解不够。多谢指点!

@higkoo higkoo closed this Oct 29, 2013
@wuhaifengsf
Copy link

private void copyDefaultConfigurationFiles() {
Preconditions.checkNotNull(this.home);
File agentConfig = this.home.getFile("agent.conf");
File newAgentConfig = new File(getCurrentDirectory(), "__agent.conf");
if (agentConfig.exists()) {
if (System.getProperty("common.overwrite_config") != null) {
LOGGER.info("Overwrite the existing agent.conf with __agent.conf");
} else if ((newAgentConfig.exists()) && (newAgentConfig.lastModified() > agentConfig.lastModified()))
{
LOGGER.warn("The agent configuration file '{}' already exists.", agentConfig.getAbsolutePath());
LOGGER.warn("If you want to use the recent agent configuration provided from the controller.");
LOGGER.warn("Please run agent with -o option");
return;
}
}
if (newAgentConfig.exists())
this.home.copyFileTo(newAgentConfig, "agent.conf");
else
try {
this.home.writeFileTo(loadResource("/agent.conf"), "agent.conf");
} catch (IOException e) {
throw ExceptionUtils.processException(e);
}
}
这段代码不太懂啊。。

@Mavlarn
Copy link
Contributor

Mavlarn commented Oct 16, 2015

@wuhaifengsf 请参考下面的说明:
http://www.cubrid.org/wiki_ngrinder/entry/agent-configuration-guide

agent在第一次启动的时候,会把__agent.conf文件复制到agent的home目录里面,之后,默认情况下,就不会再复制了。如果这时候,你的agent目录里面的__agent.conf文件修改过,就会提示(就是上面连续3行的LOGGER.warn语句),然后结束该方法,也就是不替换配置文件。

如果你用-o参数启动的agent,就会用agen目录里的__agent.conf文件替换home目录里面的agent.conf配置文件。

所以,这只是一种修改agent的配置文件的方式,你可以修改home目录里面的,也可以修改agent安装目录里的。

lopiter pushed a commit that referenced this pull request Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants