连接到 Clojure 的远程实例
我读到可以通过 REPL 连接到 Clojure 的远程生产实例。
请您向我解释一下好吗?以及如何做?
“Clojure 实例”是什么意思?
I read that is possible to connect to a remote, production instance of Clojure via the REPL.
Would you please explain this to me? and how to do it?
What "instance of Clojure" means?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
对于 REPL,您可以使用 swank-clojure 库。
一旦你的 clojure 应用程序启动并运行并且有一个 swank 服务器在其中运行,你就可以使用其名为 SLIME 的包从 emacs 编辑器连接到它。
还有 NetBeans IDE 插件 enclojure 具有完全相同的功能。它有一个服务器部分,您可以将其包含在 clojure 应用程序中并运行,它还有一个从 NetBeans 连接到它的客户端部分。
For REPL specifically, you can use swank-clojure library.
Once your clojure application is up and running and has a swank server running in it, you can connect to it from emacs editor using its package called SLIME.
There's also NetBeans IDE plugin enclojure that has exactly the same functionality. It has a server part, which you include and run in your clojure application, and it has a client part which connects to it from NetBeans.
我想你想使用clojure.contrib.server-socket。我没有使用过它,所以除了参考之外我无法发表评论。 clojuredocs 网站上有示例。
I think you want use clojure.contrib.server-socket. I haven't used it, so I can't comment beyond the reference. There are examples on the clojuredocs site.
Emacs 的下一个版本的 clojure-mode 将使通过 ssh 隧道安全地连接到远程 swank-clojure 实例变得非常简单。您需要做的就是通过 Emacs 的 trapp 从远程项目中打开一个文件,然后调用 clojure-jack-in 。它将启动远程 swank 进程,创建隧道并连接 Emacs/slime。
这与您所要求的不太一样,因为它将启动一个新流程,而不是连接到现有的生产流程。然而,您的炫耀过程将在相同的环境中,否则这样做可能更安全,而不是冒着崩溃实时生产过程的风险。
The next release of
clojure-mode
for Emacs will make it very simple to connect to remote swank-clojure instances securely over a ssh tunnel. All you'll need to do is open a file from your remote project via Emacs' tramp and then callclojure-jack-in
. It will start a remote swank process, create the tunnel and connect Emacs/slime.This isn't quite the same as what you're asking as it will start a new process rather than connecting to the existing production process. However, your swank process will be in the same environment otherwise and it's probably safer to do it this way rather than risk crashing a live production process.