如何在现场/生产环境中监控和维护我的 Grails 应用程序?

发布于 2024-08-21 20:53:17 字数 468 浏览 6 评论 0原文

这是我第一次启动实时网站(在 Amazon EC2 平台和 Cloud Foundry 下使用 Grails Web 框架),我很快意识到我还没有准备好在生产模式下正确监控和维护我的应用程序(幸运的是该网站可以访问)仅限数量非常有限的用户)。

到目前为止我面临的问题是:

  • 无法改变我的观点。我需要重新部署我的应用程序,
  • 但我没有监控。我不知道谁连接了,他们什么时候登录/注销...
  • 重新部署我的应用程序(上传 WAR + 部署)至少需要 30 分钟。
  • 我不知道如何在不通过 Cloud Foundry 重新部署的情况下重新启动 Tomcat 服务器!
  • ...

所以,我的问题很简单:

你可以推荐什么工具(包括grails插件)和方法让我摆脱困境我目前失明?

It is the first time I have ever launched live a website (with Grails web framework under Amazon EC2 platform and Cloud Foundry) and I realized quickly that I am not ready for monitoring and maintening correctly my application in production mode (fortunately the website is accessible to a very limited number of users) .

The issues I have faced so far are:

  • Cannot change my views. I need to redeploy my application
  • I have no monitoring. I don't know who is connected, when do they sign in / sign out...
  • Redploying my application (upload WAR + deploy) takes at least 30 minutes.
  • I don't know how to restart my Tomcat server without a redeploy through Cloud Foundry !
  • ...

So, my question is very simple:

What tools (including grails plugins) and methods can you recommend me for taking me out from my current blindness?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

随心而道 2024-08-28 20:53:17

我不确定这有多大帮助,但是我使用 JavaMelody Grails 插件(http://www.grails.org/plugin/grails-melody)在关闭服务之前,我用它来查看该网站是否正在被使用。

希望有帮助。

I am not sure how much this will help, however I use the JavaMelody Grails Plugin(http://www.grails.org/plugin/grails-melody) I use it to see if the site is being used before I pull down the service.

Hope that helps.

冷弦 2024-08-28 20:53:17

我在早期尝试过 Cloud Foundry,发现它有点粗糙。听起来情况仍然如此,部署超过 30 分钟并且无法重新启动 Tomcat 服务器。如果您创建自己的 EC2 实例、安装 tomcat 并管理自己的部署,那么一半的问题就可以解决。这将让您通过 shell 访问弹起 tomcat:

sudo /etc/init.d/tomcat6 restart

并重新部署您的应用程序

sudo /etc/init.d/tomcat6/stop
cp my.war /to/tomcat/dir 
sudo /etc/init.d/tomcat6 start

,或者您可以通过 tomcat 管理控制台来完成此操作,但我发现它很不稳定。

关于监控,有几种方法可以做到这一点。最简单的方法是向您的系统添加 CloudWatch 监控。这将使您更深入地了解应用程序的性能。

要更详细地监控谁连接到您的应用,我建议您查看 Google Analytics 或 < a href="http://haveamint.com/" rel="nofollow noreferrer">薄荷。如果您需要超越这一点(通过每个用户监控),您可能必须滚动自己的日志记录/跟踪以满足您的需求。还有其他类似 Google Analytics 和 Mint 的付费软件包可供您集成,但我不能说哪个最适合您的需求。

I tried Cloud Foundry in it's early days and found it a little rough. Sounds like that's still the case with 30+ minute deploys and the inability to restart your tomcat server. Half of your problems could be solved if you just created your own EC2 instance, installed tomcat and managed your own deployments. That'll let you bounce tomcat through shell access:

sudo /etc/init.d/tomcat6 restart

and redeploy your app

sudo /etc/init.d/tomcat6/stop
cp my.war /to/tomcat/dir 
sudo /etc/init.d/tomcat6 start

or else you could do it through the tomcat admin console, but I find it to be flaky.

Regarding monitoring, there are a couple of ways you can do that. The easiest is to add CloudWatch monitoring to your system. That'll give you more insight into the performance of the application.

For more detailed monitoring regarding who's connecting to your app, I'd suggest looking at Google Analytics or Mint. If you need to get beyond that (with per user monitoring), you'll likely have to roll your own logging/tracking for what meets your needs. There are also other paid packages out there along the lines of Google Analytics and Mint that you can integrate with, but what fits your needs best, I can't say.

盗琴音 2024-08-28 20:53:17

对于已部署系统的实际监控,您还可以使用 Hiperic HQ。它是来自 Spring Source 的监控解决方案,Spring Source 也是 Grails Framework 的所有者。

它可以根据您的情况进行管理:

  1. tomcat 服务器
  2. 数据库
  3. Linux
  4. 网络

顺便说一句,重新部署应用程序并进行更改是可以的。在生产服务器上修改正在运行的应用程序是一种非常糟糕的做法。

For actual monitoring of deployed system you can also use Hiperic HQ. It's a monitoring solution from Spring Source, who also are owners of Grails Framework.

It can manage, at your case:

  1. tomcat server
  2. database
  3. linux
  4. network
  5. etc

btw redeploying app with changes is ok. it's a very bad practice to modify running app, on the production server.

迷途知返 2024-08-28 20:53:17

我不知道 JMX 和 JConsole 是否可以提供帮助,但这可能是查看启用 JMX 的 POJO 状态的好方法。 Spring 使这一切变得容易。

I don't know if JMX and JConsole can help, but that might be a good way to see what the status of JMX-enabled POJOs is. Spring makes this easy to do.

莳間冲淡了誓言ζ 2024-08-28 20:53:17
  1. 是的,当您更改应用程序中的内容时,您需要重新部署应用程序,这是没有办法解决的。
  2. 如果使用 grails 插件,部署/重新部署时间最近会显着缩短(顺便说一句,您使用什么版本的插件?)在某些情况下,上传时间短至 15 秒。亚马逊需要 2-3 分钟来启动实例,部署时间仍然相当容易管理。对于重新部署,不必启动实例,因此甚至更少。
  3. 要重新启动 Tomcat,请登录到您的 CloudFoundry 帐户,单击“部署详细信息”,单击正在运行 Tomcat 的实例,然后将出现一个“重新启动服务”按钮,即可执行此操作 - 重新启动 Tomcat 服务。
  4. 您不必启动自己的 EC2 实例即可获得 shell 访问权限。从 DeploymentDetails 复制实例的公共 DNS 名称,并使用您在注册 Cloudfoundry 时输入的私钥通过 SSH 复制到该实例。示例:

    ssh -i /path/to/gsg-keypair.pem root@your_instance_DNS_name

  1. Yes, you need to re-deploy your app when you change stuff in it, there's no way around that.
  2. Deploy/re-deploy time has been cut significantly recently if using the grails plugin (btw, what version of the plugin do you use?) In some cases the upload time is as short as 15 seconds. Add 2-3 minutes for Amazon to spin up the instances and the deploy time is still pretty manageable. For re-deploy the instances don't have to be started, so it's even less than that.
  3. To restart Tomcat login into your CloudFoundry account, click on the Deployment details, click on the instance that's running your Tomcat, and there will be a button "Restart service" that will do just that - restart Tomcat service.
  4. You don't have to start your own EC2 instances in order to get a shell access. Copy the public DNS name of the instance from DeploymentDetails, and SSH into it using the private key you entered when registering for Cloudfoundry. Example:

    ssh -i /path/to/gsg-keypair.pem root@your_instance_DNS_name

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文